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|  52.5M|{
 1630|  52.5M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  208|  52.5M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1630:6): [True: 49.7M, False: 2.77M]
  ------------------
 1631|  49.7M|		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|   378k|		case FILE_BYTE:
  ------------------
  |  |  223|   378k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1637:3): [True: 378k, False: 49.3M]
  ------------------
 1638|   378k|			v = CAST(signed char,  v);
  ------------------
  |  |  426|   378k|#define CAST(T, b)	((T)(b))
  ------------------
 1639|   378k|			break;
 1640|   575k|		case FILE_SHORT:
  ------------------
  |  |  224|   575k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1640:3): [True: 575k, False: 49.1M]
  ------------------
 1641|  2.86M|		case FILE_BESHORT:
  ------------------
  |  |  229|  2.86M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1641:3): [True: 2.29M, False: 47.4M]
  ------------------
 1642|  4.24M|		case FILE_LESHORT:
  ------------------
  |  |  232|  4.24M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1642:3): [True: 1.38M, False: 48.3M]
  ------------------
 1643|  4.24M|			v = CAST(short, v);
  ------------------
  |  |  426|  4.24M|#define CAST(T, b)	((T)(b))
  ------------------
 1644|  4.24M|			break;
 1645|      0|		case FILE_DATE:
  ------------------
  |  |  228|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1645:3): [True: 0, False: 49.7M]
  ------------------
 1646|    123|		case FILE_BEDATE:
  ------------------
  |  |  231|    123|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1646:3): [True: 123, False: 49.7M]
  ------------------
 1647|    371|		case FILE_LEDATE:
  ------------------
  |  |  234|    371|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1647:3): [True: 248, False: 49.7M]
  ------------------
 1648|    439|		case FILE_MEDATE:
  ------------------
  |  |  243|    439|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1648:3): [True: 68, False: 49.7M]
  ------------------
 1649|    439|		case FILE_LDATE:
  ------------------
  |  |  236|    439|#define				FILE_LDATE		14
  ------------------
  |  Branch (1649:3): [True: 0, False: 49.7M]
  ------------------
 1650|    566|		case FILE_BELDATE:
  ------------------
  |  |  237|    566|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1650:3): [True: 127, False: 49.7M]
  ------------------
 1651|    627|		case FILE_LELDATE:
  ------------------
  |  |  238|    627|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1651:3): [True: 61, False: 49.7M]
  ------------------
 1652|    627|		case FILE_MELDATE:
  ------------------
  |  |  244|    627|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1652:3): [True: 0, False: 49.7M]
  ------------------
 1653|   910k|		case FILE_LONG:
  ------------------
  |  |  226|   910k|#define				FILE_LONG		4
  ------------------
  |  Branch (1653:3): [True: 909k, False: 48.8M]
  ------------------
 1654|  8.17M|		case FILE_BELONG:
  ------------------
  |  |  230|  8.17M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1654:3): [True: 7.26M, False: 42.5M]
  ------------------
 1655|  10.6M|		case FILE_LELONG:
  ------------------
  |  |  233|  10.6M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1655:3): [True: 2.44M, False: 47.3M]
  ------------------
 1656|  10.6M|		case FILE_MELONG:
  ------------------
  |  |  245|  10.6M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1656:3): [True: 0, False: 49.7M]
  ------------------
 1657|  10.6M|		case FILE_FLOAT:
  ------------------
  |  |  255|  10.6M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1657:3): [True: 0, False: 49.7M]
  ------------------
 1658|  10.6M|		case FILE_BEFLOAT:
  ------------------
  |  |  256|  10.6M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1658:3): [True: 0, False: 49.7M]
  ------------------
 1659|  10.6M|		case FILE_LEFLOAT:
  ------------------
  |  |  257|  10.6M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1659:3): [True: 0, False: 49.7M]
  ------------------
 1660|  10.6M|		case FILE_MSDOSDATE:
  ------------------
  |  |  275|  10.6M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1660:3): [True: 0, False: 49.7M]
  ------------------
 1661|  10.6M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|  10.6M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1661:3): [True: 0, False: 49.7M]
  ------------------
 1662|  10.6M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|  10.6M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1662:3): [True: 0, False: 49.7M]
  ------------------
 1663|  10.6M|		case FILE_MSDOSTIME:
  ------------------
  |  |  278|  10.6M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1663:3): [True: 0, False: 49.7M]
  ------------------
 1664|  10.6M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|  10.6M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1664:3): [True: 0, False: 49.7M]
  ------------------
 1665|  10.6M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|  10.6M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1665:3): [True: 0, False: 49.7M]
  ------------------
 1666|  10.6M|			v = CAST(int32_t, v);
  ------------------
  |  |  426|  10.6M|#define CAST(T, b)	((T)(b))
  ------------------
 1667|  10.6M|			break;
 1668|  41.1k|		case FILE_QUAD:
  ------------------
  |  |  246|  41.1k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1668:3): [True: 41.1k, False: 49.7M]
  ------------------
 1669|   440k|		case FILE_BEQUAD:
  ------------------
  |  |  248|   440k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1669:3): [True: 399k, False: 49.3M]
  ------------------
 1670|   640k|		case FILE_LEQUAD:
  ------------------
  |  |  247|   640k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1670:3): [True: 200k, False: 49.5M]
  ------------------
 1671|   640k|		case FILE_QDATE:
  ------------------
  |  |  249|   640k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1671:3): [True: 0, False: 49.7M]
  ------------------
 1672|   640k|		case FILE_QLDATE:
  ------------------
  |  |  252|   640k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1672:3): [True: 0, False: 49.7M]
  ------------------
 1673|   640k|		case FILE_QWDATE:
  ------------------
  |  |  264|   640k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1673:3): [True: 112, False: 49.7M]
  ------------------
 1674|   640k|		case FILE_BEQDATE:
  ------------------
  |  |  251|   640k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1674:3): [True: 182, False: 49.7M]
  ------------------
 1675|   640k|		case FILE_BEQLDATE:
  ------------------
  |  |  254|   640k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1675:3): [True: 15, False: 49.7M]
  ------------------
 1676|   640k|		case FILE_BEQWDATE:
  ------------------
  |  |  266|   640k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1676:3): [True: 0, False: 49.7M]
  ------------------
 1677|   640k|		case FILE_LEQDATE:
  ------------------
  |  |  250|   640k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1677:3): [True: 0, False: 49.7M]
  ------------------
 1678|   640k|		case FILE_LEQLDATE:
  ------------------
  |  |  253|   640k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1678:3): [True: 18, False: 49.7M]
  ------------------
 1679|   641k|		case FILE_LEQWDATE:
  ------------------
  |  |  265|   641k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1679:3): [True: 753, False: 49.7M]
  ------------------
 1680|   641k|		case FILE_DOUBLE:
  ------------------
  |  |  258|   641k|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1680:3): [True: 0, False: 49.7M]
  ------------------
 1681|   641k|		case FILE_BEDOUBLE:
  ------------------
  |  |  259|   641k|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1681:3): [True: 0, False: 49.7M]
  ------------------
 1682|   641k|		case FILE_LEDOUBLE:
  ------------------
  |  |  260|   641k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1682:3): [True: 0, False: 49.7M]
  ------------------
 1683|   641k|		case FILE_OFFSET:
  ------------------
  |  |  272|   641k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1683:3): [True: 0, False: 49.7M]
  ------------------
 1684|   641k|		case FILE_BEVARINT:
  ------------------
  |  |  273|   641k|#define				FILE_BEVARINT		51
  ------------------
  |  Branch (1684:3): [True: 0, False: 49.7M]
  ------------------
 1685|   641k|		case FILE_LEVARINT:
  ------------------
  |  |  274|   641k|#define				FILE_LEVARINT		52
  ------------------
  |  Branch (1685:3): [True: 0, False: 49.7M]
  ------------------
 1686|   641k|			v = CAST(int64_t, v);
  ------------------
  |  |  426|   641k|#define CAST(T, b)	((T)(b))
  ------------------
 1687|   641k|			break;
 1688|  33.2M|		case FILE_STRING:
  ------------------
  |  |  227|  33.2M|#define				FILE_STRING		5
  ------------------
  |  Branch (1688:3): [True: 33.2M, False: 16.5M]
  ------------------
 1689|  33.2M|		case FILE_PSTRING:
  ------------------
  |  |  235|  33.2M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1689:3): [True: 16.8k, False: 49.7M]
  ------------------
 1690|  33.2M|		case FILE_BESTRING16:
  ------------------
  |  |  240|  33.2M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1690:3): [True: 105, False: 49.7M]
  ------------------
 1691|  33.2M|		case FILE_LESTRING16:
  ------------------
  |  |  241|  33.2M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1691:3): [True: 39.7k, False: 49.7M]
  ------------------
 1692|  33.4M|		case FILE_REGEX:
  ------------------
  |  |  239|  33.4M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1692:3): [True: 156k, False: 49.6M]
  ------------------
 1693|  33.8M|		case FILE_SEARCH:
  ------------------
  |  |  242|  33.8M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1693:3): [True: 388k, False: 49.3M]
  ------------------
 1694|  33.8M|		case FILE_DEFAULT:
  ------------------
  |  |  225|  33.8M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1694:3): [True: 3.69k, False: 49.7M]
  ------------------
 1695|  33.8M|		case FILE_INDIRECT:
  ------------------
  |  |  263|  33.8M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1695:3): [True: 0, False: 49.7M]
  ------------------
 1696|  33.8M|		case FILE_NAME:
  ------------------
  |  |  267|  33.8M|#define				FILE_NAME		45
  ------------------
  |  Branch (1696:3): [True: 0, False: 49.7M]
  ------------------
 1697|  33.8M|		case FILE_USE:
  ------------------
  |  |  268|  33.8M|#define				FILE_USE		46
  ------------------
  |  Branch (1697:3): [True: 0, False: 49.7M]
  ------------------
 1698|  33.8M|		case FILE_CLEAR:
  ------------------
  |  |  269|  33.8M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1698:3): [True: 266, False: 49.7M]
  ------------------
 1699|  33.8M|		case FILE_DER:
  ------------------
  |  |  270|  33.8M|#define				FILE_DER		48
  ------------------
  |  Branch (1699:3): [True: 0, False: 49.7M]
  ------------------
 1700|  33.8M|		case FILE_GUID:
  ------------------
  |  |  271|  33.8M|#define				FILE_GUID		49
  ------------------
  |  Branch (1700:3): [True: 33.2k, False: 49.7M]
  ------------------
 1701|  33.8M|		case FILE_OCTAL:
  ------------------
  |  |  281|  33.8M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1701:3): [True: 0, False: 49.7M]
  ------------------
 1702|  33.8M|			break;
 1703|      0|		default:
  ------------------
  |  Branch (1703:3): [True: 0, False: 49.7M]
  ------------------
 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|  49.7M|		}
 1709|  49.7M|	}
 1710|  52.5M|	return v;
 1711|  52.5M|}
file_pstring_length_size:
 3626|  20.1k|{
 3627|  20.1k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  357|  20.1k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  386|  20.1k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  378|  20.1k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  20.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  381|  20.1k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  20.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  380|  20.1k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  20.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  383|  20.1k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  20.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  382|  20.1k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  20.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3628|  15.8k|	case PSTRING_1_LE:
  ------------------
  |  |  379|  15.8k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  370|  15.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3628:2): [True: 15.8k, False: 4.34k]
  ------------------
 3629|  15.8k|		return 1;
 3630|    276|	case PSTRING_2_LE:
  ------------------
  |  |  381|    276|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  370|    276|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3630:2): [True: 276, False: 19.9k]
  ------------------
 3631|  3.26k|	case PSTRING_2_BE:
  ------------------
  |  |  380|  3.26k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  370|  3.26k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3631:2): [True: 2.99k, False: 17.1k]
  ------------------
 3632|  3.26k|		return 2;
 3633|    801|	case PSTRING_4_LE:
  ------------------
  |  |  383|    801|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  370|    801|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3633:2): [True: 801, False: 19.3k]
  ------------------
 3634|  1.07k|	case PSTRING_4_BE:
  ------------------
  |  |  382|  1.07k|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  370|  1.07k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3634:2): [True: 273, False: 19.9k]
  ------------------
 3635|  1.07k|		return 4;
 3636|      0|	default:
  ------------------
  |  Branch (3636:2): [True: 0, False: 20.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|  20.1k|	}
 3642|  20.1k|}
file_pstring_get_length:
 3646|  16.9k|{
 3647|  16.9k|	size_t len = 0;
 3648|  16.9k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  427|  16.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3649|  16.9k|	unsigned int s3, s2, s1, s0;
 3650|       |
 3651|  16.9k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  357|  16.9k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  386|  16.9k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  378|  16.9k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  381|  16.9k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  380|  16.9k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  383|  16.9k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  382|  16.9k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3652|  15.6k|	case PSTRING_1_LE:
  ------------------
  |  |  379|  15.6k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  370|  15.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3652:2): [True: 15.6k, False: 1.23k]
  ------------------
 3653|  15.6k|		len = *s;
 3654|  15.6k|		break;
 3655|     92|	case PSTRING_2_LE:
  ------------------
  |  |  381|     92|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  370|     92|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3655:2): [True: 92, False: 16.8k]
  ------------------
 3656|     92|		s0 = s[0];
 3657|     92|		s1 = s[1];
 3658|     92|		len = (s1 << 8) | s0;
 3659|     92|		break;
 3660|    782|	case PSTRING_2_BE:
  ------------------
  |  |  380|    782|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  370|    782|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3660:2): [True: 782, False: 16.1k]
  ------------------
 3661|    782|		s0 = s[0];
 3662|    782|		s1 = s[1];
 3663|    782|		len = (s0 << 8) | s1;
 3664|    782|		break;
 3665|    269|	case PSTRING_4_LE:
  ------------------
  |  |  383|    269|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  370|    269|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3665:2): [True: 269, False: 16.6k]
  ------------------
 3666|    269|		s0 = s[0];
 3667|    269|		s1 = s[1];
 3668|    269|		s2 = s[2];
 3669|    269|		s3 = s[3];
 3670|    269|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3671|    269|		break;
 3672|     91|	case PSTRING_4_BE:
  ------------------
  |  |  382|     91|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  370|     91|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3672:2): [True: 91, False: 16.8k]
  ------------------
 3673|     91|		s0 = s[0];
 3674|     91|		s1 = s[1];
 3675|     91|		s2 = s[2];
 3676|     91|		s3 = s[3];
 3677|     91|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3678|     91|		break;
 3679|      0|	default:
  ------------------
  |  Branch (3679:2): [True: 0, False: 16.9k]
  ------------------
 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|  16.9k|	}
 3685|       |
 3686|  16.9k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  357|  16.9k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  387|  16.9k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  370|  16.9k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3686:6): [True: 746, False: 16.1k]
  ------------------
 3687|    746|		size_t l = file_pstring_length_size(ms, m);
 3688|    746|		if (l == FILE_BADSIZE)
  ------------------
  |  |  158|    746|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|    746|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3688:7): [True: 0, False: 746]
  ------------------
 3689|      0|			return l;
 3690|    746|		len -= l;
 3691|    746|	}
 3692|       |
 3693|  16.9k|	return len;
 3694|  16.9k|}
file_magicfind:
 3698|  49.4k|{
 3699|  49.4k|	uint32_t i, j;
 3700|  49.4k|	struct mlist *mlist, *ml;
 3701|       |
 3702|  49.4k|	mlist = ms->mlist[1];
 3703|       |
 3704|  49.4k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3704:25): [True: 49.4k, False: 0]
  ------------------
 3705|  49.4k|		struct magic *ma = ml->magic;
 3706|   196M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3706:15): [True: 196M, False: 0]
  ------------------
 3707|   196M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  267|   196M|#define				FILE_NAME		45
  ------------------
  |  Branch (3707:8): [True: 188M, False: 7.96M]
  ------------------
 3708|   188M|				continue;
 3709|  7.96M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3709:8): [True: 49.4k, False: 7.91M]
  ------------------
 3710|  49.4k|				v->magic = &ma[i];
 3711|  49.4k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3712|  4.12M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3712:21): [True: 4.12M, False: 13]
  ------------------
 3713|  4.12M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3713:13): [True: 49.4k, False: 4.07M]
  ------------------
 3714|  49.4k|					    break;
 3715|  49.4k|				v->nmagic = j - i;
 3716|  49.4k|				return 0;
 3717|  49.4k|			}
 3718|  7.96M|		}
 3719|  49.4k|	}
 3720|      0|	return -1;
 3721|  49.4k|}
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|  6.22k|{
   73|  6.22k|	file_unichar_t *ubuf = NULL;
   74|  6.22k|	size_t ulen = 0;
   75|  6.22k|	int rv = 1;
   76|  6.22k|	struct buffer bb;
   77|       |
   78|  6.22k|	const char *code = NULL;
   79|  6.22k|	const char *code_mime = NULL;
   80|  6.22k|	const char *type = NULL;
   81|       |
   82|  6.22k|	bb = *b;
   83|  6.22k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  426|  6.22k|#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|  6.22k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 2.54k, False: 3.68k]
  |  Branch (88:23): [True: 631, False: 1.91k]
  ------------------
   89|    631|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  6.22k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 4.36k, False: 1.85k]
  ------------------
   93|  6.22k|	    &type) == 0)
   94|  4.36k|		rv = 0;
   95|  1.85k|        else
   96|  1.85k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  1.85k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  6.22k|	free(ubuf);
  100|       |
  101|  6.22k|	return rv;
  102|  6.22k|}
file_ascmagic_with_encoding:
  108|  1.85k|{
  109|  1.85k|	struct buffer bb;
  110|  1.85k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  1.85k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  1.85k|	size_t nbytes = b->flen;
  112|  1.85k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  1.85k|	size_t mlen, i, len;
  114|  1.85k|	int rv = -1;
  115|  1.85k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  1.85k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.85k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.85k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  1.85k|	int need_separator = 0;
  117|       |
  118|  1.85k|	const char *subtype = NULL;
  119|       |
  120|  1.85k|	int has_escapes = 0;
  121|  1.85k|	int has_backspace = 0;
  122|  1.85k|	int seen_cr = 0;
  123|       |
  124|  1.85k|	int n_crlf = 0;
  125|  1.85k|	int n_lf = 0;
  126|  1.85k|	int n_cr = 0;
  127|  1.85k|	int n_nel = 0;
  128|  1.85k|	int executable = 0;
  129|       |
  130|  1.85k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  426|  1.85k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  1.85k|	size_t has_long_lines = 0;
  132|       |
  133|  1.85k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  1.85k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 6, False: 1.84k]
  ------------------
  137|      6|		rv = 0;
  138|      6|		goto done;
  139|      6|	}
  140|       |
  141|  1.84k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  1.79k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 1.79k, False: 54]
  |  Branch (141:18): [True: 1.79k, 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|  1.79k|		mlen = ulen * 6;
  146|  1.79k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  426|  1.79k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (146:7): [True: 0, False: 1.79k]
  ------------------
  147|      0|			file_oomem(ms, mlen);
  148|      0|			goto done;
  149|      0|		}
  150|  1.79k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (150:7): [True: 68, False: 1.72k]
  ------------------
  151|  1.79k|		    == NULL)
  152|     68|			goto done;
  153|  1.72k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  154|  1.72k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  426|  1.72k|#define CAST(T, b)	((T)(b))
  ------------------
  155|       |
  156|  1.72k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (156:7): [True: 1.59k, False: 128]
  ------------------
  157|  1.72k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  212|  1.72k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  158|  1.59k|			rv = -1;
  159|    128|		else
  160|    128|			need_separator = 1;
  161|  1.72k|		buffer_fini(&bb);
  162|  1.72k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.72k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.72k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (162:7): [True: 0, False: 1.72k]
  ------------------
  163|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (163:9): [True: 0, False: 0]
  ------------------
  164|      0|			goto done;
  165|      0|		}
  166|  1.72k|	}
  167|       |
  168|  1.78k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.78k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.78k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (168:6): [True: 0, False: 1.78k]
  ------------------
  169|      0|		rv = 0;
  170|      0|		goto done;
  171|      0|	}
  172|       |
  173|       |	/* Now try to discover other details about the file. */
  174|  4.87M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (174:14): [True: 4.87M, False: 1.78k]
  ------------------
  175|  4.87M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (175:7): [True: 184k, False: 4.68M]
  ------------------
  176|   184k|			if (seen_cr)
  ------------------
  |  Branch (176:8): [True: 1.55k, False: 183k]
  ------------------
  177|  1.55k|				n_crlf++;
  178|   183k|			else
  179|   183k|				n_lf++;
  180|   184k|			last_line_end = i;
  181|  4.68M|		} else if (seen_cr)
  ------------------
  |  Branch (181:14): [True: 434k, False: 4.25M]
  ------------------
  182|   434k|			n_cr++;
  183|       |
  184|  4.87M|		seen_cr = (ubuf[i] == '\r');
  185|  4.87M|		if (seen_cr)
  ------------------
  |  Branch (185:7): [True: 436k, False: 4.43M]
  ------------------
  186|   436k|			last_line_end = i;
  187|       |
  188|  4.87M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (188:7): [True: 702k, False: 4.17M]
  ------------------
  189|   702k|			n_nel++;
  190|   702k|			last_line_end = i;
  191|   702k|		}
  192|       |
  193|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  194|  4.87M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  4.87M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (194:7): [True: 3.33M, False: 1.53M]
  ------------------
  195|  3.33M|			size_t ll = i - last_line_end;
  196|  3.33M|			if (ll > has_long_lines)
  ------------------
  |  Branch (196:8): [True: 3.19M, False: 142k]
  ------------------
  197|  3.19M|				has_long_lines = ll;
  198|  3.33M|		}
  199|       |
  200|  4.87M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (200:7): [True: 10.5k, False: 4.86M]
  ------------------
  201|  10.5k|			has_escapes = 1;
  202|  4.87M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (202:7): [True: 66.0k, False: 4.80M]
  ------------------
  203|  66.0k|			has_backspace = 1;
  204|  4.87M|	}
  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|  1.78k|	if (seen_cr && nbytes < ms->bytes_max)
  ------------------
  |  Branch (210:6): [True: 74, False: 1.70k]
  |  Branch (210:17): [True: 74, False: 0]
  ------------------
  211|     74|		n_cr++;
  212|       |
  213|  1.78k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (213:6): [True: 0, False: 1.78k]
  ------------------
  214|      0|		rv = 0;
  215|      0|		goto done;
  216|      0|	}
  217|  1.78k|	len = file_printedlen(ms);
  218|  1.78k|	if (mime) {
  ------------------
  |  Branch (218:6): [True: 0, False: 1.78k]
  ------------------
  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|  1.78k|	} else {
  237|  1.78k|		if (len) {
  ------------------
  |  Branch (237:7): [True: 470, False: 1.31k]
  ------------------
  238|    470|			switch (file_replace(ms, " text$", ", ")) {
  239|    430|			case 0:
  ------------------
  |  Branch (239:4): [True: 430, False: 40]
  ------------------
  240|    430|				switch (file_replace(ms, " text executable$",
  241|    430|				    ", ")) {
  242|    391|				case 0:
  ------------------
  |  Branch (242:5): [True: 391, False: 39]
  ------------------
  243|    391|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (243:10): [True: 0, False: 391]
  ------------------
  244|      0|						goto done;
  245|    391|					break;
  246|    391|				case -1:
  ------------------
  |  Branch (246:5): [True: 0, False: 430]
  ------------------
  247|      0|					goto done;
  248|     39|				default:
  ------------------
  |  Branch (248:5): [True: 39, False: 391]
  ------------------
  249|     39|					executable = 1;
  250|     39|					break;
  251|    430|				}
  252|    430|				break;
  253|    430|			case -1:
  ------------------
  |  Branch (253:4): [True: 0, False: 470]
  ------------------
  254|      0|				goto done;
  255|     40|			default:
  ------------------
  |  Branch (255:4): [True: 40, False: 430]
  ------------------
  256|     40|				break;
  257|    470|			}
  258|    470|		}
  259|       |
  260|  1.78k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (260:7): [True: 0, False: 1.78k]
  ------------------
  261|      0|			goto done;
  262|       |
  263|  1.78k|		if (subtype) {
  ------------------
  |  Branch (263:7): [True: 0, False: 1.78k]
  ------------------
  264|      0|			if (file_printf(ms, " %s", subtype) == -1)
  ------------------
  |  Branch (264:8): [True: 0, False: 0]
  ------------------
  265|      0|				goto done;
  266|      0|		}
  267|       |
  268|  1.78k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (268:7): [True: 0, False: 1.78k]
  ------------------
  269|      0|			goto done;
  270|       |
  271|  1.78k|		if (executable)
  ------------------
  |  Branch (271:7): [True: 39, False: 1.74k]
  ------------------
  272|     39|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (272:8): [True: 0, False: 39]
  ------------------
  273|      0|				goto done;
  274|       |
  275|  1.78k|		if (has_long_lines)
  ------------------
  |  Branch (275:7): [True: 131, False: 1.65k]
  ------------------
  276|    131|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (276:8): [True: 0, False: 131]
  ------------------
  277|    131|			    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|  1.78k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (284:8): [True: 1.72k, False: 59]
  |  Branch (284:23): [True: 1.55k, False: 170]
  |  Branch (284:36): [True: 1.49k, False: 55]
  |  Branch (284:50): [True: 1.38k, False: 117]
  ------------------
  285|  1.78k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (285:8): [True: 59, False: 342]
  |  Branch (285:23): [True: 170, False: 172]
  |  Branch (285:36): [True: 55, False: 117]
  ------------------
  286|  1.66k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (286:8): [True: 0, False: 1.66k]
  ------------------
  287|      0|				goto done;
  288|       |
  289|  1.66k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (289:8): [True: 1.60k, False: 59]
  |  Branch (289:23): [True: 1.43k, False: 170]
  ------------------
  290|  1.66k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (290:8): [True: 1.38k, False: 55]
  |  Branch (290:22): [True: 1.38k, False: 0]
  ------------------
  291|  1.38k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (291:9): [True: 0, False: 1.38k]
  ------------------
  292|      0|					goto done;
  293|  1.38k|			} else {
  294|    284|				if (n_crlf) {
  ------------------
  |  Branch (294:9): [True: 59, False: 225]
  ------------------
  295|     59|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (295:10): [True: 0, False: 59]
  ------------------
  296|      0|						goto done;
  297|     59|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (297:10): [True: 36, False: 23]
  |  Branch (297:18): [True: 4, False: 19]
  |  Branch (297:26): [True: 7, False: 12]
  ------------------
  298|     47|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (298:11): [True: 0, False: 47]
  ------------------
  299|      0|							goto done;
  300|     59|				}
  301|    284|				if (n_cr) {
  ------------------
  |  Branch (301:9): [True: 206, False: 78]
  ------------------
  302|    206|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (302:10): [True: 0, False: 206]
  ------------------
  303|      0|						goto done;
  304|    206|					if (n_lf || n_nel)
  ------------------
  |  Branch (304:10): [True: 56, False: 150]
  |  Branch (304:18): [True: 30, False: 120]
  ------------------
  305|     86|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (305:11): [True: 0, False: 86]
  ------------------
  306|      0|							goto done;
  307|    206|				}
  308|    284|				if (n_lf) {
  ------------------
  |  Branch (308:9): [True: 70, False: 214]
  ------------------
  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: 19, False: 51]
  ------------------
  312|     19|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (312:11): [True: 0, False: 19]
  ------------------
  313|      0|							goto done;
  314|     70|				}
  315|    284|				if (n_nel)
  ------------------
  |  Branch (315:9): [True: 101, False: 183]
  ------------------
  316|    101|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (316:10): [True: 0, False: 101]
  ------------------
  317|      0|						goto done;
  318|    284|			}
  319|       |
  320|  1.66k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (320:8): [True: 0, False: 1.66k]
  ------------------
  321|      0|				goto done;
  322|  1.66k|		}
  323|       |
  324|  1.78k|		if (has_escapes)
  ------------------
  |  Branch (324:7): [True: 21, False: 1.76k]
  ------------------
  325|     21|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (325:8): [True: 0, False: 21]
  ------------------
  326|      0|				goto done;
  327|  1.78k|		if (has_backspace)
  ------------------
  |  Branch (327:7): [True: 88, False: 1.69k]
  ------------------
  328|     88|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (328:8): [True: 0, False: 88]
  ------------------
  329|      0|				goto done;
  330|  1.78k|	}
  331|  1.78k|	rv = 1;
  332|  1.85k|done:
  333|  1.85k|	free(utf8_buf);
  334|       |
  335|  1.85k|	return rv;
  336|  1.78k|}
ascmagic.c:trim_nuls:
   63|  8.07k|{
   64|  4.65M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 4.65M, False: 41]
  |  Branch (64:23): [True: 4.64M, False: 8.03k]
  ------------------
   65|  4.64M|		nbytes--;
   66|       |
   67|  8.07k|	return nbytes;
   68|  8.07k|}
ascmagic.c:encode_utf8:
  344|  1.79k|{
  345|  1.79k|	size_t i;
  346|  1.79k|	unsigned char *end = buf + len;
  347|       |
  348|  4.88M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (348:14): [True: 4.87M, False: 1.72k]
  ------------------
  349|  4.87M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (349:7): [True: 3.63M, False: 1.24M]
  ------------------
  350|  3.63M|			if (end - buf < 1)
  ------------------
  |  Branch (350:8): [True: 0, False: 3.63M]
  ------------------
  351|      0|				return NULL;
  352|  3.63M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  426|  3.63M|#define CAST(T, b)	((T)(b))
  ------------------
  353|  3.63M|			continue;
  354|  3.63M|		} 
  355|  1.24M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (355:7): [True: 1.24M, False: 6.61k]
  ------------------
  356|  1.24M|			if (end - buf < 2)
  ------------------
  |  Branch (356:8): [True: 0, False: 1.24M]
  ------------------
  357|      0|				return NULL;
  358|  1.24M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  426|  1.24M|#define CAST(T, b)	((T)(b))
  ------------------
  359|  1.24M|			goto out1;
  360|  1.24M|		}
  361|  6.61k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (361:7): [True: 935, False: 5.68k]
  ------------------
  362|    935|			if (end - buf < 3)
  ------------------
  |  Branch (362:8): [True: 0, False: 935]
  ------------------
  363|      0|				return NULL;
  364|    935|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  426|    935|#define CAST(T, b)	((T)(b))
  ------------------
  365|    935|			goto out2;
  366|    935|		}
  367|  5.68k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (367:7): [True: 515, False: 5.16k]
  ------------------
  368|    515|			if (end - buf < 4)
  ------------------
  |  Branch (368:8): [True: 0, False: 515]
  ------------------
  369|      0|				return NULL;
  370|    515|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  426|    515|#define CAST(T, b)	((T)(b))
  ------------------
  371|    515|			goto out3;
  372|    515|		}
  373|  5.16k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (373:7): [True: 528, False: 4.64k]
  ------------------
  374|    528|			if (end - buf < 5)
  ------------------
  |  Branch (374:8): [True: 0, False: 528]
  ------------------
  375|      0|				return NULL;
  376|    528|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  426|    528|#define CAST(T, b)	((T)(b))
  ------------------
  377|    528|			goto out4;
  378|    528|		} 
  379|  4.64k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (379:7): [True: 4.57k, False: 68]
  ------------------
  380|  4.57k|			if (end - buf < 6)
  ------------------
  |  Branch (380:8): [True: 0, False: 4.57k]
  ------------------
  381|      0|				return NULL;
  382|  4.57k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  426|  4.57k|#define CAST(T, b)	((T)(b))
  ------------------
  383|  4.57k|			goto out5;
  384|  4.57k|		} 
  385|       |		/* Invalid character */
  386|     68|		return NULL;
  387|  4.57k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  426|  4.57k|#define CAST(T, b)	((T)(b))
  ------------------
  388|  5.10k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  426|  5.10k|#define CAST(T, b)	((T)(b))
  ------------------
  389|  5.61k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  426|  5.61k|#define CAST(T, b)	((T)(b))
  ------------------
  390|  6.55k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  426|  6.55k|#define CAST(T, b)	((T)(b))
  ------------------
  391|  1.24M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  426|  1.24M|#define CAST(T, b)	((T)(b))
  ------------------
  392|  1.24M|	}
  393|       |
  394|  1.72k|	return buf;
  395|  1.79k|}

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

cdf_swap_header:
  230|  1.83k|{
  231|  1.83k|	size_t i;
  232|       |
  233|  1.83k|	h->h_magic = CDF_TOLE8(h->h_magic);
  ------------------
  |  |   82|  1.83k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  1.83k|	h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
  ------------------
  |  |   82|  1.83k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  1.83k|	h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
  ------------------
  |  |   82|  1.83k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  1.83k|	h->h_revision = CDF_TOLE2(h->h_revision);
  ------------------
  |  |   86|  1.83k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  1.83k|	h->h_version = CDF_TOLE2(h->h_version);
  ------------------
  |  |   86|  1.83k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  1.83k|	h->h_byte_order = CDF_TOLE2(h->h_byte_order);
  ------------------
  |  |   86|  1.83k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  1.83k|	h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
  ------------------
  |  |   86|  1.83k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  1.83k|	h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
  ------------------
  |  |   86|  1.83k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  1.83k|	h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|  1.83k|	h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|  1.83k|	h->h_min_size_standard_stream =
  244|  1.83k|	    CDF_TOLE4(h->h_min_size_standard_stream);
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  245|  1.83k|	h->h_secid_first_sector_in_short_sat =
  246|  1.83k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_short_sat));
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|  1.83k|	h->h_num_sectors_in_short_sat =
  248|  1.83k|	    CDF_TOLE4(h->h_num_sectors_in_short_sat);
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  1.83k|	h->h_secid_first_sector_in_master_sat =
  250|  1.83k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_master_sat));
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|  1.83k|	h->h_num_sectors_in_master_sat =
  252|  1.83k|	    CDF_TOLE4(h->h_num_sectors_in_master_sat);
  ------------------
  |  |   84|  1.83k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  253|   202k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  123|   202k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (253:14): [True: 200k, False: 1.83k]
  ------------------
  254|   200k|		h->h_master_sat[i] =
  255|   200k|		    CDF_TOLE4(CAST(uint32_t, h->h_master_sat[i]));
  ------------------
  |  |   84|   200k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   400k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 200k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|   200k|	}
  257|  1.83k|}
cdf_unpack_header:
  261|  1.83k|{
  262|  1.83k|	size_t i;
  263|  1.83k|	size_t len = 0;
  264|       |
  265|  1.83k|	CDF_UNPACK(h->h_magic);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  266|  1.83k|	CDF_UNPACKA(h->h_uuid);
  ------------------
  |  |  208|  1.83k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  267|  1.83k|	CDF_UNPACK(h->h_revision);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  268|  1.83k|	CDF_UNPACK(h->h_version);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  269|  1.83k|	CDF_UNPACK(h->h_byte_order);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  270|  1.83k|	CDF_UNPACK(h->h_sec_size_p2);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  271|  1.83k|	CDF_UNPACK(h->h_short_sec_size_p2);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  272|  1.83k|	CDF_UNPACKA(h->h_unused0);
  ------------------
  |  |  208|  1.83k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  273|  1.83k|	CDF_UNPACK(h->h_num_sectors_in_sat);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  274|  1.83k|	CDF_UNPACK(h->h_secid_first_directory);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  275|  1.83k|	CDF_UNPACKA(h->h_unused1);
  ------------------
  |  |  208|  1.83k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  276|  1.83k|	CDF_UNPACK(h->h_min_size_standard_stream);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  277|  1.83k|	CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  278|  1.83k|	CDF_UNPACK(h->h_num_sectors_in_short_sat);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  279|  1.83k|	CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  280|  1.83k|	CDF_UNPACK(h->h_num_sectors_in_master_sat);
  ------------------
  |  |  206|  1.83k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  281|   202k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  123|   202k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (281:14): [True: 200k, False: 1.83k]
  ------------------
  282|   200k|		CDF_UNPACK(h->h_master_sat[i]);
  ------------------
  |  |  206|   200k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  283|  1.83k|}
cdf_swap_class:
  304|    630|{
  305|    630|	d->cl_dword = CDF_TOLE4(d->cl_dword);
  ------------------
  |  |   84|    630|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|    630|	d->cl_word[0] = CDF_TOLE2(d->cl_word[0]);
  ------------------
  |  |   86|    630|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|    630|	d->cl_word[1] = CDF_TOLE2(d->cl_word[1]);
  ------------------
  |  |   86|    630|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  308|    630|}
cdf_unpack_dir:
  312|  57.2k|{
  313|  57.2k|	size_t len = 0;
  314|       |
  315|  57.2k|	CDF_UNPACKA(d->d_name);
  ------------------
  |  |  208|  57.2k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  316|  57.2k|	CDF_UNPACK(d->d_namelen);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  317|  57.2k|	CDF_UNPACK(d->d_type);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  318|  57.2k|	CDF_UNPACK(d->d_color);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  319|  57.2k|	CDF_UNPACK(d->d_left_child);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  320|  57.2k|	CDF_UNPACK(d->d_right_child);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  321|  57.2k|	CDF_UNPACK(d->d_storage);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  322|  57.2k|	CDF_UNPACKA(d->d_storage_uuid);
  ------------------
  |  |  208|  57.2k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  323|  57.2k|	CDF_UNPACK(d->d_flags);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  324|  57.2k|	CDF_UNPACK(d->d_created);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  325|  57.2k|	CDF_UNPACK(d->d_modified);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  326|  57.2k|	CDF_UNPACK(d->d_stream_first_sector);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  327|  57.2k|	CDF_UNPACK(d->d_size);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  328|  57.2k|	CDF_UNPACK(d->d_unused0);
  ------------------
  |  |  206|  57.2k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  329|  57.2k|}
cdf_zero_stream:
  333|  3.08k|{
  334|  3.08k|	scn->sst_len = 0;
  335|  3.08k|	scn->sst_dirlen = 0;
  336|  3.08k|	scn->sst_ss = 0;
  337|  3.08k|	free(scn->sst_tab);
  338|  3.08k|	scn->sst_tab = NULL;
  339|  3.08k|	return -1;
  340|  3.08k|}
cdf_read_header:
  396|  6.22k|{
  397|  6.22k|	char buf[512];
  398|       |
  399|  6.22k|	(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
  400|  6.22k|	if (cdf_read(info, CAST(off_t, 0), buf, sizeof(buf)) == -1)
  ------------------
  |  |  426|  6.22k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (400:6): [True: 4.38k, False: 1.83k]
  ------------------
  401|  4.38k|		return -1;
  402|  1.83k|	cdf_unpack_header(h, buf);
  403|  1.83k|	cdf_swap_header(h);
  404|  1.83k|	if (h->h_magic != CDF_MAGIC) {
  ------------------
  |  |   61|  1.83k|#define CDF_MAGIC	0xE11AB1A1E011CFD0LL
  ------------------
  |  Branch (404:6): [True: 624, False: 1.21k]
  ------------------
  405|    624|		DPRINTF(("Bad magic %#" INT64_T_FORMAT "x != %#"
  406|    624|		    INT64_T_FORMAT "x\n",
  407|    624|		    (unsigned long long)h->h_magic,
  408|    624|		    (unsigned long long)CDF_MAGIC));
  409|    624|		goto out;
  410|    624|	}
  411|  1.21k|	if (h->h_sec_size_p2 > 20) {
  ------------------
  |  Branch (411:6): [True: 9, False: 1.20k]
  ------------------
  412|      9|		DPRINTF(("Bad sector size %hu\n", h->h_sec_size_p2));
  413|      9|		goto out;
  414|      9|	}
  415|  1.20k|	if (h->h_short_sec_size_p2 > 20) {
  ------------------
  |  Branch (415:6): [True: 5, False: 1.20k]
  ------------------
  416|      5|		DPRINTF(("Bad short sector size %hu\n",
  417|      5|		    h->h_short_sec_size_p2));
  418|      5|		goto out;
  419|      5|	}
  420|  1.20k|	return 0;
  421|    638|out:
  422|    638|	errno = EFTYPE;
  ------------------
  |  |   59|    638|#define EFTYPE EINVAL
  ------------------
  423|    638|	return -1;
  424|  1.20k|}
cdf_read_sector:
  430|  5.09M|{
  431|  5.09M|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  5.09M|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  432|  5.09M|	size_t pos;
  433|       |
  434|  5.09M|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|  5.09M|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (434:6): [True: 0, False: 5.09M]
  ------------------
  435|      0|		return -1;
  436|       |
  437|  5.09M|	pos = CDF_SEC_POS(h, id);
  ------------------
  |  |   81|  5.09M|#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|  5.09M|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|  5.09M|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|  5.09M|	assert(ss == len);
  439|  5.09M|	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  ------------------
              	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  427|  5.09M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  440|  5.09M|}
cdf_read_short_sector:
  445|    339|{
  446|    339|	size_t ss = CDF_SHORT_SEC_SIZE(h);
  ------------------
  |  |   82|    339|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    339|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  447|    339|	size_t pos;
  448|       |
  449|    339|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|    339|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  426|    339|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  426|    339|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (449:6): [True: 0, False: 339]
  ------------------
  450|      0|		return -1;
  451|       |
  452|    339|	pos = CDF_SHORT_SEC_POS(h, id);
  ------------------
  |  |   83|    339|#define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   82|    339|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|    339|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  453|    339|	assert(ss == len);
  454|    339|	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
  ------------------
  |  |   80|    339|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    339|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (454:6): [True: 26, False: 313]
  ------------------
  455|     26|		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
  456|     26|		    SIZE_T_FORMAT "u\n",
  457|     26|		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
  458|     26|		goto out;
  459|     26|	}
  460|    313|	(void)memcpy(RCAST(char *, buf) + offs,
  ------------------
  |  |  427|    313|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  461|    313|	    RCAST(const char *, sst->sst_tab) + pos, len);
  ------------------
  |  |  427|    313|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  462|    313|	return len;
  463|     26|out:
  464|     26|	errno = EFTYPE;
  ------------------
  |  |   59|     26|#define EFTYPE EINVAL
  ------------------
  465|     26|	return -1;
  466|    339|}
cdf_read_sat:
  473|  1.20k|{
  474|  1.20k|	size_t i, j, k;
  475|  1.20k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  1.20k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|  1.20k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  476|  1.20k|	cdf_secid_t *msa, mid, sec;
  477|  1.20k|	size_t nsatpersec = (ss / sizeof(mid)) - 1;
  478|       |
  479|  54.6k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  123|  54.6k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (479:14): [True: 54.3k, False: 318]
  ------------------
  480|  54.3k|		if (h->h_master_sat[i] == CDF_SECID_FREE)
  ------------------
  |  |   54|  54.3k|#define CDF_SECID_FREE					-1
  ------------------
  |  Branch (480:7): [True: 882, False: 53.4k]
  ------------------
  481|    882|			break;
  482|       |
  483|  1.20k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  484|  1.20k|	if ((nsatpersec > 0 &&
  ------------------
  |  Branch (484:7): [True: 1.12k, False: 75]
  ------------------
  485|  1.20k|	    h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
  ------------------
  |  |  483|  1.12k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (485:6): [True: 19, False: 1.10k]
  ------------------
  486|  1.20k|	    i > CDF_SEC_LIMIT) {
  ------------------
  |  |  483|  1.18k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (486:6): [True: 4, False: 1.17k]
  ------------------
  487|     23|		DPRINTF(("Number of sectors in master SAT too big %u %"
  488|     23|		    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));
  489|     23|		errno = EFTYPE;
  ------------------
  |  |   59|     23|#define EFTYPE EINVAL
  ------------------
  490|     23|		return -1;
  491|     23|	}
  492|       |
  493|  1.17k|	sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
  494|  1.17k|	DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
  495|  1.17k|	    sat->sat_len, ss));
  496|  1.17k|	if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
  ------------------
  |  |  426|  1.17k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (496:6): [True: 0, False: 1.17k]
  ------------------
  497|  1.17k|	    == NULL)
  498|      0|		return -1;
  499|       |
  500|  6.10k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  123|  6.10k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (500:14): [True: 6.10k, False: 1]
  ------------------
  501|  6.10k|		if (h->h_master_sat[i] < 0)
  ------------------
  |  Branch (501:7): [True: 1.14k, False: 4.95k]
  ------------------
  502|  1.14k|			break;
  503|  4.95k|		if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (503:7): [True: 31, False: 4.92k]
  ------------------
  504|  4.95k|		    h->h_master_sat[i]) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  4.95k|#define CAST(T, b)	((T)(b))
  ------------------
  505|     31|			DPRINTF(("Reading sector %d", h->h_master_sat[i]));
  506|     31|			goto out1;
  507|     31|		}
  508|  4.95k|	}
  509|       |
  510|  1.14k|	if ((msa = CAST(cdf_secid_t *, CDF_CALLOC(1, ss))) == NULL)
  ------------------
  |  |  426|  1.14k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (510:6): [True: 0, False: 1.14k]
  ------------------
  511|      0|		goto out1;
  512|       |
  513|  1.14k|	mid = h->h_secid_first_sector_in_master_sat;
  514|   179k|	for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
  ------------------
  |  Branch (514:14): [True: 179k, False: 585]
  ------------------
  515|   179k|		if (mid < 0)
  ------------------
  |  Branch (515:7): [True: 400, False: 178k]
  ------------------
  516|    400|			goto out;
  517|   178k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   178k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (517:7): [True: 2, False: 178k]
  ------------------
  518|      2|			DPRINTF(("Reading master sector loop limit"));
  519|      2|			goto out3;
  520|      2|		}
  521|   178k|		if (cdf_read_sector(info, msa, 0, ss, h, mid) !=
  ------------------
  |  Branch (521:7): [True: 44, False: 178k]
  ------------------
  522|   178k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  426|   178k|#define CAST(T, b)	((T)(b))
  ------------------
  523|     44|			DPRINTF(("Reading master sector %d", mid));
  524|     44|			goto out2;
  525|     44|		}
  526|  5.08M|		for (k = 0; k < nsatpersec; k++, i++) {
  ------------------
  |  Branch (526:15): [True: 4.90M, False: 178k]
  ------------------
  527|  4.90M|			sec = CDF_TOLE4(CAST(uint32_t, msa[k]));
  ------------------
  |  |   84|  4.90M|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  9.80M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 4.90M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  528|  4.90M|			if (sec < 0)
  ------------------
  |  Branch (528:8): [True: 86, False: 4.90M]
  ------------------
  529|     86|				goto out;
  530|  4.90M|			if (i >= sat->sat_len) {
  ------------------
  |  Branch (530:8): [True: 0, False: 4.90M]
  ------------------
  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|  4.90M|			if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (536:8): [True: 29, False: 4.90M]
  ------------------
  537|  4.90M|			    sec) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  4.90M|#define CAST(T, b)	((T)(b))
  ------------------
  538|     29|				DPRINTF(("Reading sector %d",
  539|     29|				    CDF_TOLE4(msa[k])));
  540|     29|				goto out2;
  541|     29|			}
  542|  4.90M|		}
  543|   178k|		mid = CDF_TOLE4(CAST(uint32_t, msa[nsatpersec]));
  ------------------
  |  |   84|   178k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   357k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 178k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  544|   178k|	}
  545|  1.07k|out:
  546|  1.07k|	sat->sat_len = i;
  547|  1.07k|	free(msa);
  548|  1.07k|	return 0;
  549|      2|out3:
  550|      2|	errno = EFTYPE;
  ------------------
  |  |   59|      2|#define EFTYPE EINVAL
  ------------------
  551|     75|out2:
  552|     75|	free(msa);
  553|    106|out1:
  554|    106|	free(sat->sat_tab);
  555|    106|	return -1;
  556|     75|}
cdf_count_chain:
  560|  3.09k|{
  561|  3.09k|	size_t i, j;
  562|  3.09k|	cdf_secid_t maxsector = CAST(cdf_secid_t, (sat->sat_len * size)
  ------------------
  |  |  426|  3.09k|#define CAST(T, b)	((T)(b))
  ------------------
  563|  3.09k|	    / sizeof(maxsector));
  564|       |
  565|  3.09k|	DPRINTF(("Chain:"));
  566|  3.09k|	if (sid == CDF_SECID_END_OF_CHAIN) {
  ------------------
  |  |   55|  3.09k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (566:6): [True: 79, False: 3.01k]
  ------------------
  567|       |		/* 0-length chain. */
  568|     79|		DPRINTF((" empty\n"));
  569|     79|		return 0;
  570|     79|	}
  571|       |
  572|   142k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (572:18): [True: 139k, False: 2.79k]
  ------------------
  573|   139k|		DPRINTF((" %d", sid));
  574|   139k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   139k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (574:7): [True: 13, False: 139k]
  ------------------
  575|     13|			DPRINTF(("Counting chain loop limit"));
  576|     13|			goto out;
  577|     13|		}
  578|   139k|		if (sid >= maxsector) {
  ------------------
  |  Branch (578:7): [True: 211, False: 139k]
  ------------------
  579|    211|			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
  580|    211|			goto out;
  581|    211|		}
  582|   139k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|   139k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   278k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 139k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  583|   139k|	}
  584|  2.79k|	if (i == 0) {
  ------------------
  |  Branch (584:6): [True: 107, False: 2.68k]
  ------------------
  585|    107|		DPRINTF((" none, sid: %d\n", sid));
  586|    107|		goto out;
  587|       |
  588|    107|	}
  589|  2.68k|	DPRINTF(("\n"));
  590|  2.68k|	return i;
  591|    331|out:
  592|    331|	errno = EFTYPE;
  ------------------
  |  |   59|    331|#define EFTYPE EINVAL
  ------------------
  593|    331|	return CAST(size_t, -1);
  ------------------
  |  |  426|    331|#define CAST(T, b)	((T)(b))
  ------------------
  594|  2.79k|}
cdf_read_long_sector_chain:
  599|    931|{
  600|    931|	size_t ss = CDF_SEC_SIZE(h), i, j;
  ------------------
  |  |   80|    931|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    931|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  601|    931|	ssize_t nr;
  602|    931|	scn->sst_tab = NULL;
  603|    931|	scn->sst_len = cdf_count_chain(sat, sid, ss);
  604|    931|	scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
  605|    931|	scn->sst_ss = ss;
  606|       |
  607|    931|	if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
  ------------------
  |  |   55|  1.86k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (607:6): [True: 6, False: 925]
  |  Branch (607:39): [True: 16, False: 909]
  ------------------
  608|     22|		return cdf_zero_stream(scn);
  609|       |
  610|    909|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  426|    909|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (610:6): [True: 86, False: 823]
  ------------------
  611|     86|		goto out;
  612|       |
  613|    823|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|    823|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  614|    823|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (614:6): [True: 0, False: 823]
  ------------------
  615|      0|		return cdf_zero_stream(scn);
  616|       |
  617|  3.82k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (617:18): [True: 3.04k, False: 783]
  ------------------
  618|  3.04k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  3.04k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (618:7): [True: 0, False: 3.04k]
  ------------------
  619|      0|			DPRINTF(("Read long sector chain loop limit"));
  620|      0|			goto out;
  621|      0|		}
  622|  3.04k|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (622:7): [True: 0, False: 3.04k]
  ------------------
  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|  3.04k|		if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (628:7): [True: 40, False: 3.00k]
  ------------------
  629|  3.04k|		    sid)) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  3.04k|#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|  3.00k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  3.00k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  6.00k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 3.00k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  638|  3.00k|	}
  639|    783|	return 0;
  640|    126|out:
  641|    126|	errno = EFTYPE;
  ------------------
  |  |   59|    126|#define EFTYPE EINVAL
  ------------------
  642|    126|	return cdf_zero_stream(scn);
  643|    823|}
cdf_read_short_sector_chain:
  649|    157|{
  650|    157|	size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
  ------------------
  |  |   82|    157|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  651|    157|	scn->sst_tab = NULL;
  652|    157|	scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
  ------------------
  |  |   80|    157|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  653|    157|	scn->sst_dirlen = len;
  654|    157|	scn->sst_ss = ss;
  655|       |
  656|    157|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  426|    157|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (656:6): [True: 72, False: 85]
  ------------------
  657|     72|		goto out;
  658|       |
  659|     85|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|     85|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  660|     85|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (660:6): [True: 0, False: 85]
  ------------------
  661|      0|		return cdf_zero_stream(scn);
  662|       |
  663|    398|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (663:18): [True: 339, False: 59]
  ------------------
  664|    339|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    339|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (664:7): [True: 0, False: 339]
  ------------------
  665|      0|			DPRINTF(("Read short sector chain loop limit"));
  666|      0|			goto out;
  667|      0|		}
  668|    339|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (668:7): [True: 0, False: 339]
  ------------------
  669|      0|			DPRINTF(("Out of bounds reading short sector chain "
  670|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n",
  671|      0|			    i, scn->sst_len));
  672|      0|			goto out;
  673|      0|		}
  674|    339|		if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (674:7): [True: 26, False: 313]
  ------------------
  675|    339|		    sid) != CAST(ssize_t, ss)) {
  ------------------
  |  |  426|    339|#define CAST(T, b)	((T)(b))
  ------------------
  676|     26|			DPRINTF(("Reading short sector chain %d", sid));
  677|     26|			goto out;
  678|     26|		}
  679|    313|		sid = CDF_TOLE4(CAST(uint32_t, ssat->sat_tab[sid]));
  ------------------
  |  |   84|    313|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|    626|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 313]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  680|    313|	}
  681|     59|	return 0;
  682|     98|out:
  683|     98|	errno = EFTYPE;
  ------------------
  |  |   59|     98|#define EFTYPE EINVAL
  ------------------
  684|     98|	return cdf_zero_stream(scn);
  685|     85|}
cdf_read_sector_chain:
  691|    879|{
  692|       |
  693|    879|	if (len < h->h_min_size_standard_stream && sst->sst_tab != NULL)
  ------------------
  |  Branch (693:6): [True: 360, False: 519]
  |  Branch (693:45): [True: 157, False: 203]
  ------------------
  694|    157|		return cdf_read_short_sector_chain(h, ssat, sst, sid, len,
  695|    157|		    scn);
  696|    722|	else
  697|    722|		return cdf_read_long_sector_chain(info, h, sat, sid, len, scn);
  698|    879|}
cdf_read_dir:
  703|    935|{
  704|    935|	size_t i, j;
  705|    935|	size_t ss = CDF_SEC_SIZE(h), ns, nd;
  ------------------
  |  |   80|    935|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    935|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  706|    935|	char *buf;
  707|    935|	cdf_secid_t sid = h->h_secid_first_directory;
  708|       |
  709|    935|	ns = cdf_count_chain(sat, sid, ss);
  710|    935|	if (ns == CAST(size_t, -1))
  ------------------
  |  |  426|    935|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (710:6): [True: 51, False: 884]
  ------------------
  711|     51|		return -1;
  712|       |
  713|    884|	nd = ss / CDF_DIRECTORY_SIZE;
  ------------------
  |  |  117|    884|#define CDF_DIRECTORY_SIZE	128
  ------------------
  714|       |
  715|    884|	dir->dir_len = ns * nd;
  716|    884|	dir->dir_tab = CAST(cdf_directory_t *,
  ------------------
  |  |  426|    884|#define CAST(T, b)	((T)(b))
  ------------------
  717|    884|	    CDF_CALLOC(dir->dir_len, sizeof(dir->dir_tab[0])));
  718|    884|	if (dir->dir_tab == NULL)
  ------------------
  |  Branch (718:6): [True: 0, False: 884]
  ------------------
  719|      0|		return -1;
  720|       |
  721|    884|	if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
  ------------------
  |  |  426|    884|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (721:6): [True: 0, False: 884]
  ------------------
  722|      0|		free(dir->dir_tab);
  723|      0|		return -1;
  724|      0|	}
  725|       |
  726|  4.28k|	for (j = i = 0; i < ns; i++, j++) {
  ------------------
  |  Branch (726:18): [True: 3.42k, False: 862]
  ------------------
  727|  3.42k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  3.42k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (727:7): [True: 0, False: 3.42k]
  ------------------
  728|      0|			DPRINTF(("Read dir loop limit"));
  729|      0|			goto out;
  730|      0|		}
  731|  3.42k|		if (cdf_read_sector(info, buf, 0, ss, h, sid) !=
  ------------------
  |  Branch (731:7): [True: 22, False: 3.40k]
  ------------------
  732|  3.42k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  3.42k|#define CAST(T, b)	((T)(b))
  ------------------
  733|     22|			DPRINTF(("Reading directory sector %d", sid));
  734|     22|			goto out;
  735|     22|		}
  736|  60.6k|		for (j = 0; j < nd; j++) {
  ------------------
  |  Branch (736:15): [True: 57.2k, False: 3.40k]
  ------------------
  737|  57.2k|			cdf_unpack_dir(&dir->dir_tab[i * nd + j],
  738|  57.2k|			    &buf[j * CDF_DIRECTORY_SIZE]);
  ------------------
  |  |  117|  57.2k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  739|  57.2k|		}
  740|  3.40k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  3.40k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  6.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 3.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  741|  3.40k|	}
  742|    862|	if (NEED_SWAP)
  ------------------
  |  |   79|    862|#define NEED_SWAP	(cdf_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  426|    862|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (79:19): [True: 0, False: 862]
  |  |  ------------------
  ------------------
  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|    862|	free(buf);
  746|    862|	return 0;
  747|     22|out:
  748|     22|	free(dir->dir_tab);
  749|     22|	free(buf);
  750|     22|	errno = EFTYPE;
  ------------------
  |  |   59|     22|#define EFTYPE EINVAL
  ------------------
  751|     22|	return -1;
  752|    884|}
cdf_read_ssat:
  758|  1.07k|{
  759|  1.07k|	size_t i, j;
  760|  1.07k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  1.07k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|  1.07k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  761|  1.07k|	cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
  762|       |
  763|  1.07k|	ssat->sat_tab = NULL;
  764|  1.07k|	ssat->sat_len = cdf_count_chain(sat, sid, ss);
  765|  1.07k|	if (ssat->sat_len == CAST(size_t, -1))
  ------------------
  |  |  426|  1.07k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (765:6): [True: 115, False: 956]
  ------------------
  766|    115|		goto out;
  767|       |
  768|    956|	ssat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(ssat->sat_len, ss));
  ------------------
  |  |  426|    956|#define CAST(T, b)	((T)(b))
  ------------------
  769|    956|	if (ssat->sat_tab == NULL)
  ------------------
  |  Branch (769:6): [True: 0, False: 956]
  ------------------
  770|      0|		goto out1;
  771|       |
  772|  2.72k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (772:18): [True: 1.78k, False: 935]
  ------------------
  773|  1.78k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.78k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (773:7): [True: 0, False: 1.78k]
  ------------------
  774|      0|			DPRINTF(("Read short sat sector loop limit"));
  775|      0|			goto out;
  776|      0|		}
  777|  1.78k|		if (i >= ssat->sat_len) {
  ------------------
  |  Branch (777:7): [True: 0, False: 1.78k]
  ------------------
  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|  1.78k|		if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
  ------------------
  |  Branch (783:7): [True: 21, False: 1.76k]
  ------------------
  784|  1.78k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  426|  1.78k|#define CAST(T, b)	((T)(b))
  ------------------
  785|     21|			DPRINTF(("Reading short sat sector %d", sid));
  786|     21|			goto out1;
  787|     21|		}
  788|  1.76k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.76k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  3.53k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 1.76k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  789|  1.76k|	}
  790|    935|	return 0;
  791|    115|out:
  792|    115|	errno = EFTYPE;
  ------------------
  |  |   59|    115|#define EFTYPE EINVAL
  ------------------
  793|    136|out1:
  794|    136|	free(ssat->sat_tab);
  795|    136|	return -1;
  796|    115|}
cdf_read_short_stream:
  802|    862|{
  803|    862|	size_t i;
  804|    862|	const cdf_directory_t *d;
  805|       |
  806|    862|	*root = NULL;
  807|  11.9k|	for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (807:14): [True: 11.5k, False: 473]
  ------------------
  808|  11.5k|		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
  ------------------
  |  |  101|  11.5k|#define CDF_DIR_TYPE_ROOT_STORAGE	5
  ------------------
  |  Branch (808:7): [True: 389, False: 11.1k]
  ------------------
  809|    389|			break;
  810|       |
  811|       |	/* If the it is not there, just fake it; some docs don't have it */
  812|    862|	if (i == dir->dir_len) {
  ------------------
  |  Branch (812:6): [True: 473, False: 389]
  ------------------
  813|    473|		DPRINTF(("Cannot find root storage dir\n"));
  814|    473|		goto out;
  815|    473|	}
  816|    389|	d = &dir->dir_tab[i];
  817|    389|	*root = d;
  818|       |
  819|       |	/* If the it is not there, just fake it; some docs don't have it */
  820|    389|	if (d->d_stream_first_sector < 0) {
  ------------------
  |  Branch (820:6): [True: 180, False: 209]
  ------------------
  821|    180|		DPRINTF(("No first secror in dir\n"));
  822|    180|		goto out;
  823|    180|	}
  824|       |
  825|    209|	return cdf_read_long_sector_chain(info, h, sat,
  826|    209|	    d->d_stream_first_sector, d->d_size, scn);
  827|    653|out:
  828|    653|	scn->sst_tab = NULL;
  829|    653|	(void)cdf_zero_stream(scn);
  830|    653|	return 0;
  831|    389|}
cdf_read_doc_summary_info:
  846|    764|{
  847|    764|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  848|    764|	    "\05DocumentSummaryInformation", scn);
  849|    764|}
cdf_read_summary_info:
  855|    808|{
  856|    808|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  857|    808|	    "\05SummaryInformation", scn);
  858|    808|}
cdf_read_user_stream:
  864|  2.38k|{
  865|  2.38k|	const cdf_directory_t *d;
  866|  2.38k|	int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
  ------------------
  |  |   98|  2.38k|#define CDF_DIR_TYPE_USER_STREAM	2
  ------------------
  867|       |
  868|  2.38k|	if (i <= 0) {
  ------------------
  |  Branch (868:6): [True: 1.50k, False: 879]
  ------------------
  869|  1.50k|		memset(scn, 0, sizeof(*scn));
  870|  1.50k|		return -1;
  871|  1.50k|	}
  872|       |
  873|    879|	d = &dir->dir_tab[i - 1];
  874|    879|	return cdf_read_sector_chain(info, h, sat, ssat, sst,
  875|    879|	    d->d_stream_first_sector, d->d_size, scn);
  876|  2.38k|}
cdf_find_stream:
  880|  9.21k|{
  881|  9.21k|	size_t i, name_len = strlen(name) + 1;
  882|       |
  883|   462k|	for (i = dir->dir_len; i > 0; i--)
  ------------------
  |  Branch (883:25): [True: 454k, False: 8.31k]
  ------------------
  884|   454k|		if (dir->dir_tab[i - 1].d_type == type &&
  ------------------
  |  Branch (884:7): [True: 14.8k, False: 439k]
  ------------------
  885|   454k|		    cdf_namecmp(name, dir->dir_tab[i - 1].d_name, name_len)
  ------------------
  |  Branch (885:7): [True: 892, False: 13.9k]
  ------------------
  886|  14.8k|		    == 0)
  887|    892|			break;
  888|  9.21k|	if (i > 0)
  ------------------
  |  Branch (888:6): [True: 892, False: 8.31k]
  ------------------
  889|    892|		return CAST(int, i);
  ------------------
  |  |  426|    892|#define CAST(T, b)	((T)(b))
  ------------------
  890|       |
  891|  8.31k|	DPRINTF(("Cannot find type %d `%s'\n", type, name));
  892|  8.31k|	errno = ESRCH;
  893|  8.31k|	return 0;
  894|  9.21k|}
cdf_read_property_info:
  993|    630|{
  994|    630|	const cdf_section_header_t *shp;
  995|    630|	cdf_section_header_t sh;
  996|    630|	const uint8_t *p, *q, *e;
  997|    630|	size_t i, o4, nelements, j, slen, left;
  998|    630|	cdf_property_info_t *inp;
  999|       |
 1000|    630|	if (offs > UINT32_MAX / 4) {
  ------------------
  |  Branch (1000:6): [True: 29, False: 601]
  ------------------
 1001|     29|		errno = EFTYPE;
  ------------------
  |  |   59|     29|#define EFTYPE EINVAL
  ------------------
 1002|     29|		goto out;
 1003|     29|	}
 1004|    601|	shp = CAST(const cdf_section_header_t *,
  ------------------
  |  |  426|    601|#define CAST(T, b)	((T)(b))
  ------------------
 1005|    601|	    cdf_offset(sst->sst_tab, offs));
 1006|    601|	if (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)
  ------------------
  |  Branch (1006:6): [True: 52, False: 549]
  ------------------
 1007|     52|		goto out;
 1008|    549|	sh.sh_len = CDF_TOLE4(shp->sh_len);
  ------------------
  |  |   84|    549|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.09k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 549]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1009|    549|	if (sh.sh_len > CDF_SHLEN_LIMIT) {
  ------------------
  |  |  896|    549|#define CDF_SHLEN_LIMIT (UINT32_MAX / 64)
  ------------------
  |  Branch (1009:6): [True: 19, False: 530]
  ------------------
 1010|     19|		errno = EFTYPE;
  ------------------
  |  |   59|     19|#define EFTYPE EINVAL
  ------------------
 1011|     19|		goto out;
 1012|     19|	}
 1013|       |
 1014|    530|	if (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)
  ------------------
  |  Branch (1014:6): [True: 35, False: 495]
  ------------------
 1015|     35|		goto out;
 1016|       |
 1017|    495|	sh.sh_properties = CDF_TOLE4(shp->sh_properties);
  ------------------
  |  |   84|    495|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|    990|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 495]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1018|    495|	DPRINTF(("section len: %u properties %u\n", sh.sh_len,
 1019|    495|	    sh.sh_properties));
 1020|    495|	if (sh.sh_properties > CDF_PROP_LIMIT)
  ------------------
  |  |  897|    495|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (1020:6): [True: 15, False: 480]
  ------------------
 1021|     15|		goto out;
 1022|    480|	inp = cdf_grow_info(info, maxcount, sh.sh_properties);
 1023|    480|	if (inp == NULL)
  ------------------
  |  Branch (1023:6): [True: 0, False: 480]
  ------------------
 1024|      0|		goto out;
 1025|    480|	inp += *count;
 1026|    480|	*count += sh.sh_properties;
 1027|    480|	p = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));
  ------------------
  |  |  426|    480|#define CAST(T, b)	((T)(b))
  ------------------
 1028|    480|	e = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));
  ------------------
  |  |  426|    480|#define CAST(T, b)	((T)(b))
  ------------------
 1029|    480|	if (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
  ------------------
  |  Branch (1029:6): [True: 3, False: 477]
  |  Branch (1029:16): [True: 0, False: 477]
  ------------------
 1030|      3|		goto out;
 1031|       |
 1032|  3.31k|	for (i = 0; i < sh.sh_properties; i++) {
  ------------------
  |  Branch (1032:14): [True: 3.07k, False: 241]
  ------------------
 1033|  3.07k|		if ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)
  ------------------
  |  Branch (1033:7): [True: 167, False: 2.90k]
  ------------------
 1034|    167|			goto out;
 1035|  2.90k|		inp[i].pi_id = CDF_GETUINT32(p, i << 1);
  ------------------
  |  |   92|  2.90k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1036|  2.90k|		left = CAST(size_t, e - q);
  ------------------
  |  |  426|  2.90k|#define CAST(T, b)	((T)(b))
  ------------------
 1037|  2.90k|		if (left < sizeof(uint32_t)) {
  ------------------
  |  Branch (1037:7): [True: 3, False: 2.90k]
  ------------------
 1038|      3|			DPRINTF(("short info (no type)_\n"));
 1039|      3|			goto out;
 1040|      3|		}
 1041|  2.90k|		inp[i].pi_type = CDF_GETUINT32(q, 0);
  ------------------
  |  |   92|  2.90k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1042|  2.90k|		DPRINTF(("%" SIZE_T_FORMAT "u) id=%#x type=%#x offs=%#tx,%#x\n",
 1043|  2.90k|		    i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
 1044|  2.90k|		if (inp[i].pi_type & CDF_VECTOR) {
  ------------------
  |  |  237|  2.90k|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1044:7): [True: 583, False: 2.31k]
  ------------------
 1045|    583|			if (left < sizeof(uint32_t) * 2) {
  ------------------
  |  Branch (1045:8): [True: 6, False: 577]
  ------------------
 1046|      6|				DPRINTF(("missing CDF_VECTOR length\n"));
 1047|      6|				goto out;
 1048|      6|			}
 1049|    577|			nelements = CDF_GETUINT32(q, 1);
  ------------------
  |  |   92|    577|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1050|    577|			if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
  ------------------
  |  |   51|  1.15k|#define CDF_ELEMENT_LIMIT				100000
  ------------------
  |  Branch (1050:8): [True: 30, False: 547]
  |  Branch (1050:41): [True: 4, False: 543]
  ------------------
 1051|     34|				DPRINTF(("CDF_VECTOR with nelements == %"
 1052|     34|				    SIZE_T_FORMAT "u\n", nelements));
 1053|     34|				goto out;
 1054|     34|			}
 1055|    543|			slen = 2;
 1056|  2.31k|		} else {
 1057|  2.31k|			nelements = 1;
 1058|  2.31k|			slen = 1;
 1059|  2.31k|		}
 1060|  2.86k|		o4 = slen * sizeof(uint32_t);
 1061|  2.86k|		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  238|  2.86k|#define CDF_ARRAY		0x00002000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  239|  2.86k|#define CDF_BYREF		0x00004000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  240|  2.86k|#define CDF_RESERVED		0x00008000
  ------------------
  |  Branch (1061:7): [True: 452, False: 2.41k]
  ------------------
 1062|    452|			goto unknown;
 1063|  2.41k|		switch (inp[i].pi_type & CDF_TYPEMASK) {
  ------------------
  |  |  243|  2.41k|#define CDF_TYPEMASK		0x00000fff
  ------------------
 1064|     39|		case CDF_NULL:
  ------------------
  |  |  198|     39|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (1064:3): [True: 39, False: 2.37k]
  ------------------
 1065|    303|		case CDF_EMPTY:
  ------------------
  |  |  197|    303|#define CDF_EMPTY		0x00000000
  ------------------
  |  Branch (1065:3): [True: 264, False: 2.14k]
  ------------------
 1066|    303|			break;
 1067|    208|		case CDF_SIGNED16:
  ------------------
  |  |  199|    208|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (1067:3): [True: 208, False: 2.20k]
  ------------------
 1068|    208|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))
  ------------------
  |  Branch (1068:8): [True: 99, False: 109]
  ------------------
 1069|     99|				goto unknown;
 1070|    109|			break;
 1071|    137|		case CDF_SIGNED32:
  ------------------
  |  |  200|    137|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (1071:3): [True: 137, False: 2.27k]
  ------------------
 1072|    214|		case CDF_BOOL:
  ------------------
  |  |  208|    214|#define CDF_BOOL		0x0000000b
  ------------------
  |  Branch (1072:3): [True: 77, False: 2.33k]
  ------------------
 1073|    331|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|    331|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (1073:3): [True: 117, False: 2.29k]
  ------------------
 1074|    525|		case CDF_FLOAT:
  ------------------
  |  |  201|    525|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (1074:3): [True: 194, False: 2.21k]
  ------------------
 1075|    525|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))
  ------------------
  |  Branch (1075:8): [True: 171, False: 354]
  ------------------
 1076|    171|				goto unknown;
 1077|    354|			break;
 1078|    354|		case CDF_SIGNED64:
  ------------------
  |  |  216|     77|#define CDF_SIGNED64		0x00000014
  ------------------
  |  Branch (1078:3): [True: 77, False: 2.33k]
  ------------------
 1079|    115|		case CDF_UNSIGNED64:
  ------------------
  |  |  217|    115|#define CDF_UNSIGNED64		0x00000015
  ------------------
  |  Branch (1079:3): [True: 38, False: 2.37k]
  ------------------
 1080|    231|		case CDF_DOUBLE:
  ------------------
  |  |  202|    231|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (1080:3): [True: 116, False: 2.29k]
  ------------------
 1081|    650|		case CDF_FILETIME:
  ------------------
  |  |  228|    650|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (1081:3): [True: 419, False: 1.99k]
  ------------------
 1082|    650|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))
  ------------------
  |  Branch (1082:8): [True: 60, False: 590]
  ------------------
 1083|     60|				goto unknown;
 1084|    590|			break;
 1085|    590|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|    142|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (1085:3): [True: 142, False: 2.26k]
  ------------------
 1086|    262|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    262|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (1086:3): [True: 120, False: 2.29k]
  ------------------
 1087|    262|			if (nelements > 1) {
  ------------------
  |  Branch (1087:8): [True: 67, False: 195]
  ------------------
 1088|     67|				size_t nelem = inp - *info;
 1089|     67|				inp = cdf_grow_info(info, maxcount, nelements);
 1090|     67|				if (inp == NULL)
  ------------------
  |  Branch (1090:9): [True: 4, False: 63]
  ------------------
 1091|      4|					goto out;
 1092|     63|				inp += nelem;
 1093|     63|			}
 1094|   197k|			for (j = 0; j < nelements && i < sh.sh_properties;
  ------------------
  |  Branch (1094:16): [True: 196k, False: 235]
  |  Branch (1094:33): [True: 196k, False: 1]
  ------------------
 1095|   196k|			    j++, i++)
 1096|   196k|			{
 1097|   196k|				uint32_t l;
 1098|       |
 1099|   196k|				if (o4 + sizeof(uint32_t) > left)
  ------------------
  |  Branch (1099:9): [True: 7, False: 196k]
  ------------------
 1100|      7|					goto out;
 1101|       |
 1102|   196k|				l = CDF_GETUINT32(q, slen);
  ------------------
  |  |   92|   196k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1103|   196k|				o4 += sizeof(uint32_t);
 1104|   196k|				if (o4 + l > left)
  ------------------
  |  Branch (1104:9): [True: 15, False: 196k]
  ------------------
 1105|     15|					goto out;
 1106|       |
 1107|   196k|				inp[i].pi_str.s_len = l;
  ------------------
  |  |  191|   196k|#define pi_str	pi_val._pi_str
  ------------------
 1108|   196k|				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  191|   196k|#define pi_str	pi_val._pi_str
  ------------------
              				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  426|   196k|#define CAST(T, b)	((T)(b))
  ------------------
 1109|   196k|				    CAST(const void *, &q[o4]));
 1110|       |
 1111|   196k|				DPRINTF(("o=%" SIZE_T_FORMAT "u l=%d(%"
 1112|   196k|				    SIZE_T_FORMAT "u), t=%" SIZE_T_FORMAT
 1113|   196k|				    "u s=%.*s\n", o4, l,
 1114|   196k|				    CDF_ROUND(l, sizeof(l)),
 1115|   196k|				    left, (int)l, inp[i].pi_str.s_buf));
 1116|       |
 1117|   196k|				if (l & 1)
  ------------------
  |  Branch (1117:9): [True: 93, False: 196k]
  ------------------
 1118|     93|					l++;
 1119|       |
 1120|   196k|				slen += l >> 1;
 1121|   196k|				o4 = slen * sizeof(uint32_t);
 1122|   196k|			}
 1123|    236|			i--;
 1124|    236|			break;
 1125|    104|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|    104|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (1125:3): [True: 104, False: 2.30k]
  ------------------
 1126|    104|			if (inp[i].pi_type & CDF_VECTOR)
  ------------------
  |  |  237|    104|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1126:8): [True: 26, False: 78]
  ------------------
 1127|     26|				goto unknown;
 1128|     78|			break;
 1129|    358|		default:
  ------------------
  |  Branch (1129:3): [True: 358, False: 2.05k]
  ------------------
 1130|  1.16k|		unknown:
 1131|  1.16k|			memset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));
 1132|  1.16k|			DPRINTF(("Don't know how to deal with %#x\n",
 1133|  1.16k|			    inp[i].pi_type));
 1134|  1.16k|			break;
 1135|  2.41k|		}
 1136|  2.41k|	}
 1137|    241|	return 0;
 1138|    389|out:
 1139|    389|	free(*info);
 1140|    389|	*info = NULL;
 1141|    389|	*count = 0;
 1142|    389|	*maxcount = 0;
 1143|    389|	errno = EFTYPE;
  ------------------
  |  |   59|    389|#define EFTYPE EINVAL
  ------------------
 1144|    389|	return -1;
 1145|    477|}
cdf_unpack_summary_info:
 1150|    642|{
 1151|    642|	size_t maxcount;
 1152|    642|	const cdf_summary_info_header_t *si =
 1153|    642|	    CAST(const cdf_summary_info_header_t *, sst->sst_tab);
  ------------------
  |  |  426|    642|#define CAST(T, b)	((T)(b))
  ------------------
 1154|    642|	const cdf_section_declaration_t *sd =
 1155|    642|	    CAST(const cdf_section_declaration_t *, RCAST(const void *,
  ------------------
  |  |  426|    642|#define CAST(T, b)	((T)(b))
  ------------------
 1156|    642|	    RCAST(const char *, sst->sst_tab)
 1157|    642|	    + CDF_SECTION_DECLARATION_OFFSET));
 1158|       |
 1159|    642|	if (cdf_check_stream_offset(sst, h, si, sizeof(*si), __LINE__) == -1 ||
  ------------------
  |  Branch (1159:6): [True: 9, False: 633]
  ------------------
 1160|    642|	    cdf_check_stream_offset(sst, h, sd, sizeof(*sd), __LINE__) == -1)
  ------------------
  |  Branch (1160:6): [True: 3, False: 630]
  ------------------
 1161|     12|		return -1;
 1162|    630|	ssi->si_byte_order = CDF_TOLE2(si->si_byte_order);
  ------------------
  |  |   86|    630|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1163|    630|	ssi->si_os_version = CDF_TOLE2(si->si_os_version);
  ------------------
  |  |   86|    630|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1164|    630|	ssi->si_os = CDF_TOLE2(si->si_os);
  ------------------
  |  |   86|    630|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1165|    630|	ssi->si_class = si->si_class;
 1166|    630|	cdf_swap_class(&ssi->si_class);
 1167|    630|	ssi->si_count = CDF_TOLE4(si->si_count);
  ------------------
  |  |   84|    630|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1168|    630|	*count = 0;
 1169|    630|	maxcount = 0;
 1170|    630|	*info = NULL;
 1171|    630|	if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
  ------------------
  |  |   84|    630|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 630]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1171:6): [True: 389, False: 241]
  ------------------
 1172|    630|	    count, &maxcount) == -1)
 1173|    389|		return -1;
 1174|    241|	return 0;
 1175|    630|}
cdf_print_property_name:
 1292|    979|{
 1293|    979|	size_t i;
 1294|       |
 1295|  17.5k|	for (i = 0; i < __arraycount(vn); i++)
  ------------------
  |  |  123|  17.5k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1295:14): [True: 16.8k, False: 716]
  ------------------
 1296|  16.8k|		if (vn[i].v == p)
  ------------------
  |  Branch (1296:7): [True: 263, False: 16.5k]
  ------------------
 1297|    263|			return snprintf(buf, bufsiz, "%s", vn[i].n);
 1298|    716|	return snprintf(buf, bufsiz, "%#x", p);
 1299|    979|}
cdf_print_elapsed_time:
 1303|    161|{
 1304|    161|	int len = 0;
 1305|    161|	int days, hours, mins, secs;
 1306|       |
 1307|    161|	ts /= CDF_TIME_PREC;
  ------------------
  |  |   90|    161|#define CDF_TIME_PREC	10000000
  ------------------
 1308|    161|	secs = CAST(int, ts % 60);
  ------------------
  |  |  426|    161|#define CAST(T, b)	((T)(b))
  ------------------
 1309|    161|	ts /= 60;
 1310|    161|	mins = CAST(int, ts % 60);
  ------------------
  |  |  426|    161|#define CAST(T, b)	((T)(b))
  ------------------
 1311|    161|	ts /= 60;
 1312|    161|	hours = CAST(int, ts % 24);
  ------------------
  |  |  426|    161|#define CAST(T, b)	((T)(b))
  ------------------
 1313|    161|	ts /= 24;
 1314|    161|	days = CAST(int, ts);
  ------------------
  |  |  426|    161|#define CAST(T, b)	((T)(b))
  ------------------
 1315|       |
 1316|    161|	if (days) {
  ------------------
  |  Branch (1316:6): [True: 102, False: 59]
  ------------------
 1317|    102|		len += snprintf(buf + len, bufsiz - len, "%dd+", days);
 1318|    102|		if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  426|    102|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1318:7): [True: 0, False: 102]
  ------------------
 1319|      0|			return len;
 1320|    102|	}
 1321|       |
 1322|    161|	if (days || hours) {
  ------------------
  |  Branch (1322:6): [True: 102, False: 59]
  |  Branch (1322:14): [True: 11, False: 48]
  ------------------
 1323|    113|		len += snprintf(buf + len, bufsiz - len, "%.2d:", hours);
 1324|    113|		if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  426|    113|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1324:7): [True: 0, False: 113]
  ------------------
 1325|      0|			return len;
 1326|    113|	}
 1327|       |
 1328|    161|	len += snprintf(buf + len, bufsiz - len, "%.2d:", mins);
 1329|    161|	if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  426|    161|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1329:6): [True: 0, False: 161]
  ------------------
 1330|      0|		return len;
 1331|       |
 1332|    161|	len += snprintf(buf + len, bufsiz - len, "%.2d", secs);
 1333|    161|	return len;
 1334|    161|}
cdf.c:cdf_read:
  371|  5.10M|{
  372|  5.10M|	size_t siz = CAST(size_t, off + len);
  ------------------
  |  |  426|  5.10M|#define CAST(T, b)	((T)(b))
  ------------------
  373|       |
  374|  5.10M|	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  426|  5.10M|#define CAST(T, b)	((T)(b))
  ------------------
              	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  426|  5.10M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (374:6): [True: 0, False: 5.10M]
  ------------------
  375|      0|		goto out;
  376|       |
  377|  5.10M|	if (info->i_buf != NULL && info->i_len >= siz) {
  ------------------
  |  Branch (377:6): [True: 5.10M, False: 0]
  |  Branch (377:29): [True: 5.09M, False: 4.57k]
  ------------------
  378|  5.09M|		(void)memcpy(buf, &info->i_buf[off], len);
  379|  5.09M|		return CAST(ssize_t, len);
  ------------------
  |  |  426|  5.09M|#define CAST(T, b)	((T)(b))
  ------------------
  380|  5.09M|	}
  381|       |
  382|  4.57k|	if (info->i_fd == -1)
  ------------------
  |  Branch (382:6): [True: 4.57k, False: 0]
  ------------------
  383|  4.57k|		goto out;
  384|       |
  385|      0|	if (pread(info->i_fd, buf, len, off) != CAST(ssize_t, len))
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (385:6): [True: 0, False: 0]
  ------------------
  386|      0|		return -1;
  387|       |
  388|      0|	return CAST(ssize_t, len);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  389|  4.57k|out:
  390|  4.57k|	errno = EINVAL;
  391|  4.57k|	return -1;
  392|      0|}
cdf.c:cdf_calloc:
  125|  5.07k|{
  126|  5.07k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u %"
  127|  5.07k|	    SIZE_T_FORMAT "u\n", file, line, __func__, n, u));
  128|  5.07k|	if (n == 0)
  ------------------
  |  Branch (128:6): [True: 108, False: 4.96k]
  ------------------
  129|    108|	    n++;
  130|  5.07k|	return calloc(n, u);
  131|  5.07k|}
cdf.c:cdf_malloc:
  103|    884|{
  104|    884|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  105|    884|	    file, line, __func__, n));
  106|    884|	if (n == 0)
  ------------------
  |  Branch (106:6): [True: 0, False: 884]
  ------------------
  107|      0|	    n++;
  108|    884|	return malloc(n);
  109|    884|}
cdf.c:cdf_namecmp:
  835|  14.8k|{
  836|  35.8k|	for (; l--; d++, s++)
  ------------------
  |  Branch (836:9): [True: 35.0k, False: 892]
  ------------------
  837|  35.0k|		if (*d != CDF_TOLE2(*s))
  ------------------
  |  |   86|  35.0k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  70.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 35.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (837:7): [True: 13.9k, False: 21.0k]
  ------------------
  838|  13.9k|			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |  426|  13.9k|#define CAST(T, b)	((T)(b))
  ------------------
              			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |   86|  13.9k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|  27.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 13.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  839|    892|	return 0;
  840|  14.8k|}
cdf.c:cdf_offset:
  901|  4.46k|{
  902|  4.46k|	return CAST(const void *, CAST(const uint8_t *, p) + l);
  ------------------
  |  |  426|  4.46k|#define CAST(T, b)	((T)(b))
  ------------------
  903|  4.46k|}
cdf.c:cdf_check_stream_offset:
  354|  5.95k|{
  355|  5.95k|	const char *b = RCAST(const char *, sst->sst_tab);
  ------------------
  |  |  427|  5.95k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  356|  5.95k|	const char *e = RCAST(const char *, p) + tail;
  ------------------
  |  |  427|  5.95k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  357|  5.95k|	size_t ss = cdf_check_stream(sst, h);
  358|  5.95k|	/*LINTED*/(void)&line;
  359|  5.95k|	if (e >= b && CAST(size_t, e - b) <= ss * sst->sst_len)
  ------------------
  |  |  426|  5.95k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (359:6): [True: 5.95k, False: 0]
  |  Branch (359:16): [True: 5.84k, False: 108]
  ------------------
  360|  5.84k|		return 0;
  361|    108|	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
  362|    108|	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
  363|    108|	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
  364|    108|	    ss * sst->sst_len, ss, sst->sst_len));
  365|    108|	errno = EFTYPE;
  ------------------
  |  |   59|    108|#define EFTYPE EINVAL
  ------------------
  366|    108|	return -1;
  367|  5.95k|}
cdf.c:cdf_grow_info:
  938|    547|{
  939|    547|	cdf_property_info_t *inp;
  940|    547|	size_t newcount = *maxcount + incr;
  941|       |
  942|    547|	if (newcount > CDF_PROP_LIMIT) {
  ------------------
  |  |  897|    547|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (942:6): [True: 4, False: 543]
  ------------------
  943|      4|		DPRINTF(("exceeded property limit %" SIZE_T_FORMAT "u > %"
  944|      4|		    SIZE_T_FORMAT "u\n", newcount, CDF_PROP_LIMIT));
  945|      4|		goto out;
  946|      4|	}
  947|    543|	inp = CAST(cdf_property_info_t *,
  ------------------
  |  |  426|    543|#define CAST(T, b)	((T)(b))
  ------------------
  948|    543|	    CDF_REALLOC(*info, newcount * sizeof(*inp)));
  949|    543|	if (inp == NULL)
  ------------------
  |  Branch (949:6): [True: 0, False: 543]
  ------------------
  950|      0|		goto out;
  951|       |
  952|    543|	*info = inp;
  953|    543|	*maxcount = newcount;
  954|    543|	return inp;
  955|      4|out:
  956|      4|	free(*info);
  957|      4|	*maxcount = 0;
  958|      4|	*info = NULL;
  959|      4|	return NULL;
  960|    543|}
cdf.c:cdf_realloc:
  115|    543|{
  116|    543|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  117|    543|	    file, line, __func__, n));
  118|    543|	return realloc(p, n);
  119|    543|}
cdf.c:cdf_get_property_info_pos:
  908|  3.07k|{
  909|  3.07k|	size_t tail = (i << 1) + 1;
  910|  3.07k|	size_t ofs;
  911|       |
  912|  3.07k|	if (p >= e) {
  ------------------
  |  Branch (912:6): [True: 0, False: 3.07k]
  ------------------
  913|      0|		DPRINTF(("Past end %p < %p\n", e, p));
  914|      0|		return NULL;
  915|      0|	}
  916|       |
  917|  3.07k|	if (cdf_check_stream_offset(sst, h, p, (tail + 1) * sizeof(uint32_t),
  ------------------
  |  Branch (917:6): [True: 9, False: 3.06k]
  ------------------
  918|  3.07k|	    __LINE__) == -1)
  919|      9|		return NULL;
  920|       |
  921|  3.06k|	ofs = CDF_GETUINT32(p, tail);
  ------------------
  |  |   92|  3.06k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
  922|  3.06k|	if (ofs < 2 * sizeof(uint32_t)) {
  ------------------
  |  Branch (922:6): [True: 15, False: 3.04k]
  ------------------
  923|     15|		DPRINTF(("Offset too small %zu\n", ofs));
  924|     15|		return NULL;
  925|     15|	}
  926|       |
  927|  3.04k|	ofs -= 2 * sizeof(uint32_t);
  928|  3.04k|	if (ofs > CAST(size_t, e - p)) {
  ------------------
  |  |  426|  3.04k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (928:6): [True: 143, False: 2.90k]
  ------------------
  929|    143|		DPRINTF(("Offset too big %zu %td\n", ofs, e - p));
  930|    143|		return NULL;
  931|    143|	}
  932|       |
  933|  2.90k|	return CAST(const uint8_t *, cdf_offset(CAST(const void *, p), ofs));
  ------------------
  |  |  426|  2.90k|#define CAST(T, b)	((T)(b))
  ------------------
  934|  3.04k|}
cdf.c:cdf_getuint32:
  199|   206k|{
  200|   206k|	uint32_t rv;
  201|   206k|	(void)memcpy(&rv, p + offs * sizeof(uint32_t), sizeof(rv));
  202|   206k|	return CDF_TOLE4(rv);
  ------------------
  |  |   84|   206k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|   412k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 206k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  203|   206k|}
cdf.c:cdf_copy_info:
  965|  1.38k|{
  966|  1.38k|	if (inp->pi_type & CDF_VECTOR)
  ------------------
  |  |  237|  1.38k|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (966:6): [True: 244, False: 1.13k]
  ------------------
  967|    244|		return 0;
  968|       |
  969|  1.13k|	if (CAST(size_t, CAST(const char *, e) - CAST(const char *, p)) < len)
  ------------------
  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (969:6): [True: 86, False: 1.05k]
  ------------------
  970|     86|		return 0;
  971|       |
  972|  1.05k|	(void)memcpy(&inp->pi_val, p, len);
  973|       |
  974|  1.05k|	switch (len) {
  975|    109|	case 2:
  ------------------
  |  Branch (975:2): [True: 109, False: 944]
  ------------------
  976|    109|		inp->pi_u16 = CDF_TOLE2(inp->pi_u16);
  ------------------
  |  |  186|    109|#define pi_u16	pi_val._pi_u16
  ------------------
              		inp->pi_u16 = CDF_TOLE2(inp->pi_u16);
  ------------------
  |  |   86|    109|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  426|    218|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  977|    109|		break;
  978|    354|	case 4:
  ------------------
  |  Branch (978:2): [True: 354, False: 699]
  ------------------
  979|    354|		inp->pi_u32 = CDF_TOLE4(inp->pi_u32);
  ------------------
  |  |  184|    354|#define pi_u32	pi_val._pi_u32
  ------------------
              		inp->pi_u32 = CDF_TOLE4(inp->pi_u32);
  ------------------
  |  |   84|    354|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  426|    708|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 354]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  980|    354|		break;
  981|    590|	case 8:
  ------------------
  |  Branch (981:2): [True: 590, False: 463]
  ------------------
  982|    590|		inp->pi_u64 = CDF_TOLE8(inp->pi_u64);
  ------------------
  |  |  182|    590|#define pi_u64	pi_val._pi_u64
  ------------------
              		inp->pi_u64 = CDF_TOLE8(inp->pi_u64);
  ------------------
  |  |   82|    590|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  426|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (426:25): [True: 0, False: 590]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  983|    590|		break;
  984|      0|	default:
  ------------------
  |  Branch (984:2): [True: 0, False: 1.05k]
  ------------------
  985|      0|		abort();
  986|  1.05k|	}
  987|  1.05k|	return 1;
  988|  1.05k|}
cdf.c:cdf_check_stream:
  344|  5.95k|{
  345|  5.95k|	size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
  ------------------
  |  Branch (345:14): [True: 276, False: 5.67k]
  ------------------
  346|  5.95k|	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   82|    276|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|    276|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  5.67k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  426|  5.67k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  347|  5.95k|	assert(ss == sst->sst_ss);
  348|  5.95k|	return sst->sst_ss;
  349|  5.95k|}

cdf_timestamp_to_timespec:
  100|    973|{
  101|    973|	struct tm tm;
  102|    973|#ifdef HAVE_STRUCT_TM_TM_ZONE
  103|    973|	static char UTC[] = "UTC";
  104|    973|#endif
  105|    973|	int rdays;
  106|       |
  107|       |	/* Unit is 100's of nanoseconds */
  108|    973|	ts->tv_nsec = (t % CDF_TIME_PREC) * 100;
  ------------------
  |  |   90|    973|#define CDF_TIME_PREC	10000000
  ------------------
  109|       |
  110|    973|	t /= CDF_TIME_PREC;
  ------------------
  |  |   90|    973|#define CDF_TIME_PREC	10000000
  ------------------
  111|    973|	tm.tm_sec = CAST(int, t % 60);
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
  112|    973|	t /= 60;
  113|       |
  114|    973|	tm.tm_min = CAST(int, t % 60);
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
  115|    973|	t /= 60;
  116|       |
  117|    973|	tm.tm_hour = CAST(int, t % 24);
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
  118|    973|	t /= 24;
  119|       |
  120|       |	/* XXX: Approx */
  121|    973|	tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|    973|	rdays = cdf_getdays(tm.tm_year);
  124|    973|	t -= rdays - 1;
  125|    973|	tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
  126|    973|	tm.tm_mon = cdf_getmonth(tm.tm_year, CAST(int, t));
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
  127|    973|	tm.tm_wday = 0;
  128|    973|	tm.tm_yday = 0;
  129|    973|	tm.tm_isdst = 0;
  130|    973|#ifdef HAVE_STRUCT_TM_TM_GMTOFF
  131|    973|	tm.tm_gmtoff = 0;
  132|    973|#endif
  133|    973|#ifdef HAVE_STRUCT_TM_TM_ZONE
  134|    973|	tm.tm_zone = UTC;
  135|    973|#endif
  136|    973|	tm.tm_year -= 1900;
  137|    973|	ts->tv_sec = mktime(&tm);
  138|    973|	if (ts->tv_sec == -1) {
  ------------------
  |  Branch (138:6): [True: 7, False: 966]
  ------------------
  139|      7|		errno = EINVAL;
  140|      7|		return -1;
  141|      7|	}
  142|    966|	return 0;
  143|    973|}
cdf_ctime:
  170|    108|{
  171|    108|	char *ptr = ctime_r(sec, buf);
  172|    108|	if (ptr != NULL)
  ------------------
  |  Branch (172:6): [True: 53, False: 55]
  ------------------
  173|     53|		return buf;
  174|       |#ifdef WIN32
  175|       |	(void)snprintf(buf, 26, "*Bad* 0x%16.16I64x\n",
  176|       |	    CAST(long long, *sec));
  177|       |#else
  178|     55|	(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
  179|     55|	    CAST(long long, *sec));
  ------------------
  |  |  426|     55|#define CAST(T, b)	((T)(b))
  ------------------
  180|     55|#endif
  181|     55|	return buf;
  182|    108|}
cdf_time.c:cdf_getdays:
   53|    973|{
   54|    973|	int days = 0;
   55|    973|	int y;
   56|       |
   57|  4.05M|	for (y = CDF_BASE_YEAR; y < year; y++)
  ------------------
  |  |   89|    973|#define CDF_BASE_YEAR	1601
  ------------------
  |  Branch (57:26): [True: 4.05M, False: 973]
  ------------------
   58|  4.05M|		days += isleap(y) + 365;
  ------------------
  |  |   41|  4.05M|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 1.01M, False: 3.04M]
  |  |  ------------------
  |  |   42|  4.05M|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 974k, False: 40.2k]
  |  |  |  Branch (42:28): [True: 9.82k, False: 30.4k]
  |  |  ------------------
  ------------------
   59|       |
   60|    973|	return days;
   61|    973|}
cdf_time.c:cdf_getday:
   68|    973|{
   69|    973|	size_t m;
   70|       |
   71|  2.65k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  123|  2.65k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (71:14): [True: 2.63k, False: 13]
  ------------------
   72|  2.63k|		int sub = mdays[m] + (m == 1 && isleap(year));
  ------------------
  |  |   41|    336|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 143, False: 193]
  |  |  ------------------
  |  |   42|    336|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 73, False: 70]
  |  |  |  Branch (42:28): [True: 34, False: 36]
  |  |  ------------------
  ------------------
  |  Branch (72:25): [True: 336, False: 2.30k]
  ------------------
   73|  2.63k|		if (days < sub)
  ------------------
  |  Branch (73:7): [True: 960, False: 1.67k]
  ------------------
   74|    960|			return days;
   75|  1.67k|		days -= sub;
   76|  1.67k|	}
   77|     13|	return days;
   78|    973|}
cdf_time.c:cdf_getmonth:
   85|    973|{
   86|    973|	size_t m;
   87|       |
   88|  2.60k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  123|  2.60k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (88:14): [True: 2.60k, False: 0]
  ------------------
   89|  2.60k|		days -= mdays[m];
   90|  2.60k|		if (m == 1 && isleap(year))
  ------------------
  |  |   41|    319|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 143, False: 176]
  |  |  ------------------
  |  |   42|    319|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 73, False: 70]
  |  |  |  Branch (42:28): [True: 34, False: 36]
  |  |  ------------------
  ------------------
  |  Branch (90:7): [True: 319, False: 2.28k]
  ------------------
   91|    107|			days--;
   92|  2.60k|		if (days <= 0)
  ------------------
  |  Branch (92:7): [True: 973, False: 1.63k]
  ------------------
   93|    973|			return CAST(int, m);
  ------------------
  |  |  426|    973|#define CAST(T, b)	((T)(b))
  ------------------
   94|  2.60k|	}
   95|      0|	return CAST(int, m);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
   96|    973|}

file_zmagic:
  271|  6.84k|{
  272|  6.84k|	unsigned char *newbuf = NULL;
  273|  6.84k|	size_t i, nsz;
  274|  6.84k|	char *rbuf;
  275|  6.84k|	file_pushbuf_t *pb;
  276|  6.84k|	int urv, prv, rv = 0;
  277|  6.84k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  6.84k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  6.84k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  6.84k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  278|  6.84k|	int fd = b->fd;
  279|  6.84k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  6.84k|#define CAST(T, b)	((T)(b))
  ------------------
  280|  6.84k|	size_t nbytes = b->flen;
  281|  6.84k|	int sa_saved = 0;
  282|  6.84k|	struct sigaction sig_act;
  283|       |
  284|  6.84k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  6.84k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (284:6): [True: 969, False: 5.87k]
  ------------------
  285|    969|		return 0;
  286|       |
  287|  93.9k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (287:14): [True: 88.0k, False: 5.87k]
  ------------------
  288|  88.0k|		int zm;
  289|  88.0k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  426|  88.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (289:7): [True: 5.34k, False: 82.7k]
  ------------------
  290|  5.34k|			continue;
  291|  82.7k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (291:7): [True: 9.71k, False: 73.0k]
  ------------------
  292|  9.71k|			zm = (*compr[i].u.func)(buf);
  293|  73.0k|		} else {
  294|  73.0k|			zm = memcmp(buf, compr[i].u.magic,
  295|  73.0k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  426|  73.0k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  73.0k|		}
  297|       |
  298|  82.7k|		if (!zm)
  ------------------
  |  Branch (298:7): [True: 82.0k, False: 671]
  ------------------
  299|  82.0k|			continue;
  300|       |
  301|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  302|    671|		if (!sa_saved) {
  ------------------
  |  Branch (302:7): [True: 621, False: 50]
  ------------------
  303|       |			//We can use sig_act for both new and old, but
  304|    621|			struct sigaction new_act;
  305|    621|			memset(&new_act, 0, sizeof(new_act));
  306|    621|			new_act.sa_handler = SIG_IGN;
  307|    621|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  308|    621|		}
  309|       |
  310|    671|		nsz = nbytes;
  311|    671|		free(newbuf);
  312|    671|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  313|    671|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|    671|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  314|    671|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  315|    671|		    (char *)newbuf, nsz);
  316|    671|		switch (urv) {
  317|    392|		case OKDATA:
  ------------------
  |  |  216|    392|#define OKDATA 	0
  ------------------
  |  Branch (317:3): [True: 392, False: 279]
  ------------------
  318|    671|		case ERRDATA:
  ------------------
  |  |  218|    671|#define ERRDATA	2
  ------------------
  |  Branch (318:3): [True: 279, False: 392]
  ------------------
  319|    671|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|    671|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  320|    671|			if (urv == ERRDATA)
  ------------------
  |  |  218|    671|#define ERRDATA	2
  ------------------
  |  Branch (320:8): [True: 279, False: 392]
  ------------------
  321|    279|				prv = format_decompression_error(ms, i, newbuf);
  322|    392|			else
  323|    392|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  324|    392|				    nsz);
  325|    671|			if (prv == -1)
  ------------------
  |  Branch (325:8): [True: 2, False: 669]
  ------------------
  326|      2|				goto error;
  327|    669|			rv = 1;
  328|    669|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|    669|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (328:8): [True: 0, False: 669]
  ------------------
  329|      0|				goto out;
  330|    669|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  1.33k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    669|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    669|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (330:8): [True: 669, False: 0]
  |  Branch (330:30): [True: 0, False: 669]
  ------------------
  331|      0|				goto out;
  332|    669|			if ((file_printf(ms,
  ------------------
  |  Branch (332:8): [True: 0, False: 669]
  ------------------
  333|    669|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (333:8): [True: 0, False: 669]
  ------------------
  334|      0|				goto error;
  335|    669|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (335:8): [True: 5, False: 664]
  ------------------
  336|      5|				goto error;
  337|       |			/*
  338|       |			 * XXX: If file_buffer fails here, we overwrite
  339|       |			 * the compressed text. FIXME.
  340|       |			 */
  341|    664|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (341:8): [True: 0, False: 664]
  ------------------
  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|    664|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (347:8): [True: 664, False: 0]
  ------------------
  348|    664|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (348:9): [True: 3, False: 661]
  ------------------
  349|      3|					free(rbuf);
  350|      3|					goto error;
  351|      3|				}
  352|    661|				free(rbuf);
  353|    661|			}
  354|    661|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (354:8): [True: 661, False: 0]
  |  Branch (354:17): [True: 0, False: 661]
  ------------------
  355|      0|				goto error;
  356|       |			/*FALLTHROUGH*/
  357|    661|		case NODATA:
  ------------------
  |  |  217|    661|#define NODATA	1
  ------------------
  |  Branch (357:3): [True: 0, False: 671]
  ------------------
  358|    661|			break;
  359|      0|		default:
  ------------------
  |  Branch (359:3): [True: 0, False: 671]
  ------------------
  360|      0|			abort();
  361|       |			/*NOTREACHED*/
  362|     10|		error:
  363|     10|			rv = -1;
  364|     10|			break;
  365|    671|		}
  366|    671|	}
  367|  5.87k|out:
  368|  5.87k|	DPRINTF("rv = %d\n", rv);
  369|       |
  370|  5.87k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (370:6): [True: 621, False: 5.25k]
  |  Branch (370:18): [True: 621, False: 0]
  ------------------
  371|    621|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  372|       |
  373|  5.87k|	free(newbuf);
  374|  5.87k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  5.87k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  375|  5.87k|	DPRINTF("Zmagic returns %d\n", rv);
  376|  5.87k|	return rv;
  377|  5.87k|}
sread:
  409|    364|{
  410|    364|	ssize_t rv;
  411|    364|#ifdef FIONREAD
  412|    364|	int t = 0;
  413|    364|#endif
  414|    364|	size_t rn = n;
  415|       |
  416|    364|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (416:6): [True: 0, False: 364]
  ------------------
  417|      0|		goto nocheck;
  418|       |
  419|    364|#ifdef FIONREAD
  420|    364|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (420:6): [True: 0, False: 364]
  |  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|    364|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (448:6): [True: 0, False: 364]
  |  Branch (448:15): [True: 0, False: 0]
  ------------------
  449|      0|		n = t;
  450|      0|		rn = n;
  451|      0|	}
  452|    364|#endif
  453|       |
  454|    364|nocheck:
  455|    364|	do
  456|    784|		switch ((rv = read(fd, buf, n))) {
  457|      3|		case -1:
  ------------------
  |  Branch (457:3): [True: 3, False: 781]
  ------------------
  458|      3|			if (errno == EINTR)
  ------------------
  |  Branch (458:8): [True: 3, False: 0]
  ------------------
  459|      3|				continue;
  460|      0|			return -1;
  461|    360|		case 0:
  ------------------
  |  Branch (461:3): [True: 360, False: 424]
  ------------------
  462|    360|			return rn - n;
  463|    421|		default:
  ------------------
  |  Branch (463:3): [True: 421, False: 363]
  ------------------
  464|    421|			n -= rv;
  465|    421|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  426|    421|#define CAST(T, b)	((T)(b))
  ------------------
  466|    421|			break;
  467|    784|		}
  468|    424|	while (n > 0);
  ------------------
  |  Branch (468:9): [True: 420, False: 4]
  ------------------
  469|      4|	return rn;
  470|    364|}
compress.c:lzmacmp:
  137|  3.84k|{
  138|  3.84k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (138:6): [True: 3.80k, False: 35]
  |  Branch (138:24): [True: 6, False: 29]
  |  Branch (138:34): [True: 1, False: 28]
  ------------------
  139|  3.81k|		return 0;
  140|     28|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (140:6): [True: 11, False: 17]
  |  Branch (140:17): [True: 10, False: 1]
  ------------------
  141|     10|		return 0;
  142|     18|	return 1;
  143|     28|}
compress.c:zlibcmp:
  119|  5.87k|{
  120|  5.87k|	unsigned short x = 1;
  121|  5.87k|	unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
  ------------------
  |  |  426|  5.87k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  5.87k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (123:6): [True: 5.43k, False: 441]
  |  Branch (123:29): [True: 15, False: 426]
  ------------------
  124|  5.44k|		return 0;
  125|    426|	if (s[0] != 1)	/* endianness test */
  ------------------
  |  Branch (125:6): [True: 0, False: 426]
  ------------------
  126|      0|		x = buf[0] | (buf[1] << 8);
  127|    426|	else
  128|    426|		x = buf[1] | (buf[0] << 8);
  129|    426|	if (x % 31)
  ------------------
  |  Branch (129:6): [True: 208, False: 218]
  ------------------
  130|    208|		return 0;
  131|    218|	return 1;
  132|    426|}
compress.c:format_decompression_error:
  254|    279|{
  255|    279|	unsigned char *p;
  256|    279|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    279|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    279|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    279|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  257|       |
  258|    279|	if (!mime)
  ------------------
  |  Branch (258:6): [True: 279, False: 0]
  ------------------
  259|    279|		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|    279|}
compress.c:methodname:
  980|    279|{
  981|    279|	switch (method) {
  982|      0|#ifdef BUILTIN_DECOMPRESS
  983|    133|	case METH_FROZEN:
  ------------------
  |  |  186|    133|#define METH_FROZEN	2
  ------------------
  |  Branch (983:2): [True: 133, False: 146]
  ------------------
  984|    145|	case METH_ZLIB:
  ------------------
  |  |  192|    145|#define METH_ZLIB	14
  ------------------
  |  Branch (984:2): [True: 12, False: 267]
  ------------------
  985|    145|		return "zlib";
  986|      0|#endif
  987|      0|#ifdef BUILTIN_BZLIB
  988|      4|	case METH_BZIP:
  ------------------
  |  |  187|      4|#define METH_BZIP	7
  ------------------
  |  Branch (988:2): [True: 4, False: 275]
  ------------------
  989|      4|		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: 277]
  ------------------
  993|      5|	case METH_LZMA:
  ------------------
  |  |  191|      5|#define METH_LZMA	13
  ------------------
  |  Branch (993:2): [True: 3, False: 276]
  ------------------
  994|      5|		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: 277]
  ------------------
  998|      2|		return "zstd";
  999|      0|#endif
 1000|       |#ifdef BUILTIN_LZLIB
 1001|       |	case METH_LZIP:
 1002|       |		return "lzlib";
 1003|       |#endif
 1004|    123|	default:
  ------------------
  |  Branch (1004:2): [True: 123, False: 156]
  ------------------
 1005|    123|		return compr[method].argv[0];
 1006|    279|	}
 1007|    279|}
compress.c:uncompressbuf:
 1045|    671|{
 1046|    671|	int fdp[3][2];
 1047|    671|	int status, rv, w;
 1048|    671|	pid_t pid;
 1049|    671|	pid_t writepid = -1;
 1050|    671|	size_t i;
 1051|    671|	ssize_t r;
 1052|    671|	char *const *args;
 1053|    671|#ifdef HAVE_POSIX_SPAWNP
 1054|    671|	posix_spawn_file_actions_t fa;
 1055|    671|#endif
 1056|    671|	int (*decompress)(const unsigned char *, unsigned char **,
 1057|    671|	    size_t, size_t *, int) = getdecompressor(method);
 1058|       |
 1059|    671|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  426|    671|#define CAST(T, b)	((T)(b))
  ------------------
 1060|    671|	if (*newch == NULL)
  ------------------
  |  Branch (1060:6): [True: 0, False: 671]
  ------------------
 1061|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1062|       |
 1063|    671|	if (decompress) {
  ------------------
  |  Branch (1063:6): [True: 487, False: 184]
  ------------------
 1064|    487|		if (nofork) {
  ------------------
  |  Branch (1064:7): [True: 0, False: 487]
  ------------------
 1065|      0|			return makeerror(newch, n,
 1066|      0|			    "Fork is required to uncompress, but disabled");
 1067|      0|		}
 1068|    487|		return (*decompress)(old, newch, bytes_max, n, 1);
 1069|    487|	}
 1070|       |
 1071|    184|	(void)fflush(stdout);
 1072|    184|	(void)fflush(stderr);
 1073|       |
 1074|    736|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  123|    736|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1074:14): [True: 552, False: 184]
  ------------------
 1075|    552|		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|    184|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1091:7): [True: 184, False: 0]
  |  Branch (1091:19): [True: 0, False: 184]
  ------------------
 1092|    184|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1092:6): [True: 0, False: 184]
  ------------------
 1093|    184|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1093:6): [True: 0, False: 184]
  ------------------
 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|    184|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  427|    184|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1101|    184|#ifdef HAVE_POSIX_SPAWNP
 1102|    184|	posix_spawn_file_actions_init(&fa);
 1103|       |
 1104|    184|	handledesc(&fa, fd, fdp);
 1105|       |
 1106|    184|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1107|    184|	    args, NULL);
 1108|       |
 1109|    184|	posix_spawn_file_actions_destroy(&fa);
 1110|       |
 1111|    184|	if (status == -1) {
  ------------------
  |  Branch (1111:6): [True: 0, False: 184]
  ------------------
 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|    552|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  123|    552|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1140:14): [True: 368, False: 184]
  ------------------
 1141|    368|		closefd(fdp[i], 1);
 1142|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1143|    184|	if (fd == -1) {
  ------------------
  |  Branch (1143:6): [True: 184, False: 0]
  ------------------
 1144|    184|		closefd(fdp[STDIN_FILENO], 0);
 1145|    184|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1146|    184|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1146:7): [True: 0, False: 184]
  ------------------
 1147|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1148|      0|			    strerror(errno));
 1149|      0|			goto err;
 1150|      0|		}
 1151|    184|		closefd(fdp[STDIN_FILENO], 1);
 1152|    184|	}
 1153|       |
 1154|    184|	rv = OKDATA;
  ------------------
  |  |  216|    184|#define OKDATA 	0
  ------------------
 1155|    184|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1156|    184|	if (r < 0) {
  ------------------
  |  Branch (1156:6): [True: 0, False: 184]
  ------------------
 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|    184|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  426|    184|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1162:6): [True: 4, False: 180]
  ------------------
 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|      4|		closefd(fdp[STDOUT_FILENO], 0);
 1169|      4|		goto ok;
 1170|      4|	}
 1171|    180|	if ((r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1171:6): [True: 116, False: 64]
  ------------------
 1172|    116|		rv = ERRDATA;
  ------------------
  |  |  218|    116|#define ERRDATA	2
  ------------------
 1173|    116|		r = filter_error(*newch, r);
 1174|    116|		goto ok;
 1175|    116|	}
 1176|     64|	if  (r == 0)
  ------------------
  |  Branch (1176:7): [True: 64, False: 0]
  ------------------
 1177|     64|		goto ok;
 1178|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1179|      0|	    strerror(errno));
 1180|      0|	goto err;
 1181|    184|ok:
 1182|    184|	*n = r;
 1183|       |	/* NUL terminate, as every buffer is handled here. */
 1184|    184|	(*newch)[*n] = '\0';
 1185|    184|err:
 1186|    184|	closefd(fdp[STDIN_FILENO], 1);
 1187|    184|	closefd(fdp[STDOUT_FILENO], 0);
 1188|    184|	closefd(fdp[STDERR_FILENO], 0);
 1189|       |
 1190|    184|	w = waitpid(pid, &status, 0);
 1191|    368|wait_err:
 1192|    368|	if (w == -1) {
  ------------------
  |  Branch (1192:6): [True: 7, False: 361]
  ------------------
 1193|      7|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1194|      7|		DPRINTF("Child wait return %#x\n", status);
 1195|    361|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1195:13): [True: 0, False: 361]
  ------------------
 1196|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1197|    361|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1197:13): [True: 304, False: 57]
  ------------------
 1198|    304|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1199|    304|	}
 1200|    368|	if (writepid > 0) {
  ------------------
  |  Branch (1200:6): [True: 184, False: 184]
  ------------------
 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|    184|		w = waitpid(writepid, &status, 0);
 1206|    184|		writepid = -1;
 1207|    184|		goto wait_err;
 1208|    184|	}
 1209|       |
 1210|    184|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1211|    184|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1212|       |
 1213|    184|	return rv;
 1214|    368|}
compress.c:getdecompressor:
 1012|    671|{
 1013|    671|	switch (method) {
 1014|      0|#ifdef BUILTIN_DECOMPRESS
 1015|    159|	case METH_FROZEN:
  ------------------
  |  |  186|    159|#define METH_FROZEN	2
  ------------------
  |  Branch (1015:2): [True: 159, False: 512]
  ------------------
 1016|    159|		return uncompressgzipped;
 1017|    218|	case METH_ZLIB:
  ------------------
  |  |  192|    218|#define METH_ZLIB	14
  ------------------
  |  Branch (1017:2): [True: 218, False: 453]
  ------------------
 1018|    218|		return uncompresszlib;
 1019|      0|#endif
 1020|      0|#ifdef BUILTIN_BZLIB
 1021|      5|	case METH_BZIP:
  ------------------
  |  |  187|      5|#define METH_BZIP	7
  ------------------
  |  Branch (1021:2): [True: 5, False: 666]
  ------------------
 1022|      5|		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: 668]
  ------------------
 1026|     21|	case METH_LZMA:
  ------------------
  |  |  191|     21|#define METH_LZMA	13
  ------------------
  |  Branch (1026:2): [True: 18, False: 653]
  ------------------
 1027|     21|		return uncompressxzlib;
 1028|      0|#endif
 1029|      0|#ifdef BUILTIN_ZSTDLIB
 1030|     84|	case METH_ZSTD:
  ------------------
  |  |  190|     84|#define METH_ZSTD	12
  ------------------
  |  Branch (1030:2): [True: 84, False: 587]
  ------------------
 1031|     84|		return uncompresszstd;
 1032|      0|#endif
 1033|       |#ifdef BUILTIN_LZLIB
 1034|       |	case METH_LZIP:
 1035|       |		return uncompresslzlib;
 1036|       |#endif
 1037|    184|	default:
  ------------------
  |  Branch (1037:2): [True: 184, False: 487]
  ------------------
 1038|    184|		return NULL;
 1039|    671|	}
 1040|    671|}
compress.c:uncompressgzipped:
  567|    159|{
  568|    159|	unsigned char flg;
  569|    159|	size_t data_start = 10;
  570|       |
  571|    159|	if (*n < 4) {
  ------------------
  |  Branch (571:6): [True: 4, False: 155]
  ------------------
  572|      4|		goto err;	
  573|      4|	}
  574|       |
  575|    155|	flg = old[3];
  576|       |
  577|    155|	if (flg & FEXTRA) {
  ------------------
  |  |  559|    155|#define FEXTRA		(1 << 2)
  ------------------
  |  Branch (577:6): [True: 69, False: 86]
  ------------------
  578|     69|		if (data_start + 1 >= *n)
  ------------------
  |  Branch (578:7): [True: 11, False: 58]
  ------------------
  579|     11|			goto err;
  580|     58|		data_start += 2 + old[data_start] + old[data_start + 1] * 256;
  581|     58|	}
  582|    144|	if (flg & FNAME) {
  ------------------
  |  |  560|    144|#define FNAME		(1 << 3)
  ------------------
  |  Branch (582:6): [True: 76, False: 68]
  ------------------
  583|  1.11M|		while(data_start < *n && old[data_start])
  ------------------
  |  Branch (583:9): [True: 1.11M, False: 52]
  |  Branch (583:28): [True: 1.11M, False: 24]
  ------------------
  584|  1.11M|			data_start++;
  585|     76|		data_start++;
  586|     76|	}
  587|    144|	if (flg & FCOMMENT) {
  ------------------
  |  |  561|    144|#define FCOMMENT	(1 << 4)
  ------------------
  |  Branch (587:6): [True: 74, False: 70]
  ------------------
  588|   125k|		while(data_start < *n && old[data_start])
  ------------------
  |  Branch (588:9): [True: 125k, False: 59]
  |  Branch (588:28): [True: 125k, False: 15]
  ------------------
  589|   125k|			data_start++;
  590|     74|		data_start++;
  591|     74|	}
  592|    144|	if (flg & FHCRC)
  ------------------
  |  |  558|    144|#define FHCRC		(1 << 1)
  ------------------
  |  Branch (592:6): [True: 68, False: 76]
  ------------------
  593|     68|		data_start += 2;
  594|       |
  595|    144|	if (data_start >= *n)
  ------------------
  |  Branch (595:6): [True: 85, False: 59]
  ------------------
  596|     85|		goto err;
  597|       |
  598|     59|	*n -= data_start;
  599|     59|	old += data_start;
  600|     59|	return uncompresszlib(old, newch, bytes_max, n, 0);
  601|    100|err:
  602|    100|	return makeerror(newch, n, "File too short");
  603|    144|}
compress.c:uncompresszlib:
  608|    277|{
  609|    277|	int rc;
  610|    277|	z_stream z;
  611|       |
  612|    277|	z.next_in = CCAST(Bytef *, old);
  ------------------
  |  |  428|    277|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  613|    277|	z.avail_in = CAST(uint32_t, *n);
  ------------------
  |  |  426|    277|#define CAST(T, b)	((T)(b))
  ------------------
  614|    277|	z.next_out = *newch;
  615|    277|	z.avail_out = CAST(unsigned int, bytes_max);
  ------------------
  |  |  426|    277|#define CAST(T, b)	((T)(b))
  ------------------
  616|    277|	z.zalloc = Z_NULL;
  617|    277|	z.zfree = Z_NULL;
  618|    277|	z.opaque = Z_NULL;
  619|       |
  620|       |	/* LINTED bug in header macro */
  621|    277|	rc = zlib ? inflateInit(&z) : inflateInit2(&z, -15);
  ------------------
  |  Branch (621:7): [True: 218, False: 59]
  ------------------
  622|    277|	if (rc != Z_OK)
  ------------------
  |  Branch (622:6): [True: 0, False: 277]
  ------------------
  623|      0|		goto err;
  624|       |
  625|    277|	rc = inflate(&z, Z_SYNC_FLUSH);
  626|    277|	if (rc != Z_OK && rc != Z_STREAM_END) {
  ------------------
  |  Branch (626:6): [True: 57, False: 220]
  |  Branch (626:20): [True: 45, False: 12]
  ------------------
  627|     45|		inflateEnd(&z);
  628|     45|		goto err;
  629|     45|	}
  630|       |
  631|    232|	*n = CAST(size_t, z.total_out);
  ------------------
  |  |  426|    232|#define CAST(T, b)	((T)(b))
  ------------------
  632|    232|	rc = inflateEnd(&z);
  633|    232|	if (rc != Z_OK)
  ------------------
  |  Branch (633:6): [True: 0, False: 232]
  ------------------
  634|      0|		goto err;
  635|       |
  636|       |	/* let's keep the nul-terminate tradition */
  637|    232|	(*newch)[*n] = '\0';
  638|       |
  639|    232|	return OKDATA;
  ------------------
  |  |  216|    232|#define OKDATA 	0
  ------------------
  640|     45|err:
  641|     45|	return makeerror(newch, n, "%s", z.msg ? z.msg : zError(rc));
  ------------------
  |  Branch (641:35): [True: 40, False: 5]
  ------------------
  642|    232|}
compress.c:uncompressbzlib:
  649|      5|{
  650|      5|	int rc;
  651|      5|	bz_stream bz;
  652|       |
  653|      5|	memset(&bz, 0, sizeof(bz));
  654|      5|	rc = BZ2_bzDecompressInit(&bz, 0, 0);
  655|      5|	if (rc != BZ_OK)
  ------------------
  |  Branch (655:6): [True: 0, False: 5]
  ------------------
  656|      0|		goto err;
  657|       |
  658|      5|	bz.next_in = CCAST(char *, RCAST(const char *, old));
  ------------------
  |  |  428|      5|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  659|      5|	bz.avail_in = CAST(uint32_t, *n);
  ------------------
  |  |  426|      5|#define CAST(T, b)	((T)(b))
  ------------------
  660|      5|	bz.next_out = RCAST(char *, *newch);
  ------------------
  |  |  427|      5|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  661|      5|	bz.avail_out = CAST(unsigned int, bytes_max);
  ------------------
  |  |  426|      5|#define CAST(T, b)	((T)(b))
  ------------------
  662|       |
  663|      5|	rc = BZ2_bzDecompress(&bz);
  664|      5|	if (rc != BZ_OK && rc != BZ_STREAM_END) {
  ------------------
  |  Branch (664:6): [True: 4, False: 1]
  |  Branch (664:21): [True: 4, False: 0]
  ------------------
  665|      4|		BZ2_bzDecompressEnd(&bz);
  666|      4|		goto err;
  667|      4|	}
  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|      4|err:
  681|      4|	return makeerror(newch, n, "bunzip error %d", rc);
  682|      1|}
compress.c:uncompressxzlib:
  689|     21|{
  690|     21|	int rc;
  691|     21|	lzma_stream xz;
  692|       |
  693|     21|	memset(&xz, 0, sizeof(xz));
  694|     21|	rc = lzma_auto_decoder(&xz, UINT64_MAX, 0);
  695|     21|	if (rc != LZMA_OK)
  ------------------
  |  Branch (695:6): [True: 0, False: 21]
  ------------------
  696|      0|		goto err;
  697|       |
  698|     21|	xz.next_in = CCAST(const uint8_t *, old);
  ------------------
  |  |  428|     21|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  699|     21|	xz.avail_in = CAST(uint32_t, *n);
  ------------------
  |  |  426|     21|#define CAST(T, b)	((T)(b))
  ------------------
  700|     21|	xz.next_out = RCAST(uint8_t *, *newch);
  ------------------
  |  |  427|     21|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  701|     21|	xz.avail_out = CAST(unsigned int, bytes_max);
  ------------------
  |  |  426|     21|#define CAST(T, b)	((T)(b))
  ------------------
  702|       |
  703|     21|	rc = lzma_code(&xz, LZMA_RUN);
  704|     21|	if (rc != LZMA_OK && rc != LZMA_STREAM_END) {
  ------------------
  |  Branch (704:6): [True: 6, False: 15]
  |  Branch (704:23): [True: 5, False: 1]
  ------------------
  705|      5|		lzma_end(&xz);
  706|      5|		goto err;
  707|      5|	}
  708|       |
  709|     16|	*n = CAST(size_t, xz.total_out);
  ------------------
  |  |  426|     16|#define CAST(T, b)	((T)(b))
  ------------------
  710|       |
  711|     16|	lzma_end(&xz);
  712|       |
  713|       |	/* let's keep the nul-terminate tradition */
  714|     16|	(*newch)[*n] = '\0';
  715|       |
  716|     16|	return OKDATA;
  ------------------
  |  |  216|     16|#define OKDATA 	0
  ------------------
  717|      5|err:
  718|      5|	return makeerror(newch, n, "unxz error %d", rc);
  719|     21|}
compress.c:uncompresszstd:
  726|     84|{
  727|     84|	size_t rc;
  728|     84|	ZSTD_DStream *zstd;
  729|     84|	ZSTD_inBuffer in;
  730|     84|	ZSTD_outBuffer out;
  731|       |
  732|     84|	if ((zstd = ZSTD_createDStream()) == NULL) {
  ------------------
  |  Branch (732:6): [True: 0, False: 84]
  ------------------
  733|      0|		return makeerror(newch, n, "No ZSTD decompression stream, %s",
  734|      0|		    strerror(errno));
  735|      0|	}
  736|       |
  737|     84|	rc = ZSTD_DCtx_reset(zstd, ZSTD_reset_session_only);
  738|     84|	if (ZSTD_isError(rc))
  ------------------
  |  Branch (738:6): [True: 0, False: 84]
  ------------------
  739|      0|		goto err;
  740|       |
  741|     84|	in.src = CCAST(const void *, old);
  ------------------
  |  |  428|     84|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  742|     84|	in.size = *n;
  743|     84|	in.pos = 0;
  744|     84|	out.dst = RCAST(void *, *newch);
  ------------------
  |  |  427|     84|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  745|     84|	out.size = bytes_max;
  746|     84|	out.pos = 0;
  747|       |
  748|     84|	rc = ZSTD_decompressStream(zstd, &out, &in);
  749|     84|	if (ZSTD_isError(rc))
  ------------------
  |  Branch (749:6): [True: 2, False: 82]
  ------------------
  750|      2|		goto err;
  751|       |
  752|     82|	*n = out.pos;
  753|       |
  754|     82|	ZSTD_freeDStream(zstd);
  755|       |
  756|       |	/* let's keep the nul-terminate tradition */
  757|     82|	(*newch)[*n] = '\0';
  758|       |
  759|     82|	return OKDATA;
  ------------------
  |  |  216|     82|#define OKDATA 	0
  ------------------
  760|      2|err:
  761|      2|	ZSTD_freeDStream(zstd);
  762|      2|	return makeerror(newch, n, "zstd error %d", ZSTD_getErrorCode(rc));
  763|     84|}
compress.c:makeerror:
  831|    163|{
  832|    163|	char *msg;
  833|    163|	va_list ap;
  834|    163|	int rv;
  835|       |
  836|    163|	free(*buf);
  837|    163|	va_start(ap, fmt);
  838|    163|	rv = vasprintf(&msg, fmt, ap);
  839|    163|	va_end(ap);
  840|    163|	if (rv < 0) {
  ------------------
  |  Branch (840:6): [True: 0, False: 163]
  ------------------
  841|      0|		*buf = NULL;
  842|      0|		*len = 0;
  843|      0|		return NODATA;
  ------------------
  |  |  217|      0|#define NODATA	1
  ------------------
  844|      0|	}
  845|    163|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  427|    163|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  846|    163|	*len = strlen(msg);
  847|    163|	return ERRDATA;
  ------------------
  |  |  218|    163|#define ERRDATA	2
  ------------------
  848|    163|}
compress.c:handledesc:
  898|    184|{
  899|    184|	if (fd != -1) {
  ------------------
  |  Branch (899:6): [True: 0, False: 184]
  ------------------
  900|      0|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  901|      0|		movedesc(v, STDIN_FILENO, fd);
  902|    184|	} else {
  903|    184|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
  904|    184|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (904:7): [True: 184, False: 0]
  ------------------
  905|    184|		    closedesc(v, fdp[STDIN_FILENO][1]);
  906|    184|	}
  907|       |
  908|    184|	file_clear_closexec(STDIN_FILENO);
  909|       |
  910|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
  911|    184|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
  912|    184|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (912:6): [True: 184, False: 0]
  ------------------
  913|    184|		closedesc(v, fdp[STDOUT_FILENO][0]);
  914|       |
  915|    184|	file_clear_closexec(STDOUT_FILENO);
  916|       |
  917|    184|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
  918|    184|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (918:6): [True: 184, False: 0]
  ------------------
  919|    184|		closedesc(v, fdp[STDERR_FILENO][0]);
  920|       |
  921|    184|	file_clear_closexec(STDERR_FILENO);
  922|    184|}
compress.c:movedesc:
  869|    552|{
  870|    552|	if (fd == i)
  ------------------
  |  Branch (870:6): [True: 0, False: 552]
  ------------------
  871|      0|		return; /* "no dup was necessary" */
  872|    552|#ifdef HAVE_POSIX_SPAWNP
  873|    552|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  427|    552|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  874|    552|	posix_spawn_file_actions_adddup2(fa, fd, i);
  875|    552|	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|    552|}
compress.c:closedesc:
  887|    552|{
  888|    552|#ifdef HAVE_POSIX_SPAWNP
  889|    552|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  427|    552|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  890|    552|	posix_spawn_file_actions_addclose(fa, fd);
  891|       |#else
  892|       |	close(v ? fd : fd);
  893|       |#endif
  894|    552|}
compress.c:closefd:
  852|  1.47k|{
  853|  1.47k|	if (fd[i] == -1)
  ------------------
  |  Branch (853:6): [True: 372, False: 1.10k]
  ------------------
  854|    372|		return;
  855|  1.10k|	(void) close(fd[i]);
  856|  1.10k|	fd[i] = -1;
  857|  1.10k|}
compress.c:writechild:
  926|    184|{
  927|    184|	pid_t pid;
  928|       |
  929|       |	/*
  930|       |	 * fork again, to avoid blocking because both
  931|       |	 * pipes filled
  932|       |	 */
  933|    184|	pid = fork();
  934|    184|	if (pid == -1) {
  ------------------
  |  Branch (934:6): [True: 0, False: 184]
  ------------------
  935|      0|		DPRINTF("Fork failed (%s)\n", strerror(errno));
  936|      0|		return -1;
  937|      0|	}
  938|    184|	if (pid == 0) {
  ------------------
  |  Branch (938:6): [True: 0, False: 184]
  ------------------
  939|       |		/* child */
  940|      0|		if (swrite(fd, old, n) != CAST(ssize_t, n)) {
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (940:7): [True: 0, False: 0]
  ------------------
  941|      0|			DPRINTF("Write failed (%s)\n", strerror(errno));
  942|      0|			exit(EXIT_FAILURE);
  943|      0|		}
  944|      0|		exit(EXIT_SUCCESS);
  945|      0|	}
  946|       |	/* parent */
  947|    184|	return pid;
  948|    184|}
compress.c:filter_error:
  952|    116|{
  953|    116|	char *p;
  954|    116|	char *buf;
  955|       |
  956|    116|	ubuf[n] = '\0';
  957|    116|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  427|    116|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  958|    116|	while (isspace(CAST(unsigned char, *buf)))
  959|    108|		buf++;
  960|    116|	DPRINTF("Filter error[[[%s]]]\n", buf);
  961|    116|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  426|    116|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (961:6): [True: 116, False: 0]
  ------------------
  962|    116|		*p = '\0';
  963|    116|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  426|    116|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (963:6): [True: 0, False: 116]
  ------------------
  964|      0|		*p = '\0';
  965|    116|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  426|    116|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (965:6): [True: 115, False: 1]
  ------------------
  966|    115|		++p;
  967|    115|		while (isspace(CAST(unsigned char, *p)))
  968|    115|			p++;
  969|    115|		n = strlen(p);
  970|    115|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  426|    115|#define CAST(T, b)	((T)(b))
  ------------------
  971|    115|	}
  972|    116|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
  973|    116|	if (islower(*ubuf))
  974|    113|		*ubuf = toupper(*ubuf);
  975|    116|	return n;
  976|    116|}

der_offs:
  265|  23.7k|{
  266|  23.7k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  427|  23.7k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  23.7k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 23.7k, False: 0]
  ------------------
  268|       |
  269|  23.7k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  23.7k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  23.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 23.7k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  23.7k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  23.7k|	    offs, m->offset));
  275|       |
  276|  23.7k|	uint32_t tlen = getlength(b, &offs, len);
  277|  23.7k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  23.7k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  23.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 23.7k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  23.7k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  23.7k|	    offs, tlen));
  283|       |
  284|  23.7k|	offs += ms->offset + m->offset;
  285|  23.7k|	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|  23.7k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 4.37k, False: 19.3k]
  ------------------
  293|  4.37k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 4.37k]
  ------------------
  294|      0|			return -1;
  295|  4.37k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  426|  4.37k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  4.37k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  4.37k|		    ms->c.li[m->cont_level - 1].off));
  298|  4.37k|	}
  299|  23.7k|	return CAST(int32_t, offs);
  ------------------
  |  |  426|  23.7k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  23.7k|}
der_cmp:
  304|   252k|{
  305|   252k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  427|   252k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   252k|	const char *s = m->value.s;
  307|   252k|	size_t offs = 0, len = ms->search.s_len;
  308|   252k|	uint32_t tag, tlen;
  309|   252k|	char buf[128];
  310|       |
  311|   252k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   252k|	tag = gettag(b, &offs, len);
  314|   252k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   252k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|   252k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 4.31k, False: 248k]
  ------------------
  315|  4.31k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  4.31k|		return -1;
  317|  4.31k|	}
  318|       |
  319|   248k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   248k|	    offs, m->offset));
  321|       |
  322|   248k|	tlen = getlength(b, &offs, len);
  323|   248k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   248k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|   248k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 114k, False: 134k]
  ------------------
  324|   114k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   114k|		return -1;
  326|   114k|	}
  327|       |
  328|   134k|	der_tag(buf, sizeof(buf), tag);
  329|   134k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   134k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 134k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   134k|	size_t slen = strlen(buf);
  333|       |
  334|   134k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 106k, False: 27.9k]
  ------------------
  335|   106k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   106k|		return 0;
  337|   106k|	}
  338|       |
  339|  27.9k|	s += slen;
  340|       |
  341|  29.3k|again:
  342|  29.3k|	switch (*s) {
  343|  22.9k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 22.9k, False: 6.39k]
  ------------------
  344|  22.9k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  22.9k|		return 1;
  346|  1.57k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.57k, False: 27.7k]
  ------------------
  347|  1.57k|		s++;
  348|  1.57k|		goto val;
  349|  4.81k|	default:
  ------------------
  |  Branch (349:2): [True: 4.81k, False: 24.5k]
  ------------------
  350|  4.81k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 4.81k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  4.81k|		slen = 0;
  356|  4.81k|		do
  357|  7.81k|			slen = slen * 10 + *s - '0';
  358|  4.81k|		while (isdigit(CAST(unsigned char, *++s)));
  359|  4.81k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  4.81k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 4.81k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  4.81k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 3.39k, False: 1.42k]
  ------------------
  363|  3.39k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  3.39k|			return 0;
  365|  3.39k|		}
  366|  1.42k|		goto again;
  367|  29.3k|	}
  368|  1.57k|val:
  369|  1.57k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.57k|	    tlen));
  371|  1.57k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.57k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.57k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.57k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.57k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 1.07k, False: 496]
  |  Branch (374:29): [True: 842, False: 237]
  ------------------
  375|    842|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    842|		return 0;
  377|    842|	}
  378|    733|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    733|	DPRINTF(("%s: complete match\n", __func__));
  380|    733|	return 1;
  381|  1.57k|}
der.c:gettag:
  150|   276k|{
  151|   276k|	uint32_t tag;
  152|       |
  153|   276k|	if (*p >= l)
  ------------------
  |  Branch (153:6): [True: 1.43k, False: 275k]
  ------------------
  154|  1.43k|		return DER_BAD;
  ------------------
  |  |   62|  1.43k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  1.43k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   275k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   275k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 233k, False: 41.6k]
  ------------------
  159|   233k|		return tag;
  160|       |
  161|  41.6k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 1.13k, False: 40.5k]
  ------------------
  162|  1.13k|		return DER_BAD;
  ------------------
  |  |   62|  1.13k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  1.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  1.97M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 1.93M, False: 39.3k]
  ------------------
  165|  1.93M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  1.93M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 1.18k, False: 1.92M]
  ------------------
  167|  1.18k|			return DER_BAD;
  ------------------
  |  |   62|  1.18k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  1.93M|	}
  169|  39.3k|	return tag;
  170|  40.5k|}
der.c:getlength:
  183|   272k|{
  184|   272k|	uint8_t digits, i;
  185|   272k|	size_t len;
  186|   272k|	int is_onebyte_result;
  187|       |
  188|   272k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 1.78k, False: 270k]
  ------------------
  189|  1.78k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  1.78k|		return DER_BAD;
  ------------------
  |  |   62|  1.78k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  1.78k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  1.78k|	}
  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|   270k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   270k|	digits = c[(*p)++] & 0x7f;
  200|   270k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 82.6k, False: 187k]
  ------------------
  201|  82.6k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|  82.6k|		return DER_BAD;
  ------------------
  |  |   62|  82.6k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  82.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|  82.6k|	}
  204|       |
  205|   187k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 130k, False: 57.2k]
  ------------------
  206|   130k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  57.2k|	len = 0;
  213|  4.43M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 4.37M, False: 57.2k]
  ------------------
  214|  4.37M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  57.2k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 28.7k, False: 28.5k]
  |  Branch (216:31): [True: 1.34k, False: 27.2k]
  ------------------
  217|  30.0k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  30.0k|		    __func__, *p, len, l));
  219|  30.0k|		return DER_BAD;
  ------------------
  |  |   62|  30.0k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  426|  30.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  30.0k|	}
  221|  27.2k|	return CAST(uint32_t, len);
  ------------------
  |  |  426|  27.2k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  57.2k|}
der.c:der_tag:
  226|   134k|{
  227|   134k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   134k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 105k, False: 28.0k]
  ------------------
  228|   105k|		strlcpy(buf, der__tag[tag], len);
  229|  28.0k|	else
  230|  28.0k|		snprintf(buf, len, "%#x", tag);
  231|   134k|	return buf;
  232|   134k|}
der.c:der_data:
  237|  1.57k|{
  238|  1.57k|	uint32_t i;
  239|  1.57k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  426|  1.57k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.57k|	switch (tag) {
  241|      7|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|      7|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 7, False: 1.56k]
  ------------------
  242|     81|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|     81|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 74, False: 1.50k]
  ------------------
  243|    150|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    150|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 69, False: 1.50k]
  ------------------
  244|    150|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  427|    150|#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: 1.57k]
  ------------------
  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|  1.42k|	default:
  ------------------
  |  Branch (251:2): [True: 1.42k, False: 150]
  ------------------
  252|  1.42k|		break;
  253|  1.57k|	}
  254|       |
  255|  7.08k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 5.66k, False: 1.42k]
  ------------------
  256|  5.66k|		uint32_t z = i << 1;
  257|  5.66k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 5.58k, False: 74]
  ------------------
  258|  5.58k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  5.66k|	}
  260|  1.42k|	return len * 2;
  261|  1.57k|}

file_encoding:
   78|  13.0k|{
   79|  13.0k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  13.0k|	size_t nbytes = b->flen;
   81|  13.0k|	size_t mlen;
   82|  13.0k|	int rv = 1, ucs_type;
   83|  13.0k|	file_unichar_t *udefbuf;
   84|  13.0k|	size_t udeflen;
   85|       |
   86|  13.0k|	if (ubuf == NULL)
  ------------------
  |  Branch (86:6): [True: 6.84k, False: 6.22k]
  ------------------
   87|  6.84k|		ubuf = &udefbuf;
   88|  13.0k|	if (ulen == NULL)
  ------------------
  |  Branch (88:6): [True: 6.84k, False: 6.22k]
  ------------------
   89|  6.84k|		ulen = &udeflen;
   90|       |
   91|  13.0k|	*type = "text";
   92|  13.0k|	*ulen = 0;
   93|  13.0k|	*code = "unknown";
   94|  13.0k|	*code_mime = "binary";
   95|       |
   96|  13.0k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (96:6): [True: 422, False: 12.6k]
  ------------------
   97|    422|		nbytes = ms->encoding_max;
   98|       |
   99|  13.0k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  100|  13.0k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  426|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
  101|  13.0k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (101:6): [True: 0, False: 13.0k]
  ------------------
  102|      0|		file_oomem(ms, mlen);
  103|      0|		goto done;
  104|      0|	}
  105|  13.0k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (105:6): [True: 1.24k, False: 11.8k]
  ------------------
  106|  1.24k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (106:7): [True: 8, False: 1.23k]
  ------------------
  107|      8|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  108|      8|			*code = "Unicode text, UTF-7";
  109|      8|			*code_mime = "utf-7";
  110|  1.23k|		} else {
  111|  1.23k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  112|  1.23k|			*code = "ASCII";
  113|  1.23k|			*code_mime = "us-ascii";
  114|  1.23k|		}
  115|  11.8k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (115:13): [True: 5, False: 11.8k]
  ------------------
  116|      5|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  117|      5|		*code = "Unicode text, UTF-8 (with BOM)";
  118|      5|		*code_mime = "utf-8";
  119|  11.8k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (119:13): [True: 142, False: 11.6k]
  ------------------
  120|    142|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  121|    142|		*code = "Unicode text, UTF-8";
  122|    142|		*code_mime = "utf-8";
  123|  11.6k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (123:13): [True: 456, False: 11.2k]
  ------------------
  124|    456|		if (ucs_type == 1) {
  ------------------
  |  Branch (124:7): [True: 181, False: 275]
  ------------------
  125|    181|			*code = "Unicode text, UTF-32, little-endian";
  126|    181|			*code_mime = "utf-32le";
  127|    275|		} else {
  128|    275|			*code = "Unicode text, UTF-32, big-endian";
  129|    275|			*code_mime = "utf-32be";
  130|    275|		}
  131|    456|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  132|  11.2k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (132:13): [True: 279, False: 10.9k]
  ------------------
  133|    279|		if (ucs_type == 1) {
  ------------------
  |  Branch (133:7): [True: 141, False: 138]
  ------------------
  134|    141|			*code = "Unicode text, UTF-16, little-endian";
  135|    141|			*code_mime = "utf-16le";
  136|    141|		} else {
  137|    138|			*code = "Unicode text, UTF-16, big-endian";
  138|    138|			*code_mime = "utf-16be";
  139|    138|		}
  140|    279|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  141|  10.9k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (141:13): [True: 909, False: 10.0k]
  ------------------
  142|    909|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  143|    909|		*code = "ISO-8859";
  144|    909|		*code_mime = "iso-8859-1";
  145|  10.0k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (145:13): [True: 553, False: 9.47k]
  ------------------
  146|    553|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  147|    553|		*code = "Non-ISO extended-ASCII";
  148|    553|		*code_mime = "unknown-8bit";
  149|  9.47k|	} else {
  150|  9.47k|		unsigned char *nbuf;
  151|       |
  152|  9.47k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  153|  9.47k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  426|  9.47k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (153:7): [True: 0, False: 9.47k]
  ------------------
  154|      0|			file_oomem(ms, mlen);
  155|      0|			goto done;
  156|      0|		}
  157|  9.47k|		from_ebcdic(buf, nbytes, nbuf);
  158|       |
  159|  9.47k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (159:7): [True: 59, False: 9.42k]
  ------------------
  160|     59|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  161|     59|			*code = "EBCDIC";
  162|     59|			*code_mime = "ebcdic";
  163|  9.42k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (163:14): [True: 101, False: 9.31k]
  ------------------
  164|    101|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  165|    101|			    *ulen));
  166|    101|			*code = "International EBCDIC";
  167|    101|			*code_mime = "ebcdic";
  168|  9.31k|		} else { /* Doesn't look like text at all */
  169|  9.31k|			DPRINTF(("binary\n"));
  170|  9.31k|			rv = 0;
  171|  9.31k|			*type = "binary";
  172|  9.31k|		}
  173|  9.47k|		free(nbuf);
  174|  9.47k|	}
  175|       |
  176|  13.0k| done:
  177|  13.0k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (177:6): [True: 6.84k, False: 6.22k]
  ------------------
  178|  6.84k|		free(udefbuf);
  179|       |
  180|  13.0k|	return rv;
  181|  13.0k|}
file_looks_utf8:
  352|  11.8k|{
  353|  11.8k|	size_t i;
  354|  11.8k|	int n;
  355|  11.8k|	file_unichar_t c;
  356|  11.8k|	int gotone = 0, ctrl = 0;
  357|       |
  358|  11.8k|	if (ubuf)
  ------------------
  |  Branch (358:6): [True: 11.8k, False: 0]
  ------------------
  359|  11.8k|		*ulen = 0;
  360|       |
  361|  2.75M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (361:14): [True: 2.75M, False: 723]
  ------------------
  362|  2.75M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (362:7): [True: 2.73M, False: 13.3k]
  ------------------
  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|  2.73M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  236|  2.73M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (368:8): [True: 1.83M, False: 900k]
  ------------------
  369|  1.83M|				ctrl = 1;
  370|       |
  371|  2.73M|			if (ubuf)
  ------------------
  |  Branch (371:8): [True: 2.73M, False: 0]
  ------------------
  372|  2.73M|				ubuf[(*ulen)++] = buf[i];
  373|  2.73M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (373:14): [True: 2.81k, False: 10.4k]
  ------------------
  374|  2.81k|			return -1;
  375|  10.4k|		} else {			   /* 11xxxxxx begins UTF-8 */
  376|  10.4k|			int following;
  377|  10.4k|			uint8_t x = first[buf[i]];
  378|  10.4k|			const struct accept_range *ar =
  379|  10.4k|			    &accept_ranges[(unsigned int)x >> 4];
  380|  10.4k|			if (x == XX)
  ------------------
  |  |  300|  10.4k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (380:8): [True: 3.25k, False: 7.24k]
  ------------------
  381|  3.25k|				return -1;
  382|       |
  383|  7.24k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (383:8): [True: 4.92k, False: 2.32k]
  ------------------
  384|  4.92k|				c = buf[i] & 0x1f;
  385|  4.92k|				following = 1;
  386|  4.92k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (386:15): [True: 800, False: 1.52k]
  ------------------
  387|    800|				c = buf[i] & 0x0f;
  388|    800|				following = 2;
  389|  1.52k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (389:15): [True: 1.52k, False: 0]
  ------------------
  390|  1.52k|				c = buf[i] & 0x07;
  391|  1.52k|				following = 3;
  392|  1.52k|			} 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|  12.3k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (401:16): [True: 10.1k, False: 2.18k]
  ------------------
  402|  10.1k|				i++;
  403|  10.1k|				if (i >= nbytes)
  ------------------
  |  Branch (403:9): [True: 182, False: 9.98k]
  ------------------
  404|    182|					goto done;
  405|       |
  406|  9.98k|				if (n == 0 &&
  ------------------
  |  Branch (406:9): [True: 7.09k, False: 2.88k]
  ------------------
  407|  9.98k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (407:11): [True: 821, False: 6.27k]
  |  Branch (407:30): [True: 3.96k, False: 2.31k]
  ------------------
  408|  4.78k|					return -1;
  409|       |
  410|  5.20k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (410:9): [True: 78, False: 5.12k]
  |  Branch (410:33): [True: 19, False: 5.10k]
  ------------------
  411|     97|					return -1;
  412|       |
  413|  5.10k|				c = (c << 6) + (buf[i] & 0x3f);
  414|  5.10k|			}
  415|       |
  416|  2.18k|			if (ubuf)
  ------------------
  |  Branch (416:8): [True: 2.18k, False: 0]
  ------------------
  417|  2.18k|				ubuf[(*ulen)++] = c;
  418|  2.18k|			gotone = 1;
  419|  2.18k|		}
  420|  2.75M|	}
  421|    905|done:
  422|    905|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (422:9): [True: 637, False: 268]
  |  Branch (422:21): [True: 144, False: 124]
  ------------------
  423|  11.8k|}
encoding.c:looks_ascii:
  265|  22.5k|    size_t *ulen) \
  266|  22.5k|{ \
  267|  22.5k|	size_t i; \
  268|  22.5k|\
  269|  22.5k|	*ulen = 0; \
  270|  22.5k|\
  271|  4.78M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 4.78M, False: 1.29k]
  ------------------
  272|  4.78M|		int t = text_chars[buf[i]]; \
  273|  4.78M|\
  274|  4.78M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 21.2k, False: 4.76M]
  ------------------
  275|  4.78M|			return 0; \
  276|  4.78M|\
  277|  4.78M|		ubuf[(*ulen)++] = buf[i]; \
  278|  4.76M|	} \
  279|  22.5k|	return 1; \
  280|  22.5k|}
encoding.c:looks_latin1:
  265|  20.3k|    size_t *ulen) \
  266|  20.3k|{ \
  267|  20.3k|	size_t i; \
  268|  20.3k|\
  269|  20.3k|	*ulen = 0; \
  270|  20.3k|\
  271|  3.60M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 3.60M, False: 1.01k]
  ------------------
  272|  3.60M|		int t = text_chars[buf[i]]; \
  273|  3.60M|\
  274|  8.36M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 1.14M, False: 2.45M]
  |  Branch (274:7): [True: 19.3k, False: 1.13M]
  ------------------
  275|  3.60M|			return 0; \
  276|  3.60M|\
  277|  3.60M|		ubuf[(*ulen)++] = buf[i]; \
  278|  3.58M|	} \
  279|  20.3k|	return 1; \
  280|  20.3k|}
encoding.c:looks_extended:
  265|  10.0k|    size_t *ulen) \
  266|  10.0k|{ \
  267|  10.0k|	size_t i; \
  268|  10.0k|\
  269|  10.0k|	*ulen = 0; \
  270|  10.0k|\
  271|  3.64M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 3.64M, False: 553]
  ------------------
  272|  3.64M|		int t = text_chars[buf[i]]; \
  273|  3.64M|\
  274|  11.2M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 232k, False: 3.41M]
  |  Branch (274:7): [True: 35.6k, False: 196k]
  |  Branch (274:7): [True: 9.47k, False: 26.1k]
  ------------------
  275|  3.64M|			return 0; \
  276|  3.64M|\
  277|  3.64M|		ubuf[(*ulen)++] = buf[i]; \
  278|  3.63M|	} \
  279|  10.0k|	return 1; \
  280|  10.0k|}
encoding.c:looks_utf8_with_BOM:
  433|  11.8k|{
  434|  11.8k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (434:6): [True: 11.0k, False: 782]
  |  Branch (434:20): [True: 67, False: 10.9k]
  |  Branch (434:38): [True: 41, False: 26]
  |  Branch (434:56): [True: 26, False: 15]
  ------------------
  435|     26|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  436|  11.7k|	else
  437|  11.7k|		return -1;
  438|  11.8k|}
encoding.c:looks_utf7:
  443|  1.24k|{
  444|  1.24k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (444:6): [True: 845, False: 395]
  |  Branch (444:20): [True: 37, False: 808]
  |  Branch (444:37): [True: 14, False: 23]
  |  Branch (444:54): [True: 11, False: 3]
  ------------------
  445|     11|		switch (buf[3]) {
  446|      3|		case '8':
  ------------------
  |  Branch (446:3): [True: 3, False: 8]
  ------------------
  447|      4|		case '9':
  ------------------
  |  Branch (447:3): [True: 1, False: 10]
  ------------------
  448|      7|		case '+':
  ------------------
  |  Branch (448:3): [True: 3, False: 8]
  ------------------
  449|      8|		case '/':
  ------------------
  |  Branch (449:3): [True: 1, False: 10]
  ------------------
  450|      8|			if (ubuf)
  ------------------
  |  Branch (450:8): [True: 8, False: 0]
  ------------------
  451|      8|				*ulen = 0;
  452|      8|			return 1;
  453|      3|		default:
  ------------------
  |  Branch (453:3): [True: 3, False: 8]
  ------------------
  454|      3|			return -1;
  455|     11|		}
  456|  1.22k|	else
  457|  1.22k|		return -1;
  458|  1.24k|}
encoding.c:looks_ucs16:
  467|  11.2k|{
  468|  11.2k|	int bigend;
  469|  11.2k|	uint32_t hi;
  470|  11.2k|	size_t i;
  471|       |
  472|  11.2k|	if (nbytes < 2)
  ------------------
  |  Branch (472:6): [True: 15, False: 11.2k]
  ------------------
  473|     15|		return 0;
  474|       |
  475|  11.2k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (475:6): [True: 1.19k, False: 10.0k]
  |  Branch (475:23): [True: 227, False: 972]
  ------------------
  476|    227|		bigend = 0;
  477|  10.9k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (477:11): [True: 222, False: 10.7k]
  |  Branch (477:28): [True: 204, False: 18]
  ------------------
  478|    204|		bigend = 1;
  479|  10.7k|	else
  480|  10.7k|		return 0;
  481|       |
  482|    431|	*ulen = 0;
  483|    431|	hi = 0;
  484|       |
  485|  4.40k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (485:14): [True: 4.13k, False: 279]
  ------------------
  486|  4.13k|		uint32_t uc;
  487|       |
  488|  4.13k|		if (bigend)
  ------------------
  |  Branch (488:7): [True: 3.07k, False: 1.06k]
  ------------------
  489|  3.07k|			uc = CAST(uint32_t,
  ------------------
  |  |  426|  3.07k|#define CAST(T, b)	((T)(b))
  ------------------
  490|  4.13k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  491|  1.06k|		else
  492|  1.06k|			uc = CAST(uint32_t,
  ------------------
  |  |  426|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  493|  4.13k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  494|       |
  495|  4.13k|		uc &= 0xffff;
  496|       |
  497|  4.13k|		switch (uc) {
  498|      0|		case 0xfffe:
  ------------------
  |  Branch (498:3): [True: 0, False: 4.13k]
  ------------------
  499|     14|		case 0xffff:
  ------------------
  |  Branch (499:3): [True: 14, False: 4.11k]
  ------------------
  500|     14|			return 0;
  501|  4.11k|		default:
  ------------------
  |  Branch (501:3): [True: 4.11k, False: 14]
  ------------------
  502|  4.11k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  460|  4.11k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (460:26): [True: 307, False: 3.80k]
  |  |  |  Branch (460:43): [True: 10, False: 297]
  |  |  ------------------
  ------------------
  503|     10|				return 0;
  504|  4.10k|			break;
  505|  4.13k|		}
  506|  4.10k|		if (hi) {
  ------------------
  |  Branch (506:7): [True: 584, False: 3.52k]
  ------------------
  507|    584|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  462|    584|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 542, False: 42]
  |  |  |  Branch (462:43): [True: 539, False: 3]
  |  |  ------------------
  ------------------
  508|     45|				return 0;
  509|    539|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  510|    539|			hi = 0;
  511|    539|		}
  512|  4.06k|		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  426|    260|#define CAST(T, b)	((T)(b))
  ------------------
              		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  236|    260|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (512:7): [True: 260, False: 3.80k]
  |  Branch (512:19): [True: 59, False: 201]
  ------------------
  513|     59|			return 0;
  514|  4.00k|		ubf[(*ulen)++] = uc;
  515|  4.00k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  461|  4.00k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (461:26): [True: 1.58k, False: 2.42k]
  |  |  |  Branch (461:43): [True: 612, False: 969]
  |  |  ------------------
  ------------------
  516|    612|			hi = uc - 0xd800 + 1;
  517|  4.00k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  462|  4.00k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 969, False: 3.03k]
  |  |  |  Branch (462:43): [True: 24, False: 945]
  |  |  ------------------
  ------------------
  518|     24|			return 0;
  519|  4.00k|	}
  520|       |
  521|    279|	return 1 + bigend;
  522|    431|}
encoding.c:looks_ucs32:
  527|  11.6k|{
  528|  11.6k|	int bigend;
  529|  11.6k|	size_t i;
  530|       |
  531|  11.6k|	if (nbytes < 4)
  ------------------
  |  Branch (531:6): [True: 743, False: 10.9k]
  ------------------
  532|    743|		return 0;
  533|       |
  534|  10.9k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (534:6): [True: 1.34k, False: 9.58k]
  |  Branch (534:23): [True: 398, False: 947]
  |  Branch (534:40): [True: 252, False: 146]
  |  Branch (534:54): [True: 222, False: 30]
  ------------------
  535|    222|		bigend = 0;
  536|  10.7k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (536:11): [True: 790, False: 9.92k]
  |  Branch (536:25): [True: 455, False: 335]
  |  Branch (536:39): [True: 323, False: 132]
  |  Branch (536:56): [True: 290, False: 33]
  ------------------
  537|    290|		bigend = 1;
  538|  10.4k|	else
  539|  10.4k|		return 0;
  540|       |
  541|    512|	*ulen = 0;
  542|       |
  543|   219k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (543:14): [True: 219k, False: 456]
  ------------------
  544|       |		/* XXX fix to properly handle chars > 65536 */
  545|       |
  546|   219k|		if (bigend)
  ------------------
  |  Branch (546:7): [True: 110k, False: 108k]
  ------------------
  547|   110k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  426|   110k|#define CAST(T, b)	((T)(b))
  ------------------
  548|   110k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  426|   110k|#define CAST(T, b)	((T)(b))
  ------------------
  549|   110k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  426|   110k|#define CAST(T, b)	((T)(b))
  ------------------
  550|   110k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  426|   110k|#define CAST(T, b)	((T)(b))
  ------------------
  551|   108k|		else
  552|   108k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  426|   108k|#define CAST(T, b)	((T)(b))
  ------------------
  553|   108k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  426|   108k|#define CAST(T, b)	((T)(b))
  ------------------
  554|   108k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  426|   108k|#define CAST(T, b)	((T)(b))
  ------------------
  555|   108k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  426|   108k|#define CAST(T, b)	((T)(b))
  ------------------
  556|       |
  557|   219k|		if (ubf[*ulen - 1] == 0xfffe)
  ------------------
  |  Branch (557:7): [True: 4, False: 219k]
  ------------------
  558|      4|			return 0;
  559|   219k|		if (ubf[*ulen - 1] < 128 &&
  ------------------
  |  Branch (559:7): [True: 414, False: 218k]
  ------------------
  560|   219k|		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  426|    414|#define CAST(T, b)	((T)(b))
  ------------------
              		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  236|    414|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (560:7): [True: 52, False: 362]
  ------------------
  561|     52|			return 0;
  562|   219k|	}
  563|       |
  564|    456|	return 1 + bigend;
  565|    512|}
encoding.c:from_ebcdic:
  652|  9.47k|{
  653|  9.47k|	size_t i;
  654|       |
  655|  34.9M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (655:14): [True: 34.9M, False: 9.47k]
  ------------------
  656|  34.9M|		out[i] = ebcdic_to_ascii[buf[i]];
  657|  34.9M|	}
  658|  9.47k|}

fmtcheck:
  236|  29.2k|{
  237|  29.2k|	const char	*f1p, *f2p;
  238|  29.2k|	EFT		f1t, f2t;
  239|       |
  240|  29.2k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 29.2k]
  ------------------
  241|       |
  242|  29.2k|	f1p = f1;
  243|  29.2k|	f1t = FMTCHECK_START;
  244|  29.2k|	f2p = f2;
  245|  29.2k|	f2t = FMTCHECK_START;
  246|  58.5k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 29.2k, False: 29.2k]
  ------------------
  247|  29.2k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 29.2k]
  ------------------
  248|      0|			return f2;
  249|  29.2k|		f2t = get_next_format(&f2p, f2t);
  250|  29.2k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 29.2k]
  ------------------
  251|      0|			return f2;
  252|  29.2k|	}
  253|  29.2k|	return f1;
  254|  29.2k|}
fmtcheck.c:get_next_format:
  190|  87.7k|{
  191|  87.7k|	int		infmt;
  192|  87.7k|	const char	*f;
  193|       |
  194|  87.7k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 87.7k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|  87.7k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 87.7k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|  87.7k|	f = *pf;
  203|  87.7k|	infmt = 0;
  204|   146k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 87.7k, False: 58.5k]
  ------------------
  205|  87.7k|		f = strchr(f, '%');
  206|  87.7k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 29.2k, False: 58.5k]
  ------------------
  207|  29.2k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  29.2k|#define RETURN(pf,f,r) do { \
  |  |   61|  29.2k|			*(pf) = (f); \
  |  |   62|  29.2k|			return r; \
  |  |   63|  29.2k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  208|  58.5k|		f++;
  209|  58.5k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 58.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|  58.5k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 58.5k, False: 0]
  ------------------
  212|  58.5k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|  58.5k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|  62.7k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 62.7k, False: 0]
  |  Branch (218:15): [True: 4.25k, False: 58.5k]
  ------------------
  219|  4.25k|		f++;
  220|       |
  221|  58.5k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 58.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|  58.5k|	while (isdigit((unsigned char)*f)) f++;
  226|  58.5k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 58.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|  58.5k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|  58.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  58.5k|			*(pf) = (f); \
  |  |   62|  58.5k|			return r; \
  |  |   63|  58.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|  58.5k|}
fmtcheck.c:get_next_format_from_width:
  171|  58.5k|{
  172|  58.5k|	const char	*f;
  173|       |
  174|  58.5k|	f = *pf;
  175|  58.5k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 1.78k, False: 56.7k]
  ------------------
  176|  1.78k|		f++;
  177|  1.78k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 1.78k]
  ------------------
  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|  2.09k|		while (isdigit((unsigned char)*f)) f++;
  182|  1.78k|		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: 1.78k]
  ------------------
  183|  1.78k|	}
  184|  58.5k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|  58.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  58.5k|			*(pf) = (f); \
  |  |   62|  58.5k|			return r; \
  |  |   63|  58.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|  58.5k|}
fmtcheck.c:get_next_format_from_precision:
   67|  58.5k|{
   68|  58.5k|	int		sh, lg, quad, longdouble;
   69|  58.5k|	const char	*f;
   70|       |
   71|  58.5k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|  58.5k|	f = *pf;
   74|  58.5k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 58.5k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|  1.97k|	case 'l':
  ------------------
  |  Branch (79:2): [True: 1.97k, False: 56.5k]
  ------------------
   80|  1.97k|		f++;
   81|  1.97k|		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: 1.97k]
  ------------------
   82|  1.97k|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 1.97k, False: 0]
  ------------------
   83|  1.97k|			f++;
   84|  1.97k|			quad = 1;
   85|  1.97k|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|  1.97k|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 58.5k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 58.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|  56.5k|	default:
  ------------------
  |  Branch (114:2): [True: 56.5k, False: 1.97k]
  ------------------
  115|  56.5k|		break;
  116|  58.5k|	}
  117|  58.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: 58.5k]
  ------------------
  118|  58.5k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 46.0k, False: 12.4k]
  ------------------
  119|  46.0k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 46.0k]
  ------------------
  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|  46.0k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 46.0k]
  ------------------
  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|  46.0k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 1.97k, False: 44.0k]
  ------------------
  124|  1.97k|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|  1.97k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.97k|			*(pf) = (f); \
  |  |   62|  1.97k|			return r; \
  |  |   63|  1.97k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  44.0k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  44.0k|#define RETURN(pf,f,r) do { \
  |  |   61|  44.0k|			*(pf) = (f); \
  |  |   62|  44.0k|			return r; \
  |  |   63|  44.0k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|  44.0k|	}
  127|  12.4k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 12.4k]
  ------------------
  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|  12.4k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 12.4k]
  ------------------
  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|  12.4k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 998, False: 11.4k]
  ------------------
  144|    998|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 998]
  ------------------
  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|    998|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 998]
  ------------------
  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|    998|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|    998|#define RETURN(pf,f,r) do { \
  |  |   61|    998|			*(pf) = (f); \
  |  |   62|    998|			return r; \
  |  |   63|    998|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|    998|	}
  150|  11.4k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 642, False: 10.8k]
  ------------------
  151|    642|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 642]
  ------------------
  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|    642|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    642|#define RETURN(pf,f,r) do { \
  |  |   61|    642|			*(pf) = (f); \
  |  |   62|    642|			return r; \
  |  |   63|    642|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|    642|	}
  155|  10.8k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 10.8k, False: 0]
  ------------------
  156|  10.8k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 10.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|  10.8k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  10.8k|#define RETURN(pf,f,r) do { \
  |  |   61|  10.8k|			*(pf) = (f); \
  |  |   62|  10.8k|			return r; \
  |  |   63|  10.8k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|  10.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_checkfmt:
   95|   208k|{
   96|   208k|	const char *p;
   97|  1.40M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (97:16): [True: 1.19M, False: 208k]
  ------------------
   98|  1.19M|		if (*p != '%')
  ------------------
  |  Branch (98:7): [True: 1.09M, False: 102k]
  ------------------
   99|  1.09M|			continue;
  100|   102k|		if (*++p == '%')
  ------------------
  |  Branch (100:7): [True: 0, False: 102k]
  ------------------
  101|      0|			continue;
  102|       |		// Skip uninteresting.
  103|   107k|		while (strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (103:10): [True: 5.02k, False: 102k]
  ------------------
  104|  5.02k|			p++;
  105|   102k|		if (*p == '*') {
  ------------------
  |  Branch (105:7): [True: 0, False: 102k]
  ------------------
  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|   102k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (111:7): [True: 0, False: 102k]
  ------------------
  112|      0|			return -1;
  113|       |
  114|   102k|		if (*p == '.') {
  ------------------
  |  Branch (114:7): [True: 1.00k, False: 101k]
  ------------------
  115|  1.00k|			p++;
  116|  1.00k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (116:8): [True: 0, False: 1.00k]
  ------------------
  117|      0|				return -1;
  118|  1.00k|		}
  119|       |
  120|   102k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (120:7): [True: 0, False: 102k]
  ------------------
  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|   102k|	}
  126|   208k|	return 0;
  127|   208k|}
file_vprintf:
  134|   209k|{
  135|   209k|	int len;
  136|   209k|	char *buf, *newstr;
  137|   209k|	char tbuf[1024];
  138|       |
  139|   209k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|   209k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (139:6): [True: 380, False: 208k]
  ------------------
  140|    380|		return 0;
  141|       |
  142|   208k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (142:6): [True: 0, False: 208k]
  ------------------
  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|   208k|	len = vasprintf(&buf, fmt, ap);
  149|   208k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (149:6): [True: 0, False: 208k]
  |  Branch (149:17): [True: 80, False: 208k]
  |  Branch (149:39): [True: 0, False: 208k]
  ------------------
  150|     80|		size_t blen = ms->o.blen;
  151|     80|		free(buf);
  152|     80|		file_clearbuf(ms);
  153|     80|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  154|     80|		    SIZE_T_FORMAT "u", len, blen);
  155|     80|		return -1;
  156|     80|	}
  157|       |
  158|   208k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (158:6): [True: 190k, False: 18.2k]
  ------------------
  159|   190k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  160|   190k|		free(buf);
  161|   190k|		if (len < 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 190k]
  ------------------
  162|      0|			goto out;
  163|   190k|		free(ms->o.buf);
  164|   190k|		buf = newstr;
  165|   190k|	}
  166|   208k|	ms->o.buf = buf;
  167|   208k|	ms->o.blen = len;
  168|   208k|	return 0;
  169|      0|out:
  170|      0|	file_clearbuf(ms);
  171|      0|	file_error(ms, errno, "vasprintf failed");
  172|      0|	return -1;
  173|   208k|}
file_printf:
  177|   209k|{
  178|   209k|	int rv;
  179|   209k|	va_list ap;
  180|       |
  181|   209k|	va_start(ap, fmt);
  182|   209k|	rv = file_vprintf(ms, fmt, ap);
  183|   209k|	va_end(ap);
  184|   209k|	return rv;
  185|   209k|}
file_error:
  215|    135|{
  216|    135|	va_list va;
  217|    135|	va_start(va, f);
  218|    135|	file_error_core(ms, error, f, va, 0);
  219|    135|	va_end(va);
  220|    135|}
file_separator:
  259|  24.0k|{
  260|  24.0k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  255|  24.0k|#define FILE_SEPARATOR "\n- "
  ------------------
  261|  24.0k|}
file_default:
  294|  4.46k|{
  295|  4.46k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  4.46k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  4.46k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  4.46k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (295:6): [True: 0, False: 4.46k]
  ------------------
  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|  4.46k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  4.46k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (302:6): [True: 0, False: 4.46k]
  ------------------
  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|  4.46k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  4.46k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (307:6): [True: 0, False: 4.46k]
  ------------------
  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|  4.46k|	return 0;
  313|  4.46k|}
file_buffer:
  326|  6.93k|{
  327|  6.93k|	int m = 0, rv = 0, looks_text = 0;
  328|  6.93k|	const char *code = NULL;
  329|  6.93k|	const char *code_mime = "binary";
  330|  6.93k|	const char *def = "data";
  331|  6.93k|	const char *ftype = NULL;
  332|  6.93k|	char *rbuf = NULL;
  333|  6.93k|	struct buffer b;
  334|       |
  335|  6.93k|	buffer_init(&b, fd, st, buf, nb);
  336|  6.93k|	ms->mode = b.st.st_mode;
  337|       |
  338|  6.93k|	if (nb == 0) {
  ------------------
  |  Branch (338:6): [True: 84, False: 6.84k]
  ------------------
  339|     84|		def = "empty";
  340|     84|		goto simple;
  341|  6.84k|	} else if (nb == 1) {
  ------------------
  |  Branch (341:13): [True: 5, False: 6.84k]
  ------------------
  342|      5|		def = "very short file (no magic)";
  343|      5|		goto simple;
  344|      5|	}
  345|       |
  346|  6.84k|	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
  ------------------
  |  |   63|  6.84k|#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
  ------------------
  |  Branch (346:6): [True: 6.84k, False: 0]
  ------------------
  347|  6.84k|		looks_text = file_encoding(ms, &b, NULL, 0,
  348|  6.84k|		    &code, &code_mime, &ftype);
  349|  6.84k|	}
  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|  6.84k|#if HAVE_FORK
  367|       |	/* try compression stuff */
  368|  6.84k|	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
  ------------------
  |  |   54|  6.84k|#define	MAGIC_NO_CHECK_COMPRESS	0x0001000 /* Don't check for compressed files */
  ------------------
  |  Branch (368:6): [True: 6.84k, False: 0]
  ------------------
  369|  6.84k|		m = file_zmagic(ms, &b, inname);
  370|  6.84k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.84k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (370:7): [True: 0, False: 6.84k]
  ------------------
  371|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  372|  6.84k|		if (m) {
  ------------------
  |  Branch (372:7): [True: 621, False: 6.22k]
  ------------------
  373|    621|			goto done_encoding;
  374|    621|		}
  375|  6.84k|	}
  376|  6.22k|#endif
  377|       |	/* Check if we have a tar file */
  378|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  6.22k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (378:6): [True: 6.22k, False: 0]
  ------------------
  379|  6.22k|		m = file_is_tar(ms, &b);
  380|  6.22k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.22k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (380:7): [True: 0, False: 6.22k]
  ------------------
  381|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  382|  6.22k|		if (m) {
  ------------------
  |  Branch (382:7): [True: 11, False: 6.21k]
  ------------------
  383|     11|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (383:8): [True: 0, False: 11]
  ------------------
  384|      0|				goto done;
  385|     11|		}
  386|  6.22k|	}
  387|       |
  388|       |	/* Check if we have a JSON file */
  389|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  6.22k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (389:6): [True: 6.22k, False: 0]
  ------------------
  390|  6.22k|		m = file_is_json(ms, &b);
  391|  6.22k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.22k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (391:7): [True: 0, False: 6.22k]
  ------------------
  392|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  393|  6.22k|		if (m) {
  ------------------
  |  Branch (393:7): [True: 21, False: 6.20k]
  ------------------
  394|     21|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (394:8): [True: 0, False: 21]
  ------------------
  395|      0|				goto done;
  396|     21|		}
  397|  6.22k|	}
  398|       |
  399|       |	/* Check if we have a CSV file */
  400|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  6.22k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (400:6): [True: 6.22k, False: 0]
  ------------------
  401|  6.22k|		m = file_is_csv(ms, &b, looks_text);
  402|  6.22k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.22k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (402:7): [True: 0, False: 6.22k]
  ------------------
  403|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  404|  6.22k|		if (m) {
  ------------------
  |  Branch (404:7): [True: 8, False: 6.21k]
  ------------------
  405|      8|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (405:8): [True: 0, False: 8]
  ------------------
  406|      0|				goto done;
  407|      8|		}
  408|  6.22k|	}
  409|       |
  410|       |	/* Check if we have a CDF file */
  411|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  6.22k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (411:6): [True: 6.22k, False: 0]
  ------------------
  412|  6.22k|		m = file_trycdf(ms, &b);
  413|  6.22k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.22k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (413:7): [True: 0, False: 6.22k]
  ------------------
  414|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  415|  6.22k|		if (m) {
  ------------------
  |  Branch (415:7): [True: 1.20k, False: 5.02k]
  ------------------
  416|  1.20k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 1.20k]
  ------------------
  417|      0|				goto done;
  418|  1.20k|		}
  419|  6.22k|	}
  420|  6.22k|#ifdef BUILTIN_ELF
  421|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  6.22k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (421:6): [True: 6.22k, False: 0]
  |  Branch (421:47): [True: 5.22k, False: 993]
  |  Branch (421:57): [True: 0, False: 5.22k]
  ------------------
  422|      0|		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|      0|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (433:7): [True: 0, False: 0]
  ------------------
  434|      0|			return -1;
  435|       |
  436|      0|		rv = file_tryelf(ms, &b);
  437|      0|		rbuf = file_pop_buffer(ms, pb);
  438|      0|		if (rv == -1) {
  ------------------
  |  Branch (438:7): [True: 0, False: 0]
  ------------------
  439|      0|			free(rbuf);
  440|      0|			rbuf = NULL;
  441|      0|		}
  442|      0|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (442:7): [True: 0, False: 0]
  ------------------
  443|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  444|      0|	}
  445|  6.22k|#endif
  446|       |
  447|       |	/* try soft magic tests */
  448|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  6.22k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (448:6): [True: 6.22k, False: 0]
  ------------------
  449|  6.22k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  210|  6.22k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  450|  6.22k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.22k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (450:7): [True: 0, False: 6.22k]
  ------------------
  451|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  452|  6.22k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (452:7): [True: 3.82k, False: 2.39k]
  |  Branch (452:17): [True: 0, False: 3.82k]
  ------------------
  453|      0|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (453:8): [True: 0, False: 0]
  ------------------
  454|      0|				goto done;
  455|      0|		}
  456|  6.22k|		if (m) {
  ------------------
  |  Branch (456:7): [True: 3.95k, False: 2.27k]
  ------------------
  457|  3.95k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (457:8): [True: 0, False: 3.95k]
  ------------------
  458|      0|				goto done;
  459|  3.95k|		}
  460|  6.22k|	}
  461|       |
  462|       |	/* try text properties */
  463|  6.22k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  6.22k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (463:6): [True: 6.22k, False: 0]
  ------------------
  464|       |
  465|  6.22k|		m = file_ascmagic(ms, &b, looks_text);
  466|  6.22k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  6.22k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (466:7): [True: 0, False: 6.22k]
  ------------------
  467|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  468|  6.22k|		if (m) {
  ------------------
  |  Branch (468:7): [True: 1.84k, False: 4.37k]
  ------------------
  469|  1.84k|			goto done;
  470|  1.84k|		}
  471|  6.22k|	}
  472|       |
  473|  4.46k|simple:
  474|       |	/* give up */
  475|  4.46k|	if (m == 0) {
  ------------------
  |  Branch (475:6): [True: 4.46k, False: 0]
  ------------------
  476|  4.46k|		m = 1;
  477|  4.46k|		rv = file_default(ms, nb);
  478|  4.46k|		if (rv == 0)
  ------------------
  |  Branch (478:7): [True: 4.46k, False: 0]
  ------------------
  479|  4.46k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (479:8): [True: 0, False: 4.46k]
  ------------------
  480|      0|				rv = -1;
  481|  4.46k|	}
  482|  6.31k| done:
  483|  6.31k|	trim_separator(ms);
  484|  6.31k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  6.31k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (484:6): [True: 0, False: 6.31k]
  ------------------
  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|  6.31k|#if HAVE_FORK
  492|  6.93k| done_encoding:
  493|  6.93k|#endif
  494|  6.93k|	free(rbuf);
  495|  6.93k|	buffer_fini(&b);
  496|  6.93k|	if (rv)
  ------------------
  |  Branch (496:6): [True: 0, False: 6.93k]
  ------------------
  497|      0|		return rv;
  498|       |
  499|  6.93k|	return m;
  500|  6.93k|}
file_reset:
  505|  5.87k|{
  506|  5.87k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (506:6): [True: 5.87k, False: 2]
  |  Branch (506:21): [True: 0, False: 5.87k]
  ------------------
  507|      0|		file_error(ms, 0, "no magic files loaded");
  508|      0|		return -1;
  509|      0|	}
  510|  5.87k|	file_clearbuf(ms);
  511|  5.87k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (511:6): [True: 5.67k, False: 206]
  ------------------
  512|  5.67k|		free(ms->o.pbuf);
  513|  5.67k|		ms->o.pbuf = NULL;
  514|  5.67k|	}
  515|  5.87k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  461|  5.87k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  516|  5.87k|	ms->error = -1;
  517|  5.87k|	return 0;
  518|  5.87k|}
file_getbuffer:
  530|  5.80k|{
  531|  5.80k|	char *pbuf, *op, *np;
  532|  5.80k|	size_t psize, len;
  533|       |
  534|  5.80k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|  5.80k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (534:6): [True: 130, False: 5.67k]
  ------------------
  535|    130|		return NULL;
  536|       |
  537|  5.67k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  5.67k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (537:6): [True: 0, False: 5.67k]
  ------------------
  538|      0|		return ms->o.buf;
  539|       |
  540|  5.67k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (540:6): [True: 0, False: 5.67k]
  ------------------
  541|      0|		return NULL;
  542|       |
  543|       |	/* * 4 is for octal representation, + 1 is for NUL */
  544|  5.67k|	len = strlen(ms->o.buf);
  545|  5.67k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (545:6): [True: 0, False: 5.67k]
  ------------------
  546|      0|		file_oomem(ms, len);
  547|      0|		return NULL;
  548|      0|	}
  549|  5.67k|	psize = len * 4 + 1;
  550|  5.67k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  426|  5.67k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (550:6): [True: 0, False: 5.67k]
  ------------------
  551|      0|		file_oomem(ms, psize);
  552|      0|		return NULL;
  553|      0|	}
  554|  5.67k|	ms->o.pbuf = pbuf;
  555|       |
  556|  5.67k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  557|  5.67k|	{
  558|  5.67k|		mbstate_t state;
  559|  5.67k|		wchar_t nextchar;
  560|  5.67k|		int mb_conv = 1;
  561|  5.67k|		size_t bytesconsumed;
  562|  5.67k|		char *eop;
  563|  5.67k|		(void)memset(&state, 0, sizeof(mbstate_t));
  564|       |
  565|  5.67k|		np = ms->o.pbuf;
  566|  5.67k|		op = ms->o.buf;
  567|  5.67k|		eop = op + len;
  568|       |
  569|  1.14M|		while (op < eop) {
  ------------------
  |  Branch (569:10): [True: 1.13M, False: 5.64k]
  ------------------
  570|  1.13M|			bytesconsumed = mbrtowc(&nextchar, op,
  571|  1.13M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  426|  1.13M|#define CAST(T, b)	((T)(b))
  ------------------
  572|  1.13M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  426|  2.27M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (572:8): [True: 28, False: 1.13M]
  ------------------
  573|  1.13M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  426|  1.13M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (573:8): [True: 0, False: 1.13M]
  ------------------
  574|     28|				mb_conv = 0;
  575|     28|				break;
  576|     28|			}
  577|       |
  578|  1.13M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (578:8): [True: 1.12M, False: 18.3k]
  ------------------
  579|  1.12M|				(void)memcpy(np, op, bytesconsumed);
  580|  1.12M|				op += bytesconsumed;
  581|  1.12M|				np += bytesconsumed;
  582|  1.12M|			} else {
  583|  36.6k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (583:12): [True: 18.3k, False: 18.3k]
  ------------------
  584|  18.3k|					OCTALIFY(np, op);
  ------------------
  |  |  522|  18.3k|	(void)(*(n)++ = '\\', \
  |  |  523|  18.3k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  426|  18.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  524|  18.3k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|  18.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  525|  18.3k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|  18.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  526|  18.3k|	(o)++)
  ------------------
  585|  18.3k|			}
  586|  1.13M|		}
  587|  5.67k|		*np = '\0';
  588|       |
  589|       |		/* Parsing succeeded as a multi-byte sequence */
  590|  5.67k|		if (mb_conv != 0)
  ------------------
  |  Branch (590:7): [True: 5.64k, False: 28]
  ------------------
  591|  5.64k|			return ms->o.pbuf;
  592|  5.67k|	}
  593|     28|#endif
  594|       |
  595|  9.38k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (595:40): [True: 9.36k, False: 28]
  ------------------
  596|  9.36k|		if (isprint(CAST(unsigned char, *op))) {
  597|  8.90k|			*np++ = *op++;
  598|  8.90k|		} else {
  599|    456|			OCTALIFY(np, op);
  ------------------
  |  |  522|    456|	(void)(*(n)++ = '\\', \
  |  |  523|    456|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  426|    456|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  524|    456|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|    456|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  525|    456|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  426|    456|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  526|    456|	(o)++)
  ------------------
  600|    456|		}
  601|  9.36k|	}
  602|     28|	*np = '\0';
  603|     28|	return ms->o.pbuf;
  604|  5.67k|}
file_check_mem:
  608|   510k|{
  609|   510k|	size_t len;
  610|       |
  611|   510k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (611:6): [True: 1, False: 510k]
  ------------------
  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|   510k|	ms->c.li[level].got_match = 0;
  622|   510k|#ifdef ENABLE_CONDITIONALS
  623|   510k|	ms->c.li[level].last_match = 0;
  624|   510k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  335|   510k|#define				COND_NONE	0
  ------------------
  625|   510k|#endif /* ENABLE_CONDITIONALS */
  626|   510k|	return 0;
  627|   510k|}
file_printedlen:
  631|  1.78k|{
  632|  1.78k|	return ms->o.blen;
  633|  1.78k|}
file_replace:
  637|    900|{
  638|    900|	file_regex_t rx;
  639|    900|	int rc, rv = -1;
  640|       |
  641|    900|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  642|    900|	if (rc == 0) {
  ------------------
  |  Branch (642:6): [True: 900, False: 0]
  ------------------
  643|    900|		regmatch_t rm;
  644|    900|		int nm = 0;
  645|    979|		while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (645:10): [True: 79, False: 900]
  ------------------
  646|     79|			ms->o.buf[rm.rm_so] = '\0';
  647|     79|			if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (647:8): [True: 0, False: 79]
  ------------------
  648|     79|			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (648:8): [True: 79, False: 0]
  ------------------
  649|      0|				goto out;
  650|     79|			nm++;
  651|     79|		}
  652|    900|		rv = nm;
  653|    900|	}
  654|    900|out:
  655|    900|	file_regfree(&rx);
  656|    900|	return rv;
  657|    900|}
file_regcomp:
  692|  24.8k|{
  693|  24.8k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (693:6): [True: 0, False: 24.8k]
  ------------------
  694|      0|		return -1;
  695|       |
  696|  24.8k|#ifdef USE_C_LOCALE
  697|  24.8k|	locale_t old = uselocale(ms->c_lc_ctype);
  698|  24.8k|	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|  24.8k|	int rc;
  705|  24.8k|	rc = regcomp(rx, pat, flags);
  706|       |
  707|  24.8k|#ifdef USE_C_LOCALE
  708|  24.8k|	uselocale(old);
  709|       |#else
  710|       |	(void)setlocale(LC_CTYPE, old);
  711|       |#endif
  712|  24.8k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (712:6): [True: 0, False: 24.8k]
  |  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|  24.8k|	return rc;
  721|  24.8k|}
file_regexec:
  727|   180k|{
  728|   180k|#ifdef USE_C_LOCALE
  729|   180k|	locale_t old = uselocale(ms->c_lc_ctype);
  730|   180k|	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|   180k|	int rc;
  737|       |	/* XXX: force initialization because glibc does not always do this */
  738|   180k|	if (nmatch != 0)
  ------------------
  |  Branch (738:6): [True: 157k, False: 23.8k]
  ------------------
  739|   157k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  740|   180k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  741|   180k|#ifdef USE_C_LOCALE
  742|   180k|	uselocale(old);
  743|       |#else
  744|       |	(void)setlocale(LC_CTYPE, old);
  745|       |#endif
  746|   180k|	return rc;
  747|   180k|}
file_regfree:
  751|  24.7k|{
  752|  24.7k|	regfree(rx);
  753|  24.7k|}
file_push_buffer:
  757|  14.5k|{
  758|  14.5k|	file_pushbuf_t *pb;
  759|       |
  760|  14.5k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|  14.5k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (760:6): [True: 5, False: 14.4k]
  ------------------
  761|      5|		return NULL;
  762|       |
  763|  14.4k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  426|  14.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (763:6): [True: 0, False: 14.4k]
  ------------------
  764|      0|		return NULL;
  765|       |
  766|  14.4k|	pb->buf = ms->o.buf;
  767|  14.4k|	pb->blen = ms->o.blen;
  768|  14.4k|	pb->offset = ms->offset;
  769|       |
  770|  14.4k|	ms->o.buf = NULL;
  771|  14.4k|	ms->o.blen = 0;
  772|  14.4k|	ms->offset = 0;
  773|       |
  774|  14.4k|	return pb;
  775|  14.4k|}
file_pop_buffer:
  779|  14.4k|{
  780|  14.4k|	char *rbuf;
  781|       |
  782|  14.4k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  461|  14.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (782:6): [True: 590, False: 13.9k]
  ------------------
  783|    590|		free(pb->buf);
  784|    590|		free(pb);
  785|    590|		return NULL;
  786|    590|	}
  787|       |
  788|  13.9k|	rbuf = ms->o.buf;
  789|       |
  790|  13.9k|	ms->o.buf = pb->buf;
  791|  13.9k|	ms->o.blen = pb->blen;
  792|  13.9k|	ms->offset = pb->offset;
  793|       |
  794|  13.9k|	free(pb);
  795|  13.9k|	return rbuf;
  796|  14.4k|}
file_printable:
  804|  16.2k|{
  805|  16.2k|	char *ptr, *eptr = buf + bufsiz - 1;
  806|  16.2k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  427|  16.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  807|  16.2k|	const unsigned char *es = s + slen;
  808|       |
  809|   117k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (809:19): [True: 117k, False: 77]
  |  Branch (809:33): [True: 117k, False: 579]
  |  Branch (809:43): [True: 101k, False: 15.5k]
  ------------------
  810|   101k|		if ((ms->flags & MAGIC_RAW) != 0 ||
  ------------------
  |  |   41|   101k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (810:7): [True: 0, False: 101k]
  ------------------
  811|   101k|		    (isprint(*s) && !isspace(*s))) {
  ------------------
  |  Branch (811:23): [True: 59.4k, False: 1.32k]
  ------------------
  812|  59.4k|			*ptr++ = *s;
  813|  59.4k|			continue;
  814|  59.4k|		}
  815|  42.3k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (815:7): [True: 47, False: 42.3k]
  ------------------
  816|     47|			break;
  817|  42.3k|		*ptr++ = '\\';
  818|  42.3k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  426|  42.3k|#define CAST(T, b)	((T)(b))
  ------------------
  819|  42.3k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  426|  42.3k|#define CAST(T, b)	((T)(b))
  ------------------
  820|  42.3k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  426|  42.3k|#define CAST(T, b)	((T)(b))
  ------------------
  821|  42.3k|	}
  822|  16.2k|	*ptr = '\0';
  823|  16.2k|	return buf;
  824|  16.2k|}
file_print_guid:
  860|    317|{
  861|    317|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  426|    317|#define CAST(T, b)	((T)(b))
  ------------------
  862|    317|	    CAST(const void *, guid));
  863|       |
  864|    317|#ifndef WIN32
  865|    317|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  866|    317|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  867|    317|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  868|    317|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  869|    317|	    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|    317|}
file_pipe_closexec:
  881|    552|{
  882|    552|#ifdef HAVE_PIPE2
  883|    552|	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|    552|}
file_clear_closexec:
  896|    552|file_clear_closexec(int fd) {
  897|    552|#ifdef F_SETFD
  898|    552|	return fcntl(fd, F_SETFD, 0);
  899|       |#else
  900|       |	return 0;
  901|       |#endif
  902|    552|}
file_strtrim:
  906|    100|{
  907|    100|	char *last;
  908|       |
  909|    100|	while (isspace(CAST(unsigned char, *str)))
  910|    115|		str++;
  911|    100|	last = str;
  912|  1.71k|	while (*last)
  ------------------
  |  Branch (912:9): [True: 1.61k, False: 100]
  ------------------
  913|  1.61k|		last++;
  914|    100|	--last;
  915|    100|	while (isspace(CAST(unsigned char, *last)))
  916|    142|		last--;
  917|    100|	*++last = '\0';
  918|    100|	return str;
  919|    100|}
funcs.c:file_checkfield:
   76|   103k|{
   77|   103k|	const char *p = *pp;
   78|   103k|	int fw = 0;
   79|       |
   80|   107k|	while (*p && isdigit((unsigned char)*p))
  ------------------
  |  Branch (80:9): [True: 107k, False: 0]
  ------------------
   81|  3.43k|		fw = fw * 10 + (*p++ - '0');
   82|       |
   83|   103k|	*pp = p;
   84|       |
   85|   103k|	if (fw < 1024)
  ------------------
  |  Branch (85:6): [True: 103k, False: 0]
  ------------------
   86|   103k|		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|   103k|}
funcs.c:file_clearbuf:
   68|  5.95k|{
   69|  5.95k|	free(ms->o.buf);
   70|  5.95k|	ms->o.buf = NULL;
   71|  5.95k|	ms->o.blen = 0;
   72|  5.95k|}
funcs.c:file_error_core:
  195|    135|{
  196|       |	/* Only the first error is ok */
  197|    135|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|    135|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (197:6): [True: 0, False: 135]
  ------------------
  198|      0|		return;
  199|    135|	if (lineno != 0) {
  ------------------
  |  Branch (199:6): [True: 0, False: 135]
  ------------------
  200|      0|		file_clearbuf(ms);
  201|      0|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  202|      0|	}
  203|    135|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (203:6): [True: 1, False: 134]
  |  Branch (203:19): [True: 1, False: 0]
  ------------------
  204|      1|		(void)file_printf(ms, " ");
  205|    135|	(void)file_vprintf(ms, f, va);
  206|    135|	if (error > 0)
  ------------------
  |  Branch (206:6): [True: 0, False: 135]
  ------------------
  207|      0|		(void)file_printf(ms, " (%s)", strerror(error));
  208|    135|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  461|    135|#define 		EVENT_HAD_ERR		0x01
  ------------------
  209|    135|	ms->error = error;
  210|    135|}
funcs.c:checkdone:
  284|  5.19k|{
  285|  5.19k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  5.19k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (285:6): [True: 0, False: 5.19k]
  ------------------
  286|      0|		return 1;
  287|  5.19k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (287:6): [True: 0, False: 5.19k]
  ------------------
  288|      0|		*rv = -1;
  289|  5.19k|	return 0;
  290|  5.19k|}
funcs.c:trim_separator:
  265|  6.31k|{
  266|  6.31k|	size_t l;
  267|       |
  268|  6.31k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (268:6): [True: 0, False: 6.31k]
  ------------------
  269|      0|		return;
  270|       |
  271|  6.31k|	l = strlen(ms->o.buf);
  272|  6.31k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  255|  6.31k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (272:6): [True: 0, False: 6.31k]
  ------------------
  273|      0|		return;
  274|       |
  275|  6.31k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  255|  6.31k|#define FILE_SEPARATOR "\n- "
  ------------------
  276|  6.31k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  255|  6.31k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (276:6): [True: 6.24k, False: 68]
  ------------------
  277|  6.24k|		return;
  278|       |
  279|     68|	ms->o.buf[l] = '\0';
  280|     68|}
funcs.c:check_regex:
  661|  24.8k|{
  662|  24.8k|	char sbuf[512];
  663|  24.8k|	unsigned char oc = '\0';
  664|       |
  665|   300k|	for (const char *p = pat; *p; p++) {
  ------------------
  |  Branch (665:28): [True: 275k, False: 24.8k]
  ------------------
  666|   275k|		unsigned char c = *p;
  667|       |		// Avoid repetition
  668|   275k|		if (c == oc && strchr("?*+{", c) != NULL) {
  ------------------
  |  Branch (668:7): [True: 96, False: 275k]
  |  Branch (668:18): [True: 0, False: 96]
  ------------------
  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|   275k|		oc = c;
  677|   275k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (677:35): [True: 4, False: 1]
  ------------------
  678|   275k|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (678:10): [True: 1, False: 0]
  ------------------
  679|   275k|			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|   275k|	}
  686|  24.8k|	return 0;
  687|  24.8k|}

file_is_csv:
  134|  6.22k|{
  135|  6.22k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  6.22k|#define CAST(T, b)	((T)(b))
  ------------------
  136|  6.22k|	const unsigned char *ue = uc + b->flen;
  137|  6.22k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  6.22k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  6.22k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  6.22k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  138|       |
  139|  6.22k|	if (!looks_text)
  ------------------
  |  Branch (139:6): [True: 4.47k, False: 1.74k]
  ------------------
  140|  4.47k|		return 0;
  141|       |
  142|  1.74k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  1.74k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  1.74k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (142:6): [True: 0, False: 1.74k]
  ------------------
  143|      0|		return 0;
  144|       |
  145|  1.74k|	if (!csv_parse(uc, ue))
  ------------------
  |  Branch (145:6): [True: 1.74k, False: 8]
  ------------------
  146|  1.74k|		return 0;
  147|       |
  148|      8|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|      8|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (148:6): [True: 0, False: 8]
  ------------------
  149|      0|		return 1;
  150|       |
  151|      8|	if (mime) {
  ------------------
  |  Branch (151:6): [True: 0, False: 8]
  ------------------
  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|      8|	if (file_printf(ms, "CSV text") == -1)
  ------------------
  |  Branch (157:6): [True: 0, False: 8]
  ------------------
  158|      0|		return -1;
  159|       |
  160|      8|	return 1;
  161|      8|}
is_csv.c:csv_parse:
   93|  1.74k|{
   94|  1.74k|	size_t nf = 0, tf = 0, nl = 0;
   95|       |
   96|  12.2M|	while (uc < ue) {
  ------------------
  |  Branch (96:9): [True: 12.2M, False: 1.52k]
  ------------------
   97|  12.2M|		switch (*uc++) {
   98|  5.40k|		case '"':
  ------------------
  |  Branch (98:3): [True: 5.40k, False: 12.2M]
  ------------------
   99|       |			// Eat until the matching quote
  100|  5.40k|			uc = eatquote(uc, ue);
  101|  5.40k|			break;
  102|  3.52M|		case ',':
  ------------------
  |  Branch (102:3): [True: 3.52M, False: 8.70M]
  ------------------
  103|  3.52M|			nf++;
  104|  3.52M|			break;
  105|    402|		case '\n':
  ------------------
  |  Branch (105:3): [True: 402, False: 12.2M]
  ------------------
  106|    402|			DPRINTF("%zu %zu %zu\n", nl, nf, tf);
  107|    402|			nl++;
  108|    402|#if CSV_LINES
  109|    402|			if (nl == CSV_LINES)
  ------------------
  |  |   61|    402|#define CSV_LINES 10
  ------------------
  |  Branch (109:8): [True: 10, False: 392]
  ------------------
  110|     10|				return tf != 0 && tf == nf;
  ------------------
  |  Branch (110:12): [True: 10, False: 0]
  |  Branch (110:23): [True: 2, False: 8]
  ------------------
  111|    392|#endif
  112|    392|			if (tf == 0) {
  ------------------
  |  Branch (112:8): [True: 252, False: 140]
  ------------------
  113|       |				// First time and no fields, give up
  114|    252|				if (nf == 0) 
  ------------------
  |  Branch (114:9): [True: 180, False: 72]
  ------------------
  115|    180|					return 0;
  116|       |				// First time, set the number of fields
  117|     72|				tf = nf;
  118|    140|			} else if (tf != nf) {
  ------------------
  |  Branch (118:15): [True: 35, False: 105]
  ------------------
  119|       |				// Field number mismatch, we are done.
  120|     35|				return 0;
  121|     35|			}
  122|    177|			nf = 0;
  123|    177|			break;
  124|  8.70M|		default:
  ------------------
  |  Branch (124:3): [True: 8.70M, False: 3.53M]
  ------------------
  125|  8.70M|			break;
  126|  12.2M|		}
  127|  12.2M|	}
  128|  1.52k|	return tf && nl > 2;
  ------------------
  |  Branch (128:9): [True: 27, False: 1.49k]
  |  Branch (128:15): [True: 6, False: 21]
  ------------------
  129|  1.74k|}
is_csv.c:eatquote:
   68|  5.40k|{
   69|  5.40k|	int quote = 0;
   70|       |
   71|  1.40M|	while (uc < ue) {
  ------------------
  |  Branch (71:9): [True: 1.40M, False: 158]
  ------------------
   72|  1.40M|		unsigned char c = *uc++;
   73|  1.40M|		if (c != '"') {
  ------------------
  |  Branch (73:7): [True: 1.38M, False: 14.4k]
  ------------------
   74|       |			// We already got one, done.
   75|  1.38M|			if (quote) {
  ------------------
  |  Branch (75:8): [True: 5.25k, False: 1.38M]
  ------------------
   76|  5.25k|				return --uc;
   77|  5.25k|			}
   78|  1.38M|			continue;
   79|  1.38M|		}
   80|  14.4k|		if (quote) {
  ------------------
  |  Branch (80:7): [True: 4.61k, False: 9.87k]
  ------------------
   81|       |			// quote-quote escapes
   82|  4.61k|			quote = 0;
   83|  4.61k|			continue;
   84|  4.61k|		}
   85|       |		// first quote
   86|  9.87k|		quote = 1;
   87|  9.87k|	}
   88|    158|	return ue;
   89|  5.40k|}

file_is_json:
  423|  6.22k|{
  424|  6.22k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  6.22k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  6.22k|	const unsigned char *ue = uc + b->flen;
  426|  6.22k|	size_t st[JSON_MAX];
  427|  6.22k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  6.22k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  6.22k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  6.22k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  6.22k|	int jt;
  429|       |
  430|       |
  431|  6.22k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  6.22k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  6.22k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 6.22k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  6.22k|	memset(st, 0, sizeof(st));
  435|       |
  436|  6.22k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 6.20k, False: 21]
  ------------------
  437|  6.20k|		return 0;
  438|       |
  439|     21|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     21|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 21]
  ------------------
  440|      0|		return 1;
  441|     21|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 21]
  ------------------
  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|     21|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 21]
  ------------------
  448|     21|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 11, False: 10]
  ------------------
  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|     21|	return 1;
  462|     21|}
is_json.c:json_parse:
  348|  13.0k|{
  349|  13.0k|	const unsigned char *uc, *ouc;
  350|  13.0k|	int rv = 0;
  351|  13.0k|	int t;
  352|       |
  353|  13.0k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  13.0k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 39, False: 13.0k]
  ------------------
  355|     39|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  13.0k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 2, False: 13.0k]
  ------------------
  359|      2|		DPRINTF("Too many levels", uc, *ucp);
  ------------------
  |  |   52|      2|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|      2|		return 0;
  361|      2|	}
  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|  13.0k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  13.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|  13.0k|	switch (*uc++) {
  370|    341|	case '"':
  ------------------
  |  Branch (370:2): [True: 341, False: 12.6k]
  ------------------
  371|    341|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    341|		t = JSON_STRING;
  ------------------
  |  |   60|    341|#define JSON_STRING	4
  ------------------
  373|    341|		break;
  374|  4.73k|	case '[':
  ------------------
  |  Branch (374:2): [True: 4.73k, False: 8.28k]
  ------------------
  375|  4.73k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  4.73k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  4.73k|#define JSON_ARRAY	0
  ------------------
  377|  4.73k|		break;
  378|    388|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 388, False: 12.6k]
  ------------------
  379|    388|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    388|		t = JSON_OBJECT;
  ------------------
  |  |   59|    388|#define JSON_OBJECT	3
  ------------------
  381|    388|		break;
  382|    190|	case 't':
  ------------------
  |  Branch (382:2): [True: 190, False: 12.8k]
  ------------------
  383|    190|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    190|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    190|#define JSON_CONSTANT	1
  ------------------
  385|    190|		break;
  386|    247|	case 'f':
  ------------------
  |  Branch (386:2): [True: 247, False: 12.7k]
  ------------------
  387|    247|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    247|		    lvl + 1);
  389|    247|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    247|#define JSON_CONSTANT	1
  ------------------
  390|    247|		break;
  391|    263|	case 'n':
  ------------------
  |  Branch (391:2): [True: 263, False: 12.7k]
  ------------------
  392|    263|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    263|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    263|#define JSON_CONSTANT	1
  ------------------
  394|    263|		break;
  395|  6.85k|	default:
  ------------------
  |  Branch (395:2): [True: 6.85k, False: 6.16k]
  ------------------
  396|  6.85k|		--uc;
  397|  6.85k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  6.85k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  6.85k|#define JSON_NUMBER	2
  ------------------
  399|  6.85k|		break;
  400|  13.0k|	}
  401|  13.0k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 2.85k, False: 10.1k]
  ------------------
  402|  2.85k|		st[t]++;
  403|  13.0k|	uc = json_skip_space(uc, ue);
  404|  13.0k|out:
  405|  13.0k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  13.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  406|  13.0k|	*ucp = uc;
  407|  13.0k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 6.22k, False: 6.83k]
  ------------------
  408|  6.22k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 5.92k, False: 294]
  ------------------
  409|  5.92k|			return 0;
  410|    294|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 57, False: 237]
  ------------------
  411|     57|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|     57|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     48|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 9, False: 48]
  |  Branch (411:31): [True: 2, False: 46]
  ------------------
  412|    237|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 37, False: 200]
  |  Branch (412:22): [True: 22, False: 15]
  ------------------
  413|     22|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     22|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     13|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 9, False: 13]
  |  Branch (413:31): [True: 1, False: 12]
  ------------------
  414|    215|		else
  415|    215|			return 0;
  416|    237|	}
  417|  6.83k|	return rv;
  418|  13.0k|}
is_json.c:json_skip_space:
  119|  33.6k|{
  120|   785k|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 783k, False: 2.09k]
  |  Branch (120:20): [True: 751k, False: 31.5k]
  ------------------
  121|   751k|		uc++;
  122|  33.6k|	return uc;
  123|  33.6k|}
is_json.c:json_isspace:
   79|   783k|{
   80|   783k|	switch (uc) {
   81|  4.53k|	case ' ':
  ------------------
  |  Branch (81:2): [True: 4.53k, False: 778k]
  ------------------
   82|   130k|	case '\n':
  ------------------
  |  Branch (82:2): [True: 125k, False: 657k]
  ------------------
   83|   751k|	case '\r':
  ------------------
  |  Branch (83:2): [True: 620k, False: 162k]
  ------------------
   84|   751k|	case '\t':
  ------------------
  |  Branch (84:2): [True: 300, False: 782k]
  ------------------
   85|   751k|		return 1;
   86|  31.5k|	default:
  ------------------
  |  Branch (86:2): [True: 31.5k, False: 751k]
  ------------------
   87|  31.5k|		return 0;
   88|   783k|	}
   89|   783k|}
is_json.c:json_parse_string:
  129|    739|{
  130|    739|	const unsigned char *uc = *ucp;
  131|    739|	size_t i;
  132|       |
  133|    739|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|    739|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|   166k|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 166k, False: 76]
  ------------------
  135|   166k|		switch (*uc++) {
  136|     10|		case '\0':
  ------------------
  |  Branch (136:3): [True: 10, False: 166k]
  ------------------
  137|     10|			goto out;
  138|  4.13k|		case '\\':
  ------------------
  |  Branch (138:3): [True: 4.13k, False: 161k]
  ------------------
  139|  4.13k|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 14, False: 4.12k]
  ------------------
  140|     14|				goto out;
  141|  4.12k|			switch (*uc++) {
  142|      1|			case '\0':
  ------------------
  |  Branch (142:4): [True: 1, False: 4.12k]
  ------------------
  143|      1|				goto out;
  144|    236|			case '"':
  ------------------
  |  Branch (144:4): [True: 236, False: 3.88k]
  ------------------
  145|    569|			case '\\':
  ------------------
  |  Branch (145:4): [True: 333, False: 3.79k]
  ------------------
  146|    760|			case '/':
  ------------------
  |  Branch (146:4): [True: 191, False: 3.93k]
  ------------------
  147|  1.02k|			case 'b':
  ------------------
  |  Branch (147:4): [True: 265, False: 3.85k]
  ------------------
  148|  1.40k|			case 'f':
  ------------------
  |  Branch (148:4): [True: 382, False: 3.74k]
  ------------------
  149|  1.73k|			case 'n':
  ------------------
  |  Branch (149:4): [True: 325, False: 3.79k]
  ------------------
  150|  1.77k|			case 'r':
  ------------------
  |  Branch (150:4): [True: 39, False: 4.08k]
  ------------------
  151|  2.08k|			case 't':
  ------------------
  |  Branch (151:4): [True: 309, False: 3.81k]
  ------------------
  152|  2.08k|				continue;
  153|  2.03k|			case 'u':
  ------------------
  |  Branch (153:4): [True: 2.03k, False: 2.09k]
  ------------------
  154|  2.03k|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 6, False: 2.02k]
  ------------------
  155|      6|					uc = ue;
  156|      6|					goto out;
  157|      6|				}
  158|  10.0k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 8.07k, False: 2.00k]
  ------------------
  159|  8.07k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 25, False: 8.04k]
  ------------------
  160|     25|						goto out;
  161|  2.00k|				continue;
  162|  2.00k|			default:
  ------------------
  |  Branch (162:4): [True: 11, False: 4.11k]
  ------------------
  163|     11|				goto out;
  164|  4.12k|			}
  165|    596|		case '"':
  ------------------
  |  Branch (165:3): [True: 596, False: 165k]
  ------------------
  166|    596|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|    596|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|    596|			*ucp = uc;
  168|    596|			return 1;
  169|   161k|		default:
  ------------------
  |  Branch (169:3): [True: 161k, False: 4.74k]
  ------------------
  170|   161k|			continue;
  171|   166k|		}
  172|   166k|	}
  173|    143|out:
  174|    143|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    143|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|    143|	*ucp = uc;
  176|    143|	return 0;
  177|    739|}
is_json.c:json_isxdigit:
  105|  8.07k|{
  106|  8.07k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 529, False: 7.54k]
  ------------------
  107|    529|		return 1;
  108|  7.54k|	switch (uc) {
  109|  5.85k|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 66, False: 7.47k]
  |  Branch (109:12): [True: 2.06k, False: 5.47k]
  |  Branch (109:22): [True: 1.03k, False: 6.50k]
  |  Branch (109:32): [True: 89, False: 7.45k]
  |  Branch (109:42): [True: 1.25k, False: 6.29k]
  |  Branch (109:52): [True: 1.34k, False: 6.19k]
  ------------------
  110|  7.51k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 317, False: 7.22k]
  |  Branch (110:12): [True: 638, False: 6.90k]
  |  Branch (110:22): [True: 279, False: 7.26k]
  |  Branch (110:32): [True: 171, False: 7.37k]
  |  Branch (110:42): [True: 67, False: 7.47k]
  |  Branch (110:52): [True: 191, False: 7.35k]
  ------------------
  111|  7.51k|		return 1;
  112|     25|	default:
  ------------------
  |  Branch (112:2): [True: 25, False: 7.51k]
  ------------------
  113|     25|		return 0;
  114|  7.54k|	}
  115|  7.54k|}
is_json.c:json_isdigit:
   93|   117k|{
   94|   117k|	switch (uc) {
   95|  94.0k|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 81.6k, False: 35.4k]
  |  Branch (95:12): [True: 11.1k, False: 106k]
  |  Branch (95:22): [True: 605, False: 116k]
  |  Branch (95:32): [True: 458, False: 116k]
  |  Branch (95:42): [True: 243, False: 116k]
  ------------------
   96|  95.4k|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 63, False: 117k]
  |  Branch (96:12): [True: 203, False: 116k]
  |  Branch (96:22): [True: 243, False: 116k]
  |  Branch (96:32): [True: 180, False: 116k]
  |  Branch (96:42): [True: 646, False: 116k]
  ------------------
   97|  95.4k|		return 1;
   98|  21.7k|	default:
  ------------------
  |  Branch (98:2): [True: 21.7k, False: 95.4k]
  ------------------
   99|  21.7k|		return 0;
  100|   117k|	}
  101|   117k|}
is_json.c:json_parse_array:
  182|  4.73k|{
  183|  4.73k|	const unsigned char *uc = *ucp;
  184|       |
  185|  4.73k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  4.73k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  6.69k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 6.66k, False: 32]
  ------------------
  187|  6.66k|		uc = json_skip_space(uc, ue);
  188|  6.66k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 10, False: 6.65k]
  ------------------
  189|     10|			goto out;
  190|  6.65k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 228, False: 6.42k]
  ------------------
  191|    228|			goto done;
  192|  6.42k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 4.19k, False: 2.23k]
  ------------------
  193|  4.19k|			goto out;
  194|  2.23k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 29, False: 2.20k]
  ------------------
  195|     29|			goto out;
  196|  2.20k|		switch (*uc) {
  197|  1.95k|		case ',':
  ------------------
  |  Branch (197:3): [True: 1.95k, False: 245]
  ------------------
  198|  1.95k|			uc++;
  199|  1.95k|			continue;
  200|    231|		case ']':
  ------------------
  |  Branch (200:3): [True: 231, False: 1.97k]
  ------------------
  201|    459|		done:
  202|    459|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    459|#define JSON_ARRAYN	5
  ------------------
  203|    459|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    459|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  204|    459|			*ucp = uc + 1;
  205|    459|			return 1;
  206|     14|		default:
  ------------------
  |  Branch (206:3): [True: 14, False: 2.19k]
  ------------------
  207|     14|			goto out;
  208|  2.20k|		}
  209|  2.20k|	}
  210|  4.27k|out:
  211|  4.27k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  4.27k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  212|  4.27k|	*ucp = uc;
  213|  4.27k|	return 0;
  214|  4.73k|}
is_json.c:json_parse_object:
  219|    388|{
  220|    388|	const unsigned char *uc = *ucp;
  221|    388|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    388|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  222|    471|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 465, False: 6]
  ------------------
  223|    465|		uc = json_skip_space(uc, ue);
  224|    465|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 8, False: 457]
  ------------------
  225|      8|			goto out;
  226|    457|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 32, False: 425]
  ------------------
  227|     32|			uc++;
  228|     32|			goto done;
  229|     32|		}
  230|    425|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 27, False: 398]
  ------------------
  231|     27|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     27|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|     27|			goto out;
  233|     27|		}
  234|    398|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    398|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  235|    398|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 4, False: 394]
  ------------------
  236|      4|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      4|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  237|      4|			goto out;
  238|      4|		}
  239|    394|		uc = json_skip_space(uc, ue);
  240|    394|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 5, False: 389]
  ------------------
  241|      5|			goto out;
  242|    389|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 11, False: 378]
  ------------------
  243|     11|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|     11|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  244|     11|			goto out;
  245|     11|		}
  246|    378|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 76, False: 302]
  ------------------
  247|     76|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|     76|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|     76|			goto out;
  249|     76|		}
  250|    302|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 1, False: 301]
  ------------------
  251|      1|			goto out;
  252|    301|		switch (*uc++) {
  253|     83|		case ',':
  ------------------
  |  Branch (253:3): [True: 83, False: 218]
  ------------------
  254|     83|			continue;
  255|    216|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 216, False: 85]
  ------------------
  256|    248|		done:
  257|    248|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    248|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|    248|			*ucp = uc;
  259|    248|			return 1;
  260|      2|		default:
  ------------------
  |  Branch (260:3): [True: 2, False: 299]
  ------------------
  261|      2|			DPRINTF("not more", uc, *ucp);
  ------------------
  |  |   52|      2|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  262|      2|			*ucp = uc - 1;
  263|      2|			goto out;
  264|    301|		}
  265|    301|	}
  266|    140|out:
  267|    140|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    140|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  268|    140|	*ucp = uc;
  269|    140|	return 0;
  270|    388|}
is_json.c:json_parse_const:
  328|    700|{
  329|    700|	const unsigned char *uc = *ucp;
  330|       |
  331|    700|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|    700|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  332|    700|	*ucp += --len - 1;
  333|    700|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 30, False: 670]
  ------------------
  334|     30|		*ucp = ue;
  335|  2.70k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 2.68k, False: 20]
  |  Branch (335:20): [True: 2.10k, False: 578]
  ------------------
  336|  2.10k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 102, False: 2.00k]
  ------------------
  337|    102|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|    102|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  338|    102|			return 0;
  339|    102|		}
  340|  2.10k|	}
  341|    598|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|    598|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  342|    598|	return 1;
  343|    700|}
is_json.c:json_parse_number:
  276|  6.85k|{
  277|  6.85k|	const unsigned char *uc = *ucp;
  278|  6.85k|	int got = 0;
  279|       |
  280|  6.85k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  6.85k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|  6.85k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 6.85k]
  ------------------
  282|      0|		return 0;
  283|  6.85k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 238, False: 6.61k]
  ------------------
  284|    238|		uc++;
  285|       |
  286|  99.9k|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 99.9k, False: 23]
  ------------------
  287|  99.9k|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 6.83k, False: 93.1k]
  ------------------
  288|  6.83k|			break;
  289|  93.1k|		got = 1;
  290|  93.1k|	}
  291|  6.85k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 23, False: 6.83k]
  ------------------
  292|     23|		goto out;
  293|  6.83k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 117, False: 6.71k]
  ------------------
  294|    117|		uc++;
  295|  7.14k|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 7.12k, False: 18]
  ------------------
  296|  7.12k|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 6.81k, False: 315]
  ------------------
  297|  6.81k|			break;
  298|    315|		got = 1;
  299|    315|	}
  300|  6.83k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 18, False: 6.81k]
  ------------------
  301|     18|		goto out;
  302|  6.81k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 1.35k, False: 5.46k]
  |  Branch (302:14): [True: 328, False: 1.02k]
  |  Branch (302:28): [True: 229, False: 795]
  ------------------
  303|    557|		uc++;
  304|    557|		got = 0;
  305|    557|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 8, False: 549]
  ------------------
  306|      8|			goto out;
  307|    549|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 16, False: 533]
  |  Branch (307:21): [True: 249, False: 284]
  ------------------
  308|    265|			uc++;
  309|  2.00k|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 1.98k, False: 24]
  ------------------
  310|  1.98k|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 525, False: 1.45k]
  ------------------
  311|    525|				break;
  312|  1.45k|			got = 1;
  313|  1.45k|		}
  314|    549|	}
  315|  6.85k|out:
  316|  6.85k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 5.51k, False: 1.34k]
  ------------------
  317|  5.51k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  5.51k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  1.34k|	else
  319|  1.34k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  1.34k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|  6.85k|	*ucp = uc;
  321|  6.85k|	return got;
  322|  6.81k|}

file_is_tar:
   64|  6.22k|{
   65|  6.22k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  6.22k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  6.22k|	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|  6.22k|	int tar;
   72|  6.22k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  6.22k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  6.22k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  6.22k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  6.22k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  6.22k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  6.22k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 6.22k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  6.22k|	tar = is_tar(buf, nbytes);
   78|  6.22k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 6.21k, False: 11]
  |  Branch (78:17): [True: 0, False: 11]
  ------------------
   79|  6.21k|		return 0;
   80|       |
   81|     11|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     11|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 11]
  ------------------
   82|      0|		return 1;
   83|       |
   84|     11|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 11]
  |  Branch (84:28): [True: 0, False: 11]
  ------------------
   85|     11|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|     11|	return 1;
   89|     11|}
is_tar.c:is_tar:
  100|  6.22k|{
  101|  6.22k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  6.22k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  427|  6.22k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  6.22k|	    RCAST(const void *, buf));
  105|  6.22k|	size_t i;
  106|  6.22k|	int sum, recsum;
  107|  6.22k|	const unsigned char *p, *ep;
  108|  6.22k|	const char *nulp;
  109|       |
  110|  6.22k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 4.38k, False: 1.83k]
  ------------------
  111|  4.38k|		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|  1.83k|	nulp = CAST(const char *,
  ------------------
  |  |  426|  1.83k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  1.83k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  1.83k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 1.62k, False: 209]
  |  Branch (118:22): [True: 1.39k, False: 239]
  ------------------
  119|  1.83k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 37, False: 1.35k]
  ------------------
  120|  1.39k|	    sizeof(gpkg_match)) == 0)
  121|     37|	    return 0;
  122|       |
  123|  1.80k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  1.80k|	sum = 0;
  126|  1.80k|	p = header->charptr;
  127|  1.80k|	ep = header->charptr + sizeof(*header);
  128|   923k|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 922k, False: 1.80k]
  ------------------
  129|   922k|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  16.2k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 14.4k, False: 1.80k]
  ------------------
  133|  14.4k|		sum -= header->header.chksum[i];
  134|  1.80k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  1.80k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 1.79k, False: 11]
  ------------------
  137|  1.79k|		return 0;	/* Not a tar archive */
  138|       |
  139|     11|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|     11|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 1, False: 10]
  ------------------
  140|     11|	    sizeof(header->header.magic)) == 0)
  141|      1|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|     10|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|     10|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 0, False: 10]
  ------------------
  144|     10|	    sizeof(header->header.magic)) == 0)
  145|      0|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|     10|	return 1;			/* Old fashioned tar archive */
  148|     10|}
is_tar.c:from_oct:
  158|  1.80k|{
  159|  1.80k|	int	value;
  160|       |
  161|  1.80k|	if (digs == 0)
  ------------------
  |  Branch (161:6): [True: 0, False: 1.80k]
  ------------------
  162|      0|		return -1;
  163|       |
  164|  1.80k|	while (isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  165|    542|		where++;
  166|    542|		if (digs-- == 0)
  ------------------
  |  Branch (166:7): [True: 38, False: 504]
  ------------------
  167|     38|			return -1;		/* All blank field */
  168|    542|	}
  169|  1.76k|	value = 0;
  170|  2.12k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  2.10k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 733, False: 1.36k]
  |  |  |  Branch (51:39): [True: 363, False: 370]
  |  |  ------------------
  ------------------
  |  Branch (170:9): [True: 2.10k, False: 25]
  ------------------
  171|    363|		value = (value << 3) | (*where++ - '0');
  172|    363|		digs--;
  173|    363|	}
  174|       |
  175|  1.76k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (175:6): [True: 1.73k, False: 25]
  |  Branch (175:18): [True: 1.11k, False: 620]
  |  Branch (175:28): [True: 1.11k, False: 8]
  ------------------
  176|  1.11k|		return -1;			/* Ended on non-(space/NUL) */
  177|       |
  178|    653|	return value;
  179|  1.76k|}

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_buffer:
  550|  5.87k|{
  551|  5.87k|	if (ms == NULL)
  ------------------
  |  Branch (551:6): [True: 0, False: 5.87k]
  ------------------
  552|      0|		return NULL;
  553|  5.87k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (553:6): [True: 0, False: 5.87k]
  ------------------
  554|      0|		return NULL;
  555|       |	/*
  556|       |	 * The main work is done here!
  557|       |	 * We have the file name and/or the data buffer to be identified.
  558|       |	 */
  559|  5.87k|	if (file_buffer(ms, -1, NULL, NULL, buf, nb) == -1) {
  ------------------
  |  Branch (559:6): [True: 73, False: 5.80k]
  ------------------
  560|     73|		return NULL;
  561|     73|	}
  562|  5.80k|	return file_getbuffer(ms);
  563|  5.87k|}
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|}

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

file_trycdf:
  542|  6.22k|{
  543|  6.22k|	int fd = b->fd;
  544|  6.22k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  426|  6.22k|#define CAST(T, b)	((T)(b))
  ------------------
  545|  6.22k|	size_t nbytes = b->flen;
  546|  6.22k|	cdf_info_t info;
  547|  6.22k|	cdf_header_t h;
  548|  6.22k|	cdf_sat_t sat, ssat;
  549|  6.22k|	cdf_stream_t sst, scn;
  550|  6.22k|	cdf_dir_t dir;
  551|  6.22k|	int i;
  552|  6.22k|	const char *expn = "";
  553|  6.22k|	const cdf_directory_t *root_storage;
  554|       |
  555|  6.22k|	scn.sst_tab = NULL;
  556|  6.22k|	info.i_fd = fd;
  557|  6.22k|	info.i_buf = buf;
  558|  6.22k|	info.i_len = nbytes;
  559|  6.22k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  6.22k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  6.22k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (559:6): [True: 0, False: 6.22k]
  ------------------
  560|      0|		return 0;
  561|  6.22k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (561:6): [True: 5.02k, False: 1.20k]
  ------------------
  562|  5.02k|		return 0;
  563|       |#ifdef CDF_DEBUG
  564|       |	cdf_dump_header(&h);
  565|       |#endif
  566|       |
  567|  1.20k|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (567:6): [True: 129, False: 1.07k]
  ------------------
  568|    129|		expn = "Can't read SAT";
  569|    129|		goto out0;
  570|    129|	}
  571|       |#ifdef CDF_DEBUG
  572|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  573|       |#endif
  574|       |
  575|  1.07k|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (575:6): [True: 136, False: 935]
  ------------------
  576|    136|		expn = "Can't read SSAT";
  577|    136|		goto out1;
  578|    136|	}
  579|       |#ifdef CDF_DEBUG
  580|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  581|       |#endif
  582|       |
  583|    935|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (583:6): [True: 73, False: 862]
  ------------------
  584|     73|		expn = "Can't read directory";
  585|     73|		goto out2;
  586|     73|	}
  587|       |
  588|    862|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (588:6): [True: 53, False: 809]
  ------------------
  589|    862|	    &root_storage)) == -1) {
  590|     53|		expn = "Cannot read short stream";
  591|     53|		goto out3;
  592|     53|	}
  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|    809|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (608:6): [True: 44, False: 765]
  ------------------
  609|    809|	    "FileHeader", &scn) != -1) {
  610|     44|#define HWP5_SIGNATURE "HWP Document File"
  611|     44|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  610|     44|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (611:7): [True: 41, False: 3]
  ------------------
  612|     44|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  610|     41|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (612:10): [True: 1, False: 40]
  ------------------
  613|     41|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  610|     41|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  614|      1|		    if (NOTMIME(ms)) {
  ------------------
  |  |   42|      1|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      1|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      1|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      1|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  615|      1|			if (file_printf(ms,
  ------------------
  |  Branch (615:8): [True: 0, False: 1]
  ------------------
  616|      1|			    "Hangul (Korean) Word Processor File 5.x") == -1)
  617|      0|			    return -1;
  618|      1|		    } 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|      1|		    i = 1;
  623|      1|		    goto out5;
  624|     43|		} else {
  625|     43|		    cdf_zero_stream(&scn);
  626|     43|		}
  627|     44|	}
  628|       |
  629|    808|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (629:6): [True: 285, False: 523]
  ------------------
  630|    808|	    &scn)) == -1) {
  631|    285|		if (errno != ESRCH) {
  ------------------
  |  Branch (631:7): [True: 94, False: 191]
  ------------------
  632|     94|			expn = "Cannot read summary info";
  633|     94|		}
  634|    523|	} else {
  635|    523|		i = cdf_check_summary_info(ms, &info, &h,
  636|    523|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  637|    523|		cdf_zero_stream(&scn);
  638|    523|	}
  639|    808|	if (i <= 0) {
  ------------------
  |  Branch (639:6): [True: 764, False: 44]
  ------------------
  640|    764|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (640:7): [True: 645, False: 119]
  ------------------
  641|    764|		    &sst, &dir, &scn)) == -1) {
  642|    645|			if (errno != ESRCH) {
  ------------------
  |  Branch (642:8): [True: 45, False: 600]
  ------------------
  643|     45|				expn = "Cannot read summary info";
  644|     45|			}
  645|    645|		} else {
  646|    119|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  647|    119|			    &sst, &dir, &scn, root_storage, &expn);
  648|    119|		}
  649|    764|	}
  650|    808|	if (i <= 0) {
  ------------------
  |  Branch (650:6): [True: 763, False: 45]
  ------------------
  651|    763|		i = cdf_file_dir_info(ms, &dir);
  652|    763|		if (i < 0)
  ------------------
  |  Branch (652:7): [True: 750, False: 13]
  ------------------
  653|    750|			expn = "Cannot read section info";
  654|    763|	}
  655|    809|out5:
  656|    809|	cdf_zero_stream(&scn);
  657|    809|	cdf_zero_stream(&sst);
  658|    862|out3:
  659|    862|	free(dir.dir_tab);
  660|    935|out2:
  661|    935|	free(ssat.sat_tab);
  662|  1.07k|out1:
  663|  1.07k|	free(sat.sat_tab);
  664|  1.20k|out0:
  665|       |	/* If we handled it already, return */
  666|  1.20k|	if (i != -1)
  ------------------
  |  Branch (666:6): [True: 59, False: 1.14k]
  ------------------
  667|     59|		return i;
  668|       |	/* Provide a default handler */
  669|  1.14k|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|  1.14k|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|  1.14k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.14k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.14k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1.14k, False: 0]
  |  |  ------------------
  ------------------
  670|  1.14k|		if (file_printf(ms,
  ------------------
  |  Branch (670:7): [True: 0, False: 1.14k]
  ------------------
  671|  1.14k|		    "Composite Document File V2 Document") == -1)
  672|      0|			return -1;
  673|  1.14k|		if (*expn)
  ------------------
  |  Branch (673:7): [True: 1.14k, False: 0]
  ------------------
  674|  1.14k|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (674:8): [True: 0, False: 1.14k]
  ------------------
  675|      0|				return -1;
  676|  1.14k|	} 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|  1.14k|	return 1;
  682|  1.14k|}
readcdf.c:cdf_check_summary_info:
  391|    642|{
  392|    642|	int i;
  393|    642|	const char *str = NULL;
  394|    642|	cdf_directory_t *d;
  395|    642|	char name[__arraycount(d->d_name)];
  396|    642|	size_t j, k;
  397|       |
  398|       |#ifdef CDF_DEBUG
  399|       |	cdf_dump_summary_info(h, scn);
  400|       |#endif
  401|    642|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (401:6): [True: 597, False: 45]
  ------------------
  402|    597|	    *expn = "Can't expand summary_info";
  403|    597|	    return i;
  404|    597|	}
  405|     45|	if (i == 1)
  ------------------
  |  Branch (405:6): [True: 45, False: 0]
  ------------------
  406|     45|		return i;
  407|      0|	for (j = 0; str == NULL && j < dir->dir_len; j++) {
  ------------------
  |  Branch (407:14): [True: 0, False: 0]
  |  Branch (407:29): [True: 0, False: 0]
  ------------------
  408|      0|		d = &dir->dir_tab[j];
  409|      0|		for (k = 0; k < sizeof(name); k++)
  ------------------
  |  Branch (409:15): [True: 0, False: 0]
  ------------------
  410|      0|			name[k] = CAST(char, cdf_tole2(d->d_name[k]));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  411|      0|		str = cdf_app_to_mime(name,
  412|      0|				      NOTMIME(ms) ? name2desc : name2mime);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  413|      0|	}
  414|      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]
  |  |  ------------------
  ------------------
  415|      0|		if (str != NULL) {
  ------------------
  |  Branch (415:7): [True: 0, False: 0]
  ------------------
  416|      0|			if (file_printf(ms, "%s", str) == -1)
  ------------------
  |  Branch (416:8): [True: 0, False: 0]
  ------------------
  417|      0|				return -1;
  418|      0|			i = 1;
  419|      0|		}
  420|      0|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (420:13): [True: 0, False: 0]
  ------------------
  421|      0|		if (str == NULL)
  ------------------
  |  Branch (421:7): [True: 0, False: 0]
  ------------------
  422|      0|			str = "vnd.ms-office";
  423|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (423:7): [True: 0, False: 0]
  ------------------
  424|      0|			return -1;
  425|      0|		i = 1;
  426|      0|	}
  427|      0|	if (i <= 0) {
  ------------------
  |  Branch (427:6): [True: 0, False: 0]
  ------------------
  428|      0|		i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst,
  429|      0|					  dir, scn);
  430|      0|	}
  431|      0|	return i;
  432|      0|}
readcdf.c:cdf_file_summary_info:
  299|    642|{
  300|    642|	cdf_summary_info_header_t si;
  301|    642|	cdf_property_info_t *info;
  302|    642|	size_t count;
  303|    642|	int m;
  304|       |
  305|    642|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (305:6): [True: 401, False: 241]
  ------------------
  306|    401|		return -1;
  307|       |
  308|    241|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|    241|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    241|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    241|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    241|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 241, False: 0]
  |  |  ------------------
  ------------------
  309|    241|		const char *str;
  310|       |
  311|    241|		if (file_printf(ms, "Composite Document File V2 Document")
  ------------------
  |  Branch (311:7): [True: 0, False: 241]
  ------------------
  312|    241|		    == -1)
  313|      0|			return -1;
  314|       |
  315|    241|		if (file_printf(ms, ", %s Endian",
  ------------------
  |  Branch (315:7): [True: 0, False: 241]
  ------------------
  316|    241|		    si.si_byte_order == 0xfffe ?  "Little" : "Big") == -1)
  ------------------
  |  Branch (316:7): [True: 13, False: 228]
  ------------------
  317|      0|			return -2;
  318|    241|		switch (si.si_os) {
  319|      5|		case 2:
  ------------------
  |  Branch (319:3): [True: 5, False: 236]
  ------------------
  320|      5|			if (file_printf(ms, ", Os: Windows, Version %d.%d",
  ------------------
  |  Branch (320:8): [True: 0, False: 5]
  ------------------
  321|      5|			    si.si_os_version & 0xff,
  322|      5|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  426|      5|#define CAST(T, b)	((T)(b))
  ------------------
  323|      0|				return -2;
  324|      5|			break;
  325|     10|		case 1:
  ------------------
  |  Branch (325:3): [True: 10, False: 231]
  ------------------
  326|     10|			if (file_printf(ms, ", Os: MacOS, Version %d.%d",
  ------------------
  |  Branch (326:8): [True: 0, False: 10]
  ------------------
  327|     10|			    CAST(uint32_t, si.si_os_version) >> 8,
  ------------------
  |  |  426|     10|#define CAST(T, b)	((T)(b))
  ------------------
  328|     10|			    si.si_os_version & 0xff) == -1)
  329|      0|				return -2;
  330|     10|			break;
  331|    226|		default:
  ------------------
  |  Branch (331:3): [True: 226, False: 15]
  ------------------
  332|    226|			if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
  ------------------
  |  Branch (332:8): [True: 0, False: 226]
  ------------------
  333|    226|			    si.si_os_version & 0xff,
  334|    226|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  426|    226|#define CAST(T, b)	((T)(b))
  ------------------
  335|      0|				return -2;
  336|    226|			break;
  337|    241|		}
  338|    241|		if (root_storage) {
  ------------------
  |  Branch (338:7): [True: 101, False: 140]
  ------------------
  339|    101|			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  340|    101|			    clsid2desc);
  341|    101|			if (str) {
  ------------------
  |  Branch (341:8): [True: 2, False: 99]
  ------------------
  342|      2|				if (file_printf(ms, ", %s", str) == -1)
  ------------------
  |  Branch (342:9): [True: 0, False: 2]
  ------------------
  343|      0|					return -2;
  344|      2|			}
  345|    101|		}
  346|    241|	}
  347|       |
  348|    241|	m = cdf_file_property_info(ms, info, count, root_storage);
  349|    241|	free(info);
  350|       |
  351|    241|	return m == -1 ? -2 : m;
  ------------------
  |  Branch (351:9): [True: 196, False: 45]
  ------------------
  352|    241|}
readcdf.c:cdf_clsid_to_mime:
   97|    101|{
   98|    101|	size_t i;
   99|    200|	for (i = 0; cv[i].mime != NULL; i++) {
  ------------------
  |  Branch (99:14): [True: 101, False: 99]
  ------------------
  100|    101|		if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
  ------------------
  |  Branch (100:7): [True: 34, False: 67]
  |  Branch (100:37): [True: 2, False: 32]
  ------------------
  101|      2|			return cv[i].mime;
  102|    101|	}
  103|       |#ifdef CDF_DEBUG
  104|       |	fprintf(stderr, "unknown mime %" PRIx64 ", %" PRIx64 "\n", clsid[0],
  105|       |	    clsid[1]);
  106|       |#endif
  107|     99|	return NULL;
  108|    101|}
readcdf.c:cdf_file_property_info:
  150|    241|{
  151|    241|	size_t i;
  152|    241|	cdf_timestamp_t tp;
  153|    241|	struct timespec ts;
  154|    241|	char buf[64];
  155|    241|	const char *str = NULL;
  156|    241|	const char *s, *e;
  157|    241|	int len;
  158|       |
  159|    241|	if (!NOTMIME(ms) && root_storage)
  ------------------
  |  |   42|    482|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    241|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    241|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    241|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (159:6): [True: 0, False: 241]
  |  Branch (159:22): [True: 0, False: 0]
  ------------------
  160|      0|		str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  161|      0|		    clsid2mime);
  162|       |
  163|  1.02k|	for (i = 0; i < count; i++) {
  ------------------
  |  Branch (163:14): [True: 979, False: 45]
  ------------------
  164|    979|		cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
  165|    979|		switch (info[i].pi_type) {
  166|     18|		case CDF_NULL:
  ------------------
  |  |  198|     18|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (166:3): [True: 18, False: 961]
  ------------------
  167|     18|			break;
  168|     58|		case CDF_SIGNED16:
  ------------------
  |  |  199|     58|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (168:3): [True: 58, False: 921]
  ------------------
  169|     58|			if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
  ------------------
  |  |   42|    116|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     58|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     58|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     58|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 58, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (169:23): [True: 0, False: 58]
  ------------------
  170|     58|			    info[i].pi_s16) == -1)
  ------------------
  |  |  187|     58|#define pi_s16	pi_val._pi_s16
  ------------------
  171|      0|				return -1;
  172|     58|			break;
  173|     66|		case CDF_SIGNED32:
  ------------------
  |  |  200|     66|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (173:3): [True: 66, False: 913]
  ------------------
  174|     66|			if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
  ------------------
  |  |   42|    132|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     66|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     66|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     66|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 66, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (174:23): [True: 0, False: 66]
  ------------------
  175|     66|			    info[i].pi_s32) == -1)
  ------------------
  |  |  185|     66|#define pi_s32	pi_val._pi_s32
  ------------------
  176|      0|				return -1;
  177|     66|			break;
  178|     66|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|     31|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (178:3): [True: 31, False: 948]
  ------------------
  179|     31|			if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
  ------------------
  |  |   42|     62|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     31|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     31|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     31|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 31, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (179:23): [True: 0, False: 31]
  ------------------
  180|     31|			    info[i].pi_u32) == -1)
  ------------------
  |  |  184|     31|#define pi_u32	pi_val._pi_u32
  ------------------
  181|      0|				return -1;
  182|     31|			break;
  183|     98|		case CDF_FLOAT:
  ------------------
  |  |  201|     98|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (183:3): [True: 98, False: 881]
  ------------------
  184|     98|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    196|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     98|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     98|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     98|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 98, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (184:23): [True: 0, False: 98]
  ------------------
  185|     98|			    info[i].pi_f) == -1)
  ------------------
  |  |  188|     98|#define pi_f	pi_val._pi_f
  ------------------
  186|      0|				return -1;
  187|     98|			break;
  188|     98|		case CDF_DOUBLE:
  ------------------
  |  |  202|     54|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (188:3): [True: 54, False: 925]
  ------------------
  189|     54|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    108|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     54|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     54|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     54|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 54, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (189:23): [True: 0, False: 54]
  ------------------
  190|     54|			    info[i].pi_d) == -1)
  ------------------
  |  |  189|     54|#define pi_d	pi_val._pi_d
  ------------------
  191|      0|				return -1;
  192|     54|			break;
  193|     59|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|     59|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (193:3): [True: 59, False: 920]
  ------------------
  194|    167|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    167|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (194:3): [True: 108, False: 871]
  ------------------
  195|    167|			len = info[i].pi_str.s_len;
  ------------------
  |  |  191|    167|#define pi_str	pi_val._pi_str
  ------------------
  196|    167|			if (len > 1) {
  ------------------
  |  Branch (196:8): [True: 131, False: 36]
  ------------------
  197|    131|				char vbuf[1024];
  198|    131|				size_t j, k = 1;
  199|       |
  200|    131|				if (info[i].pi_type == CDF_LENGTH32_WSTRING)
  ------------------
  |  |  227|    131|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (200:9): [True: 100, False: 31]
  ------------------
  201|    100|				    k++;
  202|    131|				s = info[i].pi_str.s_buf;
  ------------------
  |  |  191|    131|#define pi_str	pi_val._pi_str
  ------------------
  203|    131|				e = info[i].pi_str.s_buf + len;
  ------------------
  |  |  191|    131|#define pi_str	pi_val._pi_str
  ------------------
  204|  22.9k|				for (j = 0; s < e && j < sizeof(vbuf)
  ------------------
  |  Branch (204:17): [True: 22.9k, False: 29]
  |  Branch (204:26): [True: 22.9k, False: 7]
  ------------------
  205|  22.9k|				    && len--; s += k) {
  ------------------
  |  Branch (205:12): [True: 22.9k, False: 0]
  ------------------
  206|  22.9k|					if (*s == '\0')
  ------------------
  |  Branch (206:10): [True: 95, False: 22.8k]
  ------------------
  207|     95|						break;
  208|  22.8k|					if (isprint(CAST(unsigned char, *s)))
  209|  19.4k|						vbuf[j++] = *s;
  210|  22.8k|				}
  211|    131|				if (j == sizeof(vbuf))
  ------------------
  |  Branch (211:9): [True: 7, False: 124]
  ------------------
  212|      7|					--j;
  213|    131|				vbuf[j] = '\0';
  214|    131|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|    131|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    131|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    131|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    131|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 131, False: 0]
  |  |  ------------------
  ------------------
  215|    131|					if (vbuf[0]) {
  ------------------
  |  Branch (215:10): [True: 81, False: 50]
  ------------------
  216|     81|						if (file_printf(ms, ", %s: %s",
  ------------------
  |  Branch (216:11): [True: 7, False: 74]
  ------------------
  217|     81|						    buf, vbuf) == -1)
  218|      7|							return -1;
  219|     81|					}
  220|    131|				} else if (str == NULL && info[i].pi_id ==
  ------------------
  |  Branch (220:16): [True: 0, False: 0]
  |  Branch (220:31): [True: 0, False: 0]
  ------------------
  221|      0|				    CDF_PROPERTY_NAME_OF_APPLICATION) {
  ------------------
  |  |  262|      0|#define CDF_PROPERTY_NAME_OF_APPLICATION	0x00000012
  ------------------
  222|      0|					str = cdf_app_to_mime(vbuf, app2mime);
  223|      0|				}
  224|    131|			}
  225|    160|			break;
  226|    292|		case CDF_FILETIME:
  ------------------
  |  |  228|    292|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (226:3): [True: 292, False: 687]
  ------------------
  227|    292|			tp = info[i].pi_tp;
  ------------------
  |  |  190|    292|#define pi_tp	pi_val._pi_tp
  ------------------
  228|    292|			if (tp != 0) {
  ------------------
  |  Branch (228:8): [True: 269, False: 23]
  ------------------
  229|    269|				char tbuf[64];
  230|    269|				if (tp < 1000000000000000LL) {
  ------------------
  |  Branch (230:9): [True: 161, False: 108]
  ------------------
  231|    161|					cdf_print_elapsed_time(tbuf,
  232|    161|					    sizeof(tbuf), tp);
  233|    161|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    322|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    161|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    161|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    161|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 161, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (233:25): [True: 0, False: 161]
  ------------------
  234|    161|					    ", %s: %s", buf, tbuf) == -1)
  235|      0|						return -1;
  236|    161|				} else {
  237|    108|					char *c, *ec;
  238|    108|					cdf_timestamp_to_timespec(&ts, tp);
  239|    108|					c = cdf_ctime(&ts.tv_sec, tbuf);
  240|    108|					if (c != NULL &&
  ------------------
  |  Branch (240:10): [True: 108, False: 0]
  ------------------
  241|    108|					    (ec = strchr(c, '\n')) != NULL)
  ------------------
  |  Branch (241:10): [True: 108, False: 0]
  ------------------
  242|    108|						*ec = '\0';
  243|       |
  244|    108|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    216|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    108|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    108|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    108|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 108, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (244:25): [True: 0, False: 108]
  ------------------
  245|    108|					    ", %s: %s", buf, c) == -1)
  246|      0|						return -1;
  247|    108|				}
  248|    269|			}
  249|    292|			break;
  250|    292|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|      6|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (250:3): [True: 6, False: 973]
  ------------------
  251|      6|			break;
  252|    189|		default:
  ------------------
  |  Branch (252:3): [True: 189, False: 790]
  ------------------
  253|    189|			return -1;
  254|    979|		}
  255|    979|	}
  256|     45|	if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|     45|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (256:6): [True: 0, False: 45]
  ------------------
  257|      0|		if (str == NULL)
  ------------------
  |  Branch (257:7): [True: 0, False: 0]
  ------------------
  258|      0|			return 0;
  259|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (259:7): [True: 0, False: 0]
  ------------------
  260|      0|			return -1;
  261|      0|	}
  262|     45|	return 1;
  263|     45|}
readcdf.c:cdf_file_dir_info:
  513|    763|{
  514|    763|	size_t sd, j;
  515|       |
  516|  5.30k|	for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  123|  5.30k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (516:15): [True: 4.55k, False: 750]
  ------------------
  517|  4.55k|		const struct sinfo *si = &sectioninfo[sd];
  518|  11.3k|		for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (518:15): [True: 6.82k, False: 4.54k]
  ------------------
  519|  6.82k|			if (cdf_find_stream(dir, si->sections[j], si->types[j])
  ------------------
  |  Branch (519:8): [True: 13, False: 6.81k]
  ------------------
  520|  6.82k|			    > 0)
  521|     13|				break;
  522|       |#ifdef CDF_DEBUG
  523|       |			fprintf(stderr, "Can't read %s\n", si->sections[j]);
  524|       |#endif
  525|  6.82k|		}
  526|  4.55k|		if (si->sections[j] == NULL)
  ------------------
  |  Branch (526:7): [True: 4.54k, False: 13]
  ------------------
  527|  4.54k|			continue;
  528|     13|		if (NOTMIME(ms)) {
  ------------------
  |  |   42|     13|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     13|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     13|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     13|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 13, False: 0]
  |  |  ------------------
  ------------------
  529|     13|			if (file_printf(ms, "CDFV2 %s", si->name) == -1)
  ------------------
  |  Branch (529:8): [True: 0, False: 13]
  ------------------
  530|      0|				return -1;
  531|     13|		} 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|     13|		return 1;
  536|     13|	}
  537|    750|	return -1;
  538|    763|}

file_softmagic:
  119|  7.94k|{
  120|  7.94k|	struct mlist *ml;
  121|  7.94k|	int rv = 0, printed_something = 0, need_separator = 0;
  122|  7.94k|	uint16_t nc, ic;
  123|       |
  124|  7.94k|	if (name_count == NULL) {
  ------------------
  |  Branch (124:6): [True: 7.94k, False: 0]
  ------------------
  125|  7.94k|		nc = 0;
  126|  7.94k|		name_count = &nc;
  127|  7.94k|	}
  128|  7.94k|	if (indir_count == NULL) {
  ------------------
  |  Branch (128:6): [True: 7.94k, False: 0]
  ------------------
  129|  7.94k|		ic = 0;
  130|  7.94k|		indir_count = &ic;
  131|  7.94k|	}
  132|       |
  133|  15.7k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (133:32): [True: 7.94k, False: 7.82k]
  ------------------
  134|  7.94k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  135|  7.94k|		    0, mode, text, 0, indir_count, name_count,
  136|  7.94k|		    &printed_something, &need_separator, NULL, NULL);
  137|  7.94k|		switch (ret) {
  138|    125|		case -1:
  ------------------
  |  Branch (138:3): [True: 125, False: 7.82k]
  ------------------
  139|    125|			return ret;
  140|  3.86k|		case 0:
  ------------------
  |  Branch (140:3): [True: 3.86k, False: 4.07k]
  ------------------
  141|  3.86k|			continue;
  142|  3.95k|		default:
  ------------------
  |  Branch (142:3): [True: 3.95k, False: 3.99k]
  ------------------
  143|  3.95k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  3.95k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (143:8): [True: 0, False: 3.95k]
  ------------------
  144|      0|				return ret;
  145|  3.95k|			rv = ret;
  146|  3.95k|			break;
  147|  7.94k|		}
  148|  7.94k|	}
  149|       |
  150|  7.82k|	return rv;
  151|  7.94k|}
softmagic.c:match:
  210|  71.2k|{
  211|  71.2k|	uint32_t magindex = 0;
  212|  71.2k|	unsigned int cont_level = 0;
  213|  71.2k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  214|  71.2k|	int returnvalv = 0, e;
  215|       |	/* a flag to print X\n  X\n- X */
  216|  71.2k|	int firstline = !(*printed_something || *need_separator);
  ------------------
  |  Branch (216:20): [True: 43.7k, False: 27.5k]
  |  Branch (216:42): [True: 5.21k, False: 22.3k]
  ------------------
  217|  71.2k|	struct buffer bb;
  218|  71.2k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  71.2k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  71.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  71.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  71.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  71.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  71.2k|#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|  71.2k|	if (returnval == NULL)
  ------------------
  |  Branch (224:6): [True: 21.7k, False: 49.4k]
  ------------------
  225|  21.7k|		returnval = &returnvalv;
  226|  71.2k|	if (found_match == NULL)
  ------------------
  |  Branch (226:6): [True: 21.7k, False: 49.4k]
  ------------------
  227|  21.7k|		found_match = &found_matchv;
  228|       |
  229|  71.2k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (229:6): [True: 0, False: 71.2k]
  ------------------
  230|      0|		return -1;
  231|       |
  232|  72.9M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (232:21): [True: 72.9M, False: 69.8k]
  ------------------
  233|  72.9M|		int flush = 0;
  234|  72.9M|		struct magic *m = &magic[magindex];
  235|  72.9M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  236|       |
  237|  72.9M|		if (m->type != FILE_NAME)
  ------------------
  |  |  267|  72.9M|#define				FILE_NAME		45
  ------------------
  |  Branch (237:7): [True: 72.8M, False: 49.4k]
  ------------------
  238|  72.8M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  285|   145M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  227|   145M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (285:3): [True: 44.9M, False: 27.9M]
  |  |  ------------------
  |  |  286|  72.8M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  235|   100M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (286:3): [True: 21.7k, False: 27.9M]
  |  |  ------------------
  |  |  287|  72.8M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  240|   100M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (287:3): [True: 0, False: 27.9M]
  |  |  ------------------
  |  |  288|  72.8M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  241|   100M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (288:3): [True: 42.7k, False: 27.8M]
  |  |  ------------------
  |  |  289|  72.8M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  239|   100M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (289:3): [True: 1.28M, False: 26.5M]
  |  |  ------------------
  |  |  290|  72.8M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  242|  99.4M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (290:3): [True: 5.12M, False: 21.4M]
  |  |  ------------------
  |  |  291|  72.8M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  263|  94.3M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (291:3): [True: 0, False: 21.4M]
  |  |  ------------------
  |  |  292|  72.8M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  267|  94.3M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (292:3): [True: 0, False: 21.4M]
  |  |  ------------------
  |  |  293|  72.8M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  268|  94.3M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (293:3): [True: 0, False: 21.4M]
  |  |  ------------------
  |  |  294|   145M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  281|  21.4M|#define				FILE_OCTAL		59
  |  |  ------------------
  |  |  |  Branch (294:3): [True: 0, False: 21.4M]
  |  |  ------------------
  ------------------
  239|  72.8M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  240|  72.8M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  357|  8.12M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  239|  8.12M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  377|  8.12M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  8.12M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  376|  8.12M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  8.12M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  377|  8.12M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  370|  8.12M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (240:10): [True: 8.12M, False: 43.2M]
  |  Branch (240:18): [True: 334k, False: 7.79M]
  ------------------
  241|  51.4M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  357|  43.2M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  239|  43.2M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  377|  43.2M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  43.2M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  376|  43.2M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|  43.2M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  376|  43.2M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  370|  43.2M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (241:10): [True: 43.2M, False: 7.79M]
  |  Branch (241:19): [True: 1.95M, False: 41.3M]
  ------------------
  242|  72.8M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (242:7): [True: 10.4M, False: 60.1M]
  ------------------
  243|  72.7M|flush:
  244|       |			/* Skip sub-tests */
  245|   324M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (245:11): [True: 324M, False: 19.3k]
  ------------------
  246|   324M|			    magic[magindex + 1].cont_level != 0)
  ------------------
  |  Branch (246:8): [True: 252M, False: 72.6M]
  ------------------
  247|   252M|				magindex++;
  248|  72.7M|			cont_level = 0;
  249|  72.7M|			continue; /* Skip to next top-level test*/
  250|  12.7M|		}
  251|       |
  252|  60.2M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (252:7): [True: 97.3k, False: 60.1M]
  ------------------
  253|  97.3k|			goto flush;
  254|  60.1M|		ms->line = m->lineno;
  255|       |
  256|       |		/* if main entry matches, print it... */
  257|  60.1M|		switch (mget(ms, m, b, CAST(const unsigned char *, bb.fbuf),
  ------------------
  |  |  426|  60.1M|#define CAST(T, b)	((T)(b))
  ------------------
  258|  60.1M|		    bb.flen, offset, cont_level,
  259|  60.1M|		    mode, text, flip, indir_count, name_count,
  260|  60.1M|		    printed_something, need_separator, returnval, found_match))
  261|  60.1M|		{
  262|     55|		case -1:
  ------------------
  |  Branch (262:3): [True: 55, False: 60.1M]
  ------------------
  263|     55|			return -1;
  264|  8.09M|		case 0:
  ------------------
  |  Branch (264:3): [True: 8.09M, False: 52.0M]
  ------------------
  265|  8.09M|			flush = m->reln != '!';
  266|  8.09M|			break;
  267|  52.0M|		default:
  ------------------
  |  Branch (267:3): [True: 52.0M, False: 8.09M]
  ------------------
  268|  52.0M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  263|  52.0M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (268:8): [True: 0, False: 52.0M]
  ------------------
  269|      0|				*found_match = 1;
  270|      0|				*returnval = 1;
  271|      0|			}
  272|       |
  273|  52.0M|			switch (magiccheck(ms, m, m_rxcomp)) {
  274|      0|			case -1:
  ------------------
  |  Branch (274:4): [True: 0, False: 52.0M]
  ------------------
  275|      0|				return -1;
  276|  51.7M|			case 0:
  ------------------
  |  Branch (276:4): [True: 51.7M, False: 233k]
  ------------------
  277|  51.7M|				flush++;
  278|  51.7M|				break;
  279|   233k|			default:
  ------------------
  |  Branch (279:4): [True: 233k, False: 51.7M]
  ------------------
  280|   233k|				flush = 0;
  281|   233k|				break;
  282|  52.0M|			}
  283|  52.0M|			break;
  284|  60.1M|		}
  285|  60.1M|		if (flush) {
  ------------------
  |  Branch (285:7): [True: 59.8M, False: 233k]
  ------------------
  286|       |			/*
  287|       |			 * main entry didn't match,
  288|       |			 * flush its continuations
  289|       |			 */
  290|  59.8M|			goto flush;
  291|  59.8M|		}
  292|       |
  293|   233k|		if ((e = handle_annotation(ms, m, firstline)) != 0)
  ------------------
  |  Branch (293:7): [True: 0, False: 233k]
  ------------------
  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|   233k|		if (*m->desc) {
  ------------------
  |  Branch (306:7): [True: 24.6k, False: 209k]
  ------------------
  307|  24.6k|			*found_match = 1;
  308|  24.6k|			if (print) {
  ------------------
  |  Branch (308:8): [True: 24.6k, False: 0]
  ------------------
  309|  24.6k|				*returnval = 1;
  310|  24.6k|				*need_separator = 1;
  311|  24.6k|				*printed_something = 1;
  312|  24.6k|				if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (312:9): [True: 0, False: 24.6k]
  ------------------
  313|      0|					return -1;
  314|  24.6k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (314:9): [True: 0, False: 24.6k]
  ------------------
  315|      0|					return -1;
  316|  24.6k|			}
  317|  24.6k|		}
  318|       |
  319|   233k|		switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
  320|  16.6k|		case -1:
  ------------------
  |  Branch (320:3): [True: 16.6k, False: 217k]
  ------------------
  321|  16.6k|		case 0:
  ------------------
  |  Branch (321:3): [True: 0, False: 233k]
  ------------------
  322|  16.6k|			goto flush;
  323|   217k|		default:
  ------------------
  |  Branch (323:3): [True: 217k, False: 16.6k]
  ------------------
  324|   217k|			break;
  325|   233k|		}
  326|       |
  327|       |		/* and any continuations that match */
  328|   217k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (328:7): [True: 0, False: 217k]
  ------------------
  329|      0|			return -1;
  330|       |
  331|  6.15M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (331:10): [True: 6.10M, False: 50.4k]
  ------------------
  332|  6.15M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (332:7): [True: 5.94M, False: 164k]
  ------------------
  333|  5.94M|			m = &magic[++magindex];
  334|  5.94M|			m_rxcomp = &magic_rxcomp[magindex];
  335|  5.94M|			ms->line = m->lineno; /* for messages */
  336|       |
  337|  5.94M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (337:8): [True: 5.06M, False: 873k]
  ------------------
  338|  5.06M|				continue;
  339|   873k|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (339:8): [True: 86.3k, False: 787k]
  ------------------
  340|       |				/*
  341|       |				 * We're at the end of the level
  342|       |				 * "cont_level" continuations.
  343|       |				 */
  344|  86.3k|				cont_level = m->cont_level;
  345|  86.3k|			}
  346|   873k|			if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (346:8): [True: 487, False: 873k]
  ------------------
  347|    487|				goto flush;
  348|   873k|			if (m->flag & OFFADD) {
  ------------------
  |  |  206|   873k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (348:8): [True: 84.0k, False: 789k]
  ------------------
  349|  84.0k|				if (cont_level == 0) {
  ------------------
  |  Branch (349:9): [True: 0, False: 84.0k]
  ------------------
  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|  84.0k|				ms->offset +=
  357|  84.0k|				    ms->c.li[cont_level - 1].off;
  358|  84.0k|			}
  359|       |
  360|   873k|#ifdef ENABLE_CONDITIONALS
  361|   873k|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  338|  1.74M|#define				COND_ELSE	3
  ------------------
  |  Branch (361:8): [True: 0, False: 873k]
  ------------------
  362|   873k|			    m->cond == COND_ELIF) {
  ------------------
  |  |  337|   873k|#define				COND_ELIF	2
  ------------------
  |  Branch (362:8): [True: 0, False: 873k]
  ------------------
  363|      0|				if (ms->c.li[cont_level].last_match == 1)
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  ------------------
  364|      0|					continue;
  365|      0|			}
  366|   873k|#endif
  367|   873k|			switch (mget(ms, m, b, CAST(const unsigned char *,
  ------------------
  |  |  426|   873k|#define CAST(T, b)	((T)(b))
  ------------------
  368|   873k|			    bb.fbuf), bb.flen, offset,
  369|   873k|			    cont_level, mode, text, flip, indir_count,
  370|   873k|			    name_count, printed_something, need_separator,
  371|   873k|			    returnval, found_match)) {
  372|  1.34k|			case -1:
  ------------------
  |  Branch (372:4): [True: 1.34k, False: 872k]
  ------------------
  373|  1.34k|				return -1;
  374|  59.8k|			case 0:
  ------------------
  |  Branch (374:4): [True: 59.8k, False: 813k]
  ------------------
  375|  59.8k|				if (m->reln != '!')
  ------------------
  |  Branch (375:9): [True: 58.3k, False: 1.45k]
  ------------------
  376|  58.3k|					continue;
  377|  1.45k|				flush = 1;
  378|  1.45k|				break;
  379|   812k|			default:
  ------------------
  |  Branch (379:4): [True: 812k, False: 61.1k]
  ------------------
  380|   812k|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  263|   812k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (380:9): [True: 10.3k, False: 801k]
  ------------------
  381|  10.3k|					*found_match = 1;
  382|  10.3k|					*returnval = 1;
  383|  10.3k|				}
  384|   812k|				flush = 0;
  385|   812k|				break;
  386|   873k|			}
  387|       |
  388|   813k|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (388:12): [True: 1.45k, False: 812k]
  ------------------
  389|      0|			case -1:
  ------------------
  |  Branch (389:4): [True: 0, False: 813k]
  ------------------
  390|      0|				return -1;
  391|   590k|			case 0:
  ------------------
  |  Branch (391:4): [True: 590k, False: 223k]
  ------------------
  392|   590k|#ifdef ENABLE_CONDITIONALS
  393|   590k|				ms->c.li[cont_level].last_match = 0;
  394|   590k|#endif
  395|   590k|				break;
  396|   223k|			default:
  ------------------
  |  Branch (396:4): [True: 223k, False: 590k]
  ------------------
  397|   223k|#ifdef ENABLE_CONDITIONALS
  398|   223k|				ms->c.li[cont_level].last_match = 1;
  399|   223k|#endif
  400|   223k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  269|   223k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (400:9): [True: 266, False: 222k]
  ------------------
  401|    266|					ms->c.li[cont_level].got_match = 0;
  402|   222k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (402:14): [True: 59.5k, False: 163k]
  ------------------
  403|  59.5k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  225|  59.5k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (403:10): [True: 1.43k, False: 58.1k]
  ------------------
  404|  1.43k|						break;
  405|  59.5k|				} else
  406|   163k|					ms->c.li[cont_level].got_match = 1;
  407|       |
  408|   221k|				if ((e = handle_annotation(ms, m, firstline))
  ------------------
  |  Branch (408:9): [True: 0, False: 221k]
  ------------------
  409|   221k|				    != 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|   221k|				if (*m->desc) {
  ------------------
  |  Branch (416:9): [True: 78.5k, False: 143k]
  ------------------
  417|  78.5k|					*found_match = 1;
  418|  78.5k|				}
  419|   221k|				if (print && *m->desc) {
  ------------------
  |  Branch (419:9): [True: 221k, False: 0]
  |  Branch (419:18): [True: 78.5k, False: 143k]
  ------------------
  420|  78.5k|					*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|  78.5k|					if (!*printed_something) {
  ------------------
  |  Branch (432:10): [True: 19.4k, False: 59.1k]
  ------------------
  433|  19.4k|						*printed_something = 1;
  434|  19.4k|						if (print_sep(ms, firstline)
  ------------------
  |  Branch (434:11): [True: 0, False: 19.4k]
  ------------------
  435|  19.4k|						    == -1)
  436|      0|							return -1;
  437|  19.4k|					}
  438|       |					/* space if previous printed */
  439|  78.5k|					if (*need_separator
  ------------------
  |  Branch (439:10): [True: 59.8k, False: 18.7k]
  ------------------
  440|  78.5k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  209|  59.8k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (440:13): [True: 16.7k, False: 43.1k]
  ------------------
  441|  16.7k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (441:11): [True: 0, False: 16.7k]
  ------------------
  442|      0|							return -1;
  443|  16.7k|					}
  444|  78.5k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (444:10): [True: 0, False: 78.5k]
  ------------------
  445|      0|						return -1;
  446|  78.5k|					*need_separator = 1;
  447|  78.5k|				}
  448|       |
  449|   221k|				switch (moffset(ms, m, &bb,
  450|   221k|				    &ms->c.li[cont_level].off)) {
  451|  2.63k|				case -1:
  ------------------
  |  Branch (451:5): [True: 2.63k, False: 219k]
  ------------------
  452|  2.63k|				case 0:
  ------------------
  |  Branch (452:5): [True: 0, False: 221k]
  ------------------
  453|  2.63k|					cont_level--;
  454|  2.63k|					break;
  455|   219k|				default:
  ------------------
  |  Branch (455:5): [True: 219k, False: 2.63k]
  ------------------
  456|   219k|					break;
  457|   221k|				}
  458|       |
  459|       |				/*
  460|       |				 * If we see any continuations
  461|       |				 * at a higher level,
  462|       |				 * process them.
  463|       |				 */
  464|   221k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (464:9): [True: 0, False: 221k]
  ------------------
  465|      0|					return -1;
  466|   221k|				break;
  467|   813k|			}
  468|   813k|		}
  469|   215k|		if (*printed_something) {
  ------------------
  |  Branch (469:7): [True: 78.3k, False: 136k]
  ------------------
  470|  78.3k|			firstline = 0;
  471|  78.3k|		}
  472|   215k|		if (*found_match) {
  ------------------
  |  Branch (472:7): [True: 136k, False: 78.5k]
  ------------------
  473|   136k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   136k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (473:8): [True: 0, False: 136k]
  ------------------
  474|      0|				return *returnval;
  475|       |			// So that we print a separator
  476|   136k|			*printed_something = 0;
  477|   136k|			firstline = 0;
  478|   136k|		}
  479|   215k|		cont_level = 0;
  480|   215k|	}
  481|  69.8k|	return *returnval;
  482|  71.2k|}
softmagic.c:msetoffset:
 1505|  61.0M|{
 1506|  61.0M|	int32_t offset;
 1507|  61.0M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  213|  61.0M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1507:6): [True: 100k, False: 60.9M]
  ------------------
 1508|   100k|		offset = -m->offset;
 1509|   100k|		if (cont_level > 0) {
  ------------------
  |  Branch (1509:7): [True: 2.96k, False: 97.3k]
  ------------------
 1510|  2.96k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  206|  2.96k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  207|  2.96k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1510:8): [True: 2.47k, False: 487]
  ------------------
 1511|  2.47k|				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|  2.96k|		}
 1518|  97.7k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1518:7): [True: 97.7k, False: 0]
  ------------------
 1519|  97.7k|			return -1;
 1520|      0|		if (o != 0) {
  ------------------
  |  Branch (1520:7): [True: 0, False: 0]
  ------------------
 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|      0|		if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1526:7): [True: 0, False: 0]
  ------------------
 1527|      0|			return -1;
 1528|      0|		buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1529|      0|		ms->eoffset = ms->offset = CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1530|  60.9M|	} else {
 1531|  60.9M|		offset = m->offset;
 1532|  60.9M|		if (cont_level == 0) {
  ------------------
  |  Branch (1532:7): [True: 60.1M, False: 870k]
  ------------------
 1533|  60.1M|normal:
 1534|       |			// XXX: Pass real fd, then who frees bb?
 1535|  60.1M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1536|  60.1M|			ms->offset = offset;
 1537|  60.1M|			ms->eoffset = 0;
 1538|  60.1M|		} else {
 1539|   870k|			ms->offset = ms->eoffset + offset;
 1540|   870k|		}
 1541|  60.9M|	}
 1542|  60.9M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  60.9M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1542:6): [True: 0, False: 60.9M]
  ------------------
 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|  60.9M|	return 0;
 1550|  61.0M|}
softmagic.c:mget:
 1580|  60.9M|{
 1581|  60.9M|	uint32_t eoffset, offset = ms->offset;
 1582|  60.9M|	struct buffer bb;
 1583|  60.9M|	intmax_t lhs;
 1584|  60.9M|	file_pushbuf_t *pb;
 1585|  60.9M|	int rv, oneed_separator, in_type, nfound_match;
 1586|  60.9M|	char *rbuf;
 1587|  60.9M|	union VALUETYPE *p = &ms->ms_value;
 1588|  60.9M|	struct mlist ml, *mlp;
 1589|  60.9M|	struct cont c;
 1590|       |
 1591|  60.9M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1591:6): [True: 54, False: 60.9M]
  ------------------
 1592|     54|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1593|     54|		    *indir_count);
 1594|     54|		return -1;
 1595|     54|	}
 1596|       |
 1597|  60.9M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1597:6): [True: 1, False: 60.9M]
  ------------------
 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|  60.9M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  205|  60.9M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1605:6): [True: 0, False: 60.9M]
  ------------------
 1606|  60.9M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  426|  60.9M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  426|  60.9M|#define CAST(T, b)	((T)(b))
  ------------------
 1607|      0|		return -1;
 1608|       |
 1609|  60.9M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  60.9M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1609:6): [True: 0, False: 60.9M]
  ------------------
 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|  60.9M|	if (m->flag & INDIR) {
  ------------------
  |  |  205|  60.9M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1622:6): [True: 85.4k, False: 60.9M]
  ------------------
 1623|  85.4k|		intmax_t off = m->in_offset;
 1624|  85.4k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  330|  85.4k|#define				FILE_OPSIGNED	0x20
  ------------------
 1625|  85.4k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  332|  85.4k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1625:7): [True: 1.10k, False: 84.3k]
  ------------------
 1626|  1.10k|			const union VALUETYPE *q = CAST(const union VALUETYPE *,
  ------------------
  |  |  426|  1.10k|#define CAST(T, b)	((T)(b))
  ------------------
 1627|  1.10k|			    RCAST(const void *, s + offset + off));
 1628|  1.10k|			int op;
 1629|  1.10k|			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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 1656|      0|			case FILE_BEID3:
  ------------------
  |  |  261|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1656:4): [True: 0, False: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 1662|  1.10k|			case FILE_LELONG:
  ------------------
  |  |  233|  1.10k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1662:4): [True: 1.10k, False: 0]
  ------------------
 1663|  1.10k|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   70|  1.10k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  2.21k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 216, False: 893]
  |  |  |  Branch (70:59): [True: 122, False: 771]
  |  |  ------------------
  ------------------
 1664|    338|					return 0;
 1665|    771|				off = SEXT(sgn,32,LE32(q));
  ------------------
  |  |  107|    771|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 771]
  |  |  ------------------
  |  |  108|    771|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    771|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    771|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1666|    771|				break;
 1667|      0|			case FILE_MELONG:
  ------------------
  |  |  245|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1667:4): [True: 0, False: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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: 1.10k]
  ------------------
 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|  1.10k|			}
 1692|    771|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    771|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1692:8): [True: 0, False: 771]
  ------------------
 1693|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1694|    771|		}
 1695|  85.1k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1696|  10.4k|		case FILE_BYTE:
  ------------------
  |  |  223|  10.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1696:3): [True: 10.4k, False: 74.7k]
  ------------------
 1697|  10.4k|			if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   70|  10.4k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  20.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 39, False: 10.4k]
  |  |  |  Branch (70:59): [True: 29, False: 10.3k]
  |  |  ------------------
  ------------------
 1698|     68|				return 0;
 1699|  10.3k|			if (do_ops(m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  107|  10.3k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 10.3k]
  |  |  ------------------
  |  |  108|  10.3k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  10.3k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  10.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1699:8): [True: 0, False: 10.3k]
  ------------------
 1700|      0|				return 0;
 1701|  10.3k|			break;
 1702|  10.3k|		case FILE_BESHORT:
  ------------------
  |  |  229|  6.10k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1702:3): [True: 6.10k, False: 79.0k]
  ------------------
 1703|  6.10k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|  6.10k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  12.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 19, False: 6.08k]
  |  |  |  Branch (70:59): [True: 88, False: 5.99k]
  |  |  ------------------
  ------------------
 1704|    107|				return 0;
 1705|  5.99k|			if (do_ops(m, &offset, SEXT(sgn,16,BE16(p)), off))
  ------------------
  |  |  107|  5.99k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 5.99k]
  |  |  ------------------
  |  |  108|  5.99k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  5.99k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  5.99k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1705:8): [True: 0, False: 5.99k]
  ------------------
 1706|      0|				return 0;
 1707|  5.99k|			break;
 1708|  5.99k|		case FILE_LESHORT:
  ------------------
  |  |  232|  5.34k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1708:3): [True: 5.34k, False: 79.8k]
  ------------------
 1709|  5.34k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|  5.34k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  10.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 177, False: 5.16k]
  |  |  |  Branch (70:59): [True: 61, False: 5.10k]
  |  |  ------------------
  ------------------
 1710|    238|				return 0;
 1711|  5.10k|			if (do_ops(m, &offset, SEXT(sgn,16,LE16(p)), off))
  ------------------
  |  |  107|  5.10k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 93, False: 5.01k]
  |  |  ------------------
  |  |  108|  5.10k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|     93|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  5.10k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  5.01k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1711:8): [True: 0, False: 5.10k]
  ------------------
 1712|      0|				return 0;
 1713|  5.10k|			break;
 1714|  5.10k|		case FILE_SHORT:
  ------------------
  |  |  224|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1714:3): [True: 0, False: 85.1k]
  ------------------
 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|  19.8k|		case FILE_BELONG:
  ------------------
  |  |  230|  19.8k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1720:3): [True: 19.8k, False: 65.3k]
  ------------------
 1721|  19.9k|		case FILE_BEID3:
  ------------------
  |  |  261|  19.9k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1721:3): [True: 106, False: 85.0k]
  ------------------
 1722|  19.9k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|  19.9k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  39.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 108, False: 19.8k]
  |  |  |  Branch (70:59): [True: 164, False: 19.6k]
  |  |  ------------------
  ------------------
 1723|    272|				return 0;
 1724|  19.6k|			lhs = BE32(p);
  ------------------
  |  |   94|  19.6k|#define BE32(p) ( \
  |  |   95|  19.6k|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  426|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   96|  19.6k|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  426|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|  19.6k|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  426|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  19.6k|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  426|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1725|  19.6k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  261|  19.6k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1725:8): [True: 89, False: 19.5k]
  ------------------
 1726|     89|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  426|     89|#define CAST(T, b)	((T)(b))
  ------------------
 1727|  19.6k|			if (do_ops(m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  107|  19.6k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 19.6k]
  |  |  ------------------
  |  |  108|  19.6k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  19.6k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1727:8): [True: 3.28k, False: 16.3k]
  ------------------
 1728|  3.28k|				return 0;
 1729|  16.3k|			break;
 1730|  42.1k|		case FILE_LELONG:
  ------------------
  |  |  233|  42.1k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1730:3): [True: 42.1k, False: 42.9k]
  ------------------
 1731|  42.1k|		case FILE_LEID3:
  ------------------
  |  |  262|  42.1k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1731:3): [True: 0, False: 85.1k]
  ------------------
 1732|  42.1k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|  42.1k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  84.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 608, False: 41.5k]
  |  |  |  Branch (70:59): [True: 1.88k, False: 39.6k]
  |  |  ------------------
  ------------------
 1733|  2.48k|				return 0;
 1734|  39.6k|			lhs = LE32(p);
  ------------------
  |  |   89|  39.6k|#define LE32(p) ( \
  |  |   90|  39.6k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  426|  39.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   91|  39.6k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  426|  39.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|  39.6k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  426|  39.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  39.6k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  426|  39.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1735|  39.6k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  262|  39.6k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1735:8): [True: 0, False: 39.6k]
  ------------------
 1736|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  426|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1737|  39.6k|			if (do_ops(m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  107|  39.6k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 39.6k]
  |  |  ------------------
  |  |  108|  39.6k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|  39.6k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|  39.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1737:8): [True: 3.90k, False: 35.7k]
  ------------------
 1738|  3.90k|				return 0;
 1739|  35.7k|			break;
 1740|  35.7k|		case FILE_MELONG:
  ------------------
  |  |  245|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1740:3): [True: 0, False: 85.1k]
  ------------------
 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|    347|		case FILE_LONG:
  ------------------
  |  |  226|    347|#define				FILE_LONG		4
  ------------------
  |  Branch (1746:3): [True: 347, False: 84.8k]
  ------------------
 1747|    347|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|    347|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    694|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 66, False: 281]
  |  |  |  Branch (70:59): [True: 57, False: 224]
  |  |  ------------------
  ------------------
 1748|    123|				return 0;
 1749|    224|			if (do_ops(m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  107|    224|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 224]
  |  |  ------------------
  |  |  108|    224|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    224|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    224|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1749:8): [True: 57, False: 167]
  ------------------
 1750|     57|				return 0;
 1751|    167|			break;
 1752|    284|		case FILE_LEQUAD:
  ------------------
  |  |  247|    284|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1752:3): [True: 284, False: 84.8k]
  ------------------
 1753|    284|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   70|    284|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    568|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 284]
  |  |  |  Branch (70:59): [True: 0, False: 284]
  |  |  ------------------
  ------------------
 1754|      0|				return 0;
 1755|    284|			if (do_ops(m, &offset, SEXT(sgn,64,LE64(p)), off))	
  ------------------
  |  |  107|    284|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 284]
  |  |  ------------------
  |  |  108|    284|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    284|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    284|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1755:8): [True: 206, False: 78]
  ------------------
 1756|    206|				return 0;
 1757|     78|			break;
 1758|    179|		case FILE_BEQUAD:
  ------------------
  |  |  248|    179|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1758:3): [True: 179, False: 84.9k]
  ------------------
 1759|    179|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   70|    179|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    358|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 179]
  |  |  |  Branch (70:59): [True: 0, False: 179]
  |  |  ------------------
  ------------------
 1760|      0|				return 0;
 1761|    179|			if (do_ops(m, &offset, SEXT(sgn,64,BE64(p)), off))
  ------------------
  |  |  107|    179|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 179]
  |  |  ------------------
  |  |  108|    179|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    179|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    179|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1761:8): [True: 124, False: 55]
  ------------------
 1762|    124|				return 0;
 1763|     55|			break;
 1764|    321|		case FILE_OCTAL:
  ------------------
  |  |  281|    321|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1764:3): [True: 321, False: 84.8k]
  ------------------
 1765|    321|			if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   70|    321|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|    642|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 73, False: 248]
  |  |  |  Branch (70:59): [True: 55, False: 193]
  |  |  ------------------
  ------------------
 1766|    128|				return 0;
 1767|    193|			if(do_ops(m, &offset,
  ------------------
  |  Branch (1767:7): [True: 96, False: 97]
  ------------------
 1768|    193|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  107|    193|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (107:22): [True: 0, False: 193]
  |  |  ------------------
  |  |  108|    193|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  109|    193|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  426|    193|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1769|     96|				return 0;
 1770|     97|			break;
 1771|     97|		default:
  ------------------
  |  Branch (1771:3): [True: 0, False: 85.1k]
  ------------------
 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|  85.1k|		}
 1776|       |
 1777|  74.0k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  207|  74.0k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1777:7): [True: 2.36k, False: 71.6k]
  ------------------
 1778|  2.36k|			if (cont_level == 0) {
  ------------------
  |  Branch (1778:8): [True: 0, False: 2.36k]
  ------------------
 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|  2.36k|			offset += ms->c.li[cont_level - 1].off;
 1785|  2.36k|			if (offset == 0) {
  ------------------
  |  Branch (1785:8): [True: 132, False: 2.23k]
  ------------------
 1786|    132|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    132|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1786:9): [True: 0, False: 132]
  ------------------
 1787|      0|					fprintf(stderr,
 1788|      0|					    "indirect *zero* offset\n");
 1789|    132|				return 0;
 1790|    132|			}
 1791|  2.23k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.23k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1791:8): [True: 0, False: 2.23k]
  ------------------
 1792|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1793|  2.23k|		}
 1794|  73.9k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1794:7): [True: 0, False: 73.9k]
  ------------------
 1795|      0|			return -1;
 1796|  73.9k|		ms->offset = offset;
 1797|       |
 1798|  73.9k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  73.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1798:7): [True: 0, False: 73.9k]
  ------------------
 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|  73.9k|	}
 1806|       |
 1807|       |	/* Verify we have enough data to match magic type */
 1808|  60.9M|	switch (m->type) {
 1809|   722k|	case FILE_BYTE:
  ------------------
  |  |  223|   722k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1809:2): [True: 722k, False: 60.2M]
  ------------------
 1810|   722k|		if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   70|   722k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  1.44M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 57.4k, False: 665k]
  |  |  |  Branch (70:59): [True: 5.05k, False: 660k]
  |  |  ------------------
  ------------------
 1811|  62.5k|			return 0;
 1812|   660k|		break;
 1813|       |
 1814|   660k|	case FILE_SHORT:
  ------------------
  |  |  224|   621k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1814:2): [True: 621k, False: 60.3M]
  ------------------
 1815|  3.32M|	case FILE_BESHORT:
  ------------------
  |  |  229|  3.32M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1815:2): [True: 2.70M, False: 58.2M]
  ------------------
 1816|  5.12M|	case FILE_LESHORT:
  ------------------
  |  |  232|  5.12M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1816:2): [True: 1.80M, False: 59.1M]
  ------------------
 1817|  5.12M|		if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   70|  5.12M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  10.2M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 270k, False: 4.85M]
  |  |  |  Branch (70:59): [True: 60.2k, False: 4.79M]
  |  |  ------------------
  ------------------
 1818|   330k|			return 0;
 1819|  4.79M|		break;
 1820|       |
 1821|  4.79M|	case FILE_LONG:
  ------------------
  |  |  226|   970k|#define				FILE_LONG		4
  ------------------
  |  Branch (1821:2): [True: 970k, False: 60.0M]
  ------------------
 1822|  9.36M|	case FILE_BELONG:
  ------------------
  |  |  230|  9.36M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1822:2): [True: 8.39M, False: 52.5M]
  ------------------
 1823|  13.1M|	case FILE_LELONG:
  ------------------
  |  |  233|  13.1M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1823:2): [True: 3.81M, False: 57.1M]
  ------------------
 1824|  13.1M|	case FILE_MELONG:
  ------------------
  |  |  245|  13.1M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1824:2): [True: 0, False: 60.9M]
  ------------------
 1825|  13.1M|	case FILE_DATE:
  ------------------
  |  |  228|  13.1M|#define				FILE_DATE		6
  ------------------
  |  Branch (1825:2): [True: 0, False: 60.9M]
  ------------------
 1826|  13.1M|	case FILE_BEDATE:
  ------------------
  |  |  231|  13.1M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1826:2): [True: 176, False: 60.9M]
  ------------------
 1827|  13.1M|	case FILE_LEDATE:
  ------------------
  |  |  234|  13.1M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1827:2): [True: 286, False: 60.9M]
  ------------------
 1828|  13.1M|	case FILE_MEDATE:
  ------------------
  |  |  243|  13.1M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1828:2): [True: 68, False: 60.9M]
  ------------------
 1829|  13.1M|	case FILE_LDATE:
  ------------------
  |  |  236|  13.1M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1829:2): [True: 0, False: 60.9M]
  ------------------
 1830|  13.1M|	case FILE_BELDATE:
  ------------------
  |  |  237|  13.1M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1830:2): [True: 143, False: 60.9M]
  ------------------
 1831|  13.1M|	case FILE_LELDATE:
  ------------------
  |  |  238|  13.1M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1831:2): [True: 68, False: 60.9M]
  ------------------
 1832|  13.1M|	case FILE_MELDATE:
  ------------------
  |  |  244|  13.1M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1832:2): [True: 0, False: 60.9M]
  ------------------
 1833|  13.1M|	case FILE_FLOAT:
  ------------------
  |  |  255|  13.1M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1833:2): [True: 0, False: 60.9M]
  ------------------
 1834|  13.1M|	case FILE_BEFLOAT:
  ------------------
  |  |  256|  13.1M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1834:2): [True: 0, False: 60.9M]
  ------------------
 1835|  13.1M|	case FILE_LEFLOAT:
  ------------------
  |  |  257|  13.1M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1835:2): [True: 394, False: 60.9M]
  ------------------
 1836|  13.1M|		if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   70|  13.1M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  26.3M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 519k, False: 12.6M]
  |  |  |  Branch (70:59): [True: 593k, False: 12.0M]
  |  |  ------------------
  ------------------
 1837|  1.11M|			return 0;
 1838|  12.0M|		break;
 1839|       |
 1840|  12.0M|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1840:2): [True: 0, False: 60.9M]
  ------------------
 1841|    156|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|    156|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1841:2): [True: 156, False: 60.9M]
  ------------------
 1842|    719|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    719|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1842:2): [True: 563, False: 60.9M]
  ------------------
 1843|    719|		if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   70|    719|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  1.43k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 145, False: 574]
  |  |  |  Branch (70:59): [True: 83, False: 491]
  |  |  ------------------
  ------------------
 1844|    228|			return 0;
 1845|    491|		break;
 1846|       |
 1847|  37.1k|	case FILE_GUID:
  ------------------
  |  |  271|  37.1k|#define				FILE_GUID		49
  ------------------
  |  Branch (1847:2): [True: 37.1k, False: 60.9M]
  ------------------
 1848|  37.1k|		if (OFFSET_OOB(nbytes, offset, 16))
  ------------------
  |  |   70|  37.1k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  74.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 0, False: 37.1k]
  |  |  |  Branch (70:59): [True: 3.91k, False: 33.2k]
  |  |  ------------------
  ------------------
 1849|  3.91k|			return 0;
 1850|  33.2k|		break;
 1851|       |
 1852|  39.6M|	case FILE_STRING:
  ------------------
  |  |  227|  39.6M|#define				FILE_STRING		5
  ------------------
  |  Branch (1852:2): [True: 39.6M, False: 21.3M]
  ------------------
 1853|  39.6M|	case FILE_PSTRING:
  ------------------
  |  |  235|  39.6M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1853:2): [True: 21.3k, False: 60.9M]
  ------------------
 1854|  40.2M|	case FILE_SEARCH:
  ------------------
  |  |  242|  40.2M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1854:2): [True: 632k, False: 60.3M]
  ------------------
 1855|  40.2M|	case FILE_OCTAL:
  ------------------
  |  |  281|  40.2M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1855:2): [True: 0, False: 60.9M]
  ------------------
 1856|  40.2M|		if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   70|  40.2M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  426|  80.5M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (70:30): [True: 2.44M, False: 37.8M]
  |  |  |  Branch (70:59): [True: 4.16M, False: 33.6M]
  |  |  ------------------
  ------------------
 1857|  6.61M|			return 0;
 1858|  33.6M|		break;
 1859|       |
 1860|  33.6M|	case FILE_REGEX:
  ------------------
  |  |  239|   156k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1860:2): [True: 156k, False: 60.8M]
  ------------------
 1861|   156k|		if (nbytes < offset)
  ------------------
  |  Branch (1861:7): [True: 628, False: 156k]
  ------------------
 1862|    628|			return 0;
 1863|   156k|		break;
 1864|       |
 1865|   156k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  19.1k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1865:2): [True: 19.1k, False: 60.9M]
  ------------------
 1866|  19.1k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  357|  19.1k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  409|  19.1k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  370|  19.1k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1866:7): [True: 4.17k, False: 14.9k]
  ------------------
 1867|  4.17k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  426|  4.17k|#define CAST(T, b)	((T)(b))
  ------------------
 1868|  19.1k|		if (offset == 0)
  ------------------
  |  Branch (1868:7): [True: 1.83k, False: 17.3k]
  ------------------
 1869|  1.83k|			return 0;
 1870|       |
 1871|  17.3k|		if (nbytes < offset)
  ------------------
  |  Branch (1871:7): [True: 3.48k, False: 13.8k]
  ------------------
 1872|  3.48k|			return 0;
 1873|       |
 1874|  13.8k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1874:7): [True: 0, False: 13.8k]
  ------------------
 1875|      0|			return -1;
 1876|       |
 1877|  13.8k|		(*indir_count)++;
 1878|  13.8k|		bb = *b;
 1879|  13.8k|		bb.fbuf = s + offset;
 1880|  13.8k|		bb.flen = nbytes - offset;
 1881|  13.8k|		rv = -1;
 1882|  16.6k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1882:34): [True: 13.8k, False: 2.86k]
  ------------------
 1883|  13.8k|		    mlp = mlp->next)
 1884|  13.8k|		{
 1885|  13.8k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1885:8): [True: 10.9k, False: 2.86k]
  ------------------
 1886|  13.8k|			    mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  210|  13.8k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1887|  13.8k|			    name_count, printed_something, need_separator,
 1888|  13.8k|			    NULL, NULL)) != 0)
 1889|  10.9k|				break;
 1890|  13.8k|		}
 1891|       |
 1892|  13.8k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1892:7): [True: 0, False: 13.8k]
  ------------------
 1893|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1894|       |
 1895|  13.8k|		rbuf = file_pop_buffer(ms, pb);
 1896|  13.8k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  461|  2.82k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1896:7): [True: 2.82k, False: 11.0k]
  |  Branch (1896:23): [True: 590, False: 2.23k]
  ------------------
 1897|    590|			return -1;
 1898|       |
 1899|  13.2k|		if (rv == 1) {
  ------------------
  |  Branch (1899:7): [True: 10.3k, False: 2.86k]
  ------------------
 1900|  10.3k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  10.3k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  10.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  10.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  10.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  10.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  10.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1900:8): [True: 10.3k, False: 0]
  ------------------
 1901|  10.3k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  155|  10.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1901:8): [True: 0, False: 10.3k]
  ------------------
 1902|      0|			{
 1903|      0|				free(rbuf);
 1904|      0|				return -1;
 1905|      0|			}
 1906|  10.3k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1906:8): [True: 70, False: 10.3k]
  ------------------
 1907|     70|				free(rbuf);
 1908|     70|				return -1;
 1909|     70|			}
 1910|  10.3k|		}
 1911|  13.1k|		free(rbuf);
 1912|  13.1k|		return rv;
 1913|       |
 1914|  57.2k|	case FILE_USE:
  ------------------
  |  |  268|  57.2k|#define				FILE_USE		46
  ------------------
  |  Branch (1914:2): [True: 57.2k, False: 60.9M]
  ------------------
 1915|  57.2k|		if (nbytes < offset)
  ------------------
  |  Branch (1915:7): [True: 7.77k, False: 49.4k]
  ------------------
 1916|  7.77k|			return 0;
 1917|  49.4k|		rbuf = m->value.s;
 1918|  49.4k|		if (*rbuf == '^') {
  ------------------
  |  Branch (1918:7): [True: 485, False: 48.9k]
  ------------------
 1919|    485|			rbuf++;
 1920|    485|			flip = !flip;
 1921|    485|		}
 1922|  49.4k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (1922:7): [True: 0, False: 49.4k]
  ------------------
 1923|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 1924|      0|			return -1;
 1925|      0|		}
 1926|  49.4k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (1926:7): [True: 0, False: 49.4k]
  ------------------
 1927|      0|			file_error(ms, errno, "can't allocate continuation");
 1928|      0|			return -1;
 1929|      0|		}
 1930|       |
 1931|  49.4k|		oneed_separator = *need_separator;
 1932|  49.4k|		if (m->flag & NOSPACE)
  ------------------
  |  |  209|  49.4k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (1932:7): [True: 35.8k, False: 13.6k]
  ------------------
 1933|  35.8k|			*need_separator = 0;
 1934|       |
 1935|  49.4k|		nfound_match = 0;
 1936|  49.4k|		(*name_count)++;
 1937|  49.4k|		eoffset = ms->eoffset;
 1938|  49.4k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 1939|  49.4k|		    offset + o, mode, text, flip, indir_count, name_count,
 1940|  49.4k|		    printed_something, need_separator, returnval,
 1941|  49.4k|		    &nfound_match);
 1942|  49.4k|		ms->ms_value.q = nfound_match;
 1943|  49.4k|		(*name_count)--;
 1944|  49.4k|		*found_match |= nfound_match;
 1945|       |
 1946|  49.4k|		restore_cont(ms, &c);
 1947|       |
 1948|  49.4k|		if (rv != 1)
  ------------------
  |  Branch (1948:7): [True: 2.74k, False: 46.7k]
  ------------------
 1949|  2.74k|		    *need_separator = oneed_separator;
 1950|  49.4k|		ms->offset = offset;
 1951|  49.4k|		ms->eoffset = eoffset;
 1952|  49.4k|		return rv;
 1953|       |
 1954|  49.4k|	case FILE_NAME:
  ------------------
  |  |  267|  49.4k|#define				FILE_NAME		45
  ------------------
  |  Branch (1954:2): [True: 49.4k, False: 60.9M]
  ------------------
 1955|  49.4k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  49.4k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  49.4k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  49.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  49.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  49.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  49.4k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1955:7): [True: 0, False: 49.4k]
  ------------------
 1956|      0|			return 1;
 1957|  49.4k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (1957:7): [True: 0, False: 49.4k]
  ------------------
 1958|      0|			return -1;
 1959|  49.4k|		return 1;
 1960|   252k|	case FILE_DER:
  ------------------
  |  |  270|   252k|#define				FILE_DER		48
  ------------------
  |  Branch (1960:2): [True: 252k, False: 60.7M]
  ------------------
 1961|   256k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  225|   256k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1961:2): [True: 3.69k, False: 60.9M]
  ------------------
 1962|   256k|	case FILE_CLEAR:
  ------------------
  |  |  269|   256k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1962:2): [True: 266, False: 60.9M]
  ------------------
 1963|  1.35M|	default:
  ------------------
  |  Branch (1963:2): [True: 1.10M, False: 59.8M]
  ------------------
 1964|  1.35M|		break;
 1965|  60.9M|	}
 1966|  52.7M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (1966:6): [True: 50, False: 52.7M]
  ------------------
 1967|     50|		return 0;
 1968|  52.7M|	return 1;
 1969|  52.7M|}
softmagic.c:mcopy:
 1322|  61.0M|{
 1323|       |	/*
 1324|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1325|       |	 * anything, but setup pointers into the source
 1326|       |	 */
 1327|  61.0M|	if (indir == 0) {
  ------------------
  |  Branch (1327:6): [True: 60.9M, False: 85.4k]
  ------------------
 1328|  60.9M|		switch (type) {
 1329|   252k|		case FILE_DER:
  ------------------
  |  |  270|   252k|#define				FILE_DER		48
  ------------------
  |  Branch (1329:3): [True: 252k, False: 60.7M]
  ------------------
 1330|   885k|		case FILE_SEARCH:
  ------------------
  |  |  242|   885k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1330:3): [True: 632k, False: 60.3M]
  ------------------
 1331|   885k|			if (offset > nbytes)
  ------------------
  |  Branch (1331:8): [True: 40.0k, False: 845k]
  ------------------
 1332|  40.0k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  426|  40.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1333|   885k|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  427|   885k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1334|   885k|			ms->search.s_len = nbytes - offset;
 1335|   885k|			ms->search.offset = offset;
 1336|   885k|			return 0;
 1337|       |
 1338|   156k|		case FILE_REGEX: {
  ------------------
  |  |  239|   156k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1338:3): [True: 156k, False: 60.8M]
  ------------------
 1339|   156k|			const char *b;
 1340|   156k|			const char *c;
 1341|   156k|			const char *last;	/* end of search region */
 1342|   156k|			const char *buf;	/* start of search region */
 1343|   156k|			const char *end;
 1344|   156k|			size_t lines, linecnt, bytecnt;
 1345|       |
 1346|   156k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1346:8): [True: 0, False: 156k]
  |  Branch (1346:21): [True: 660, False: 156k]
  ------------------
 1347|    660|				ms->search.s_len = 0;
 1348|    660|				ms->search.s = NULL;
 1349|    660|				return 0;
 1350|    660|			}
 1351|       |
 1352|   156k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  357|   156k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  384|   156k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  370|   156k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1352:8): [True: 45.6k, False: 110k]
  ------------------
 1353|  45.6k|				linecnt = m->str_range;
  ------------------
  |  |  356|  45.6k|#define str_range _u._s._count
  ------------------
 1354|  45.6k|				bytecnt = linecnt * 80;
 1355|   110k|			} else {
 1356|   110k|				linecnt = 0;
 1357|   110k|				bytecnt = m->str_range;
  ------------------
  |  |  356|   110k|#define str_range _u._s._count
  ------------------
 1358|   110k|			}
 1359|       |
 1360|   156k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1360:8): [True: 92.3k, False: 63.8k]
  |  Branch (1360:24): [True: 59.0k, False: 4.79k]
  ------------------
 1361|   151k|				bytecnt = nbytes - offset;
 1362|   156k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1362:8): [True: 7.14k, False: 149k]
  ------------------
 1363|  7.14k|				bytecnt = ms->regex_max;
 1364|       |
 1365|   156k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  427|   156k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1366|   156k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  427|   156k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1367|       |			/* mget() guarantees buf <= last */
 1368|   319k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1368:35): [True: 206k, False: 112k]
  |  Branch (1368:44): [True: 203k, False: 3.64k]
  ------------------
 1369|   319k|			     ((b = CAST(const char *,
  ------------------
  |  |  426|   203k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1369:10): [True: 87.6k, False: 115k]
  ------------------
 1370|   203k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1371|   203k|			     || (b = CAST(const char *,
  ------------------
  |  |  426|   115k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1371:12): [True: 75.2k, False: 40.2k]
  ------------------
 1372|   115k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1373|   162k|			     lines--, b++) {
 1374|   162k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1374:9): [True: 160k, False: 2.83k]
  |  Branch (1374:24): [True: 74.2k, False: 85.7k]
  |  Branch (1374:40): [True: 0, False: 74.2k]
  ------------------
 1375|      0|					b++;
 1376|   162k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1376:9): [True: 160k, False: 2.83k]
  |  Branch (1376:24): [True: 85.7k, False: 74.2k]
  ------------------
 1377|  85.7k|					b++;
 1378|   162k|				last = b;
 1379|   162k|			}
 1380|   156k|			if (lines)
  ------------------
  |  Branch (1380:8): [True: 43.9k, False: 112k]
  ------------------
 1381|  43.9k|				last = end;
 1382|       |
 1383|   156k|			ms->search.s = buf;
 1384|   156k|			ms->search.s_len = last - buf;
 1385|   156k|			ms->search.offset = offset;
 1386|   156k|			ms->search.rm_len = 0;
 1387|   156k|			return 0;
 1388|   156k|		}
 1389|    105|		case FILE_BESTRING16:
  ------------------
  |  |  240|    105|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1389:3): [True: 105, False: 60.9M]
  ------------------
 1390|  39.8k|		case FILE_LESTRING16: {
  ------------------
  |  |  241|  39.8k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1390:3): [True: 39.7k, False: 60.9M]
  ------------------
 1391|  39.8k|			const unsigned char *src = s + offset;
 1392|  39.8k|			const unsigned char *esrc = s + nbytes;
 1393|  39.8k|			char *dst = p->s;
 1394|  39.8k|			char *edst = &p->s[sizeof(p->s) - 1];
 1395|       |
 1396|  39.8k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  240|  39.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1396:8): [True: 105, False: 39.7k]
  ------------------
 1397|    105|				src++;
 1398|       |
 1399|       |			/* check that offset is within range */
 1400|  39.8k|			if (offset >= nbytes)
  ------------------
  |  Branch (1400:8): [True: 943, False: 38.9k]
  ------------------
 1401|    943|				break;
 1402|  1.92M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1402:20): [True: 1.89M, False: 30.5k]
  ------------------
 1403|  1.89M|				if (dst < edst)
  ------------------
  |  Branch (1403:9): [True: 1.88M, False: 8.36k]
  ------------------
 1404|  1.88M|					*dst = *src;
 1405|  8.36k|				else
 1406|  8.36k|					break;
 1407|  1.88M|				if (*dst == '\0') {
  ------------------
  |  Branch (1407:9): [True: 710k, False: 1.17M]
  ------------------
 1408|   710k|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  240|   710k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1408:10): [True: 1.42k, False: 708k]
  |  Branch (1408:10): [True: 246k, False: 463k]
  ------------------
 1409|  1.42k|					    *(src - 1) != '\0' :
 1410|   710k|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1410:11): [True: 706k, False: 2.27k]
  ------------------
 1411|   708k|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1411:10): [True: 246k, False: 460k]
  ------------------
 1412|   246k|						*dst = ' ';
 1413|   710k|				}
 1414|  1.88M|			}
 1415|  38.9k|			*edst = '\0';
 1416|  38.9k|			return 0;
 1417|  39.8k|		}
 1418|  39.6M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  227|  39.6M|#define				FILE_STRING		5
  ------------------
  |  Branch (1418:3): [True: 39.6M, False: 21.3M]
  ------------------
 1419|  39.6M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  235|  39.6M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1419:3): [True: 21.3k, False: 60.9M]
  ------------------
 1420|  59.9M|		default:
  ------------------
  |  Branch (1420:3): [True: 20.2M, False: 40.7M]
  ------------------
 1421|  59.9M|			break;
 1422|  60.9M|		}
 1423|  60.9M|	}
 1424|       |
 1425|  59.9M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  272|  59.9M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1425:6): [True: 0, False: 59.9M]
  ------------------
 1426|      0|		(void)memset(p, '\0', sizeof(*p));
 1427|      0|		p->q = offset;
 1428|      0|		return 0;
 1429|      0|	}
 1430|       |
 1431|  59.9M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1431:6): [True: 3.85M, False: 56.1M]
  ------------------
 1432|  3.85M|		(void)memset(p, '\0', sizeof(*p));
 1433|  3.85M|		return 0;
 1434|  3.85M|	}
 1435|  56.1M|	if (nbytes - offset < sizeof(*p))
  ------------------
  |  Branch (1435:6): [True: 40.0M, False: 16.0M]
  ------------------
 1436|  40.0M|		nbytes = nbytes - offset;
 1437|  16.0M|	else
 1438|  16.0M|		nbytes = sizeof(*p);
 1439|       |
 1440|  56.1M|	(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|  56.1M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1446:6): [True: 40.0M, False: 16.0M]
  ------------------
 1447|  40.0M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  427|  40.0M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1448|  40.0M|		    sizeof(*p) - nbytes);
 1449|  56.1M|	return 0;
 1450|  59.9M|}
softmagic.c:cvt_flip:
  998|  52.8M|{
  999|  52.8M|	if (flip == 0)
  ------------------
  |  Branch (999:6): [True: 52.7M, False: 40.1k]
  ------------------
 1000|  52.7M|		return type;
 1001|  40.1k|	switch (type) {
 1002|    259|	case FILE_BESHORT:
  ------------------
  |  |  229|    259|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1002:2): [True: 259, False: 39.9k]
  ------------------
 1003|    259|		return FILE_LESHORT;
  ------------------
  |  |  232|    259|#define				FILE_LESHORT		10
  ------------------
 1004|  1.72k|	case FILE_BELONG:
  ------------------
  |  |  230|  1.72k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1004:2): [True: 1.72k, False: 38.4k]
  ------------------
 1005|  1.72k|		return FILE_LELONG;
  ------------------
  |  |  233|  1.72k|#define				FILE_LELONG		11
  ------------------
 1006|     23|	case FILE_BEDATE:
  ------------------
  |  |  231|     23|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1006:2): [True: 23, False: 40.1k]
  ------------------
 1007|     23|		return FILE_LEDATE;
  ------------------
  |  |  234|     23|#define				FILE_LEDATE		12
  ------------------
 1008|      0|	case FILE_BELDATE:
  ------------------
  |  |  237|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1008:2): [True: 0, False: 40.1k]
  ------------------
 1009|      0|		return FILE_LELDATE;
  ------------------
  |  |  238|      0|#define				FILE_LELDATE		16
  ------------------
 1010|      3|	case FILE_BEQUAD:
  ------------------
  |  |  248|      3|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1010:2): [True: 3, False: 40.1k]
  ------------------
 1011|      3|		return FILE_LEQUAD;
  ------------------
  |  |  247|      3|#define				FILE_LEQUAD		25
  ------------------
 1012|    108|	case FILE_BEQDATE:
  ------------------
  |  |  251|    108|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1012:2): [True: 108, False: 40.0k]
  ------------------
 1013|    108|		return FILE_LEQDATE;
  ------------------
  |  |  250|    108|#define				FILE_LEQDATE		28
  ------------------
 1014|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  254|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1014:2): [True: 0, False: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 1017|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  265|      0|#define				FILE_LEQWDATE		43
  ------------------
 1018|  36.1k|	case FILE_LESHORT:
  ------------------
  |  |  232|  36.1k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1018:2): [True: 36.1k, False: 4.08k]
  ------------------
 1019|  36.1k|		return FILE_BESHORT;
  ------------------
  |  |  229|  36.1k|#define				FILE_BESHORT		7
  ------------------
 1020|  1.00k|	case FILE_LELONG:
  ------------------
  |  |  233|  1.00k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1020:2): [True: 1.00k, False: 39.1k]
  ------------------
 1021|  1.00k|		return FILE_BELONG;
  ------------------
  |  |  230|  1.00k|#define				FILE_BELONG		8
  ------------------
 1022|     20|	case FILE_LEDATE:
  ------------------
  |  |  234|     20|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1022:2): [True: 20, False: 40.1k]
  ------------------
 1023|     20|		return FILE_BEDATE;
  ------------------
  |  |  231|     20|#define				FILE_BEDATE		9
  ------------------
 1024|      0|	case FILE_LELDATE:
  ------------------
  |  |  238|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1024:2): [True: 0, False: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 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: 40.1k]
  ------------------
 1041|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1042|    940|	default:
  ------------------
  |  Branch (1042:2): [True: 940, False: 39.2k]
  ------------------
 1043|    940|		return type;
 1044|  40.1k|	}
 1045|  40.1k|}
softmagic.c:do_ops:
 1454|  81.7k|{
 1455|  81.7k|	intmax_t offset;
 1456|       |	// On purpose not INTMAX_MAX
 1457|  81.7k|	if (lhs >= INT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1457:6): [True: 7.26k, False: 74.4k]
  |  Branch (1457:24): [True: 100, False: 74.3k]
  ------------------
 1458|  81.7k|	    off >= INT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1458:6): [True: 238, False: 74.1k]
  |  Branch (1458:24): [True: 0, False: 74.1k]
  ------------------
 1459|  7.60k|		fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1460|  7.60k|		return 1;
 1461|  7.60k|	}
 1462|       |	   
 1463|  74.1k|	if (off) {
  ------------------
  |  Branch (1463:6): [True: 42.0k, False: 32.0k]
  ------------------
 1464|  42.0k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  327|  42.0k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1464:11): [True: 0, False: 42.0k]
  ------------------
 1465|     32|		case FILE_OPAND:
  ------------------
  |  |  319|     32|#define				FILE_OPAND	0
  ------------------
  |  Branch (1465:3): [True: 32, False: 42.0k]
  ------------------
 1466|     32|			offset = lhs & off;
 1467|     32|			break;
 1468|      0|		case FILE_OPOR:
  ------------------
  |  |  320|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1468:3): [True: 0, False: 42.0k]
  ------------------
 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: 42.0k]
  ------------------
 1472|      0|			offset = lhs ^ off;
 1473|      0|			break;
 1474|  36.7k|		case FILE_OPADD:
  ------------------
  |  |  322|  36.7k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1474:3): [True: 36.7k, False: 5.30k]
  ------------------
 1475|  36.7k|			offset = lhs + off;
 1476|  36.7k|			break;
 1477|  1.41k|		case FILE_OPMINUS:
  ------------------
  |  |  323|  1.41k|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1477:3): [True: 1.41k, False: 40.6k]
  ------------------
 1478|  1.41k|			offset = lhs - off;
 1479|  1.41k|			break;
 1480|  3.83k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  324|  3.83k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1480:3): [True: 3.83k, False: 38.1k]
  ------------------
 1481|  3.83k|			offset = lhs * off;
 1482|  3.83k|			break;
 1483|     18|		case FILE_OPDIVIDE:
  ------------------
  |  |  325|     18|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1483:3): [True: 18, False: 42.0k]
  ------------------
 1484|     18|			offset = lhs / off;
 1485|     18|			break;
 1486|      0|		case FILE_OPMODULO:
  ------------------
  |  |  326|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1486:3): [True: 0, False: 42.0k]
  ------------------
 1487|      0|			offset = lhs % off;
 1488|      0|			break;
 1489|  42.0k|		}
 1490|  42.0k|	} else
 1491|  32.0k|		offset = lhs;
 1492|  74.1k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  331|  74.1k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1492:6): [True: 0, False: 74.1k]
  ------------------
 1493|      0|		offset = ~offset;
 1494|  74.1k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1494:6): [True: 71, False: 74.0k]
  ------------------
 1495|     71|		fprintf(stderr, "offset overflow %jd\n", offset);
 1496|     71|		return 1;
 1497|     71|	}
 1498|  74.0k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  426|  74.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1499|  74.0k|	return 0;
 1500|  74.1k|}
softmagic.c:cvt_id3:
  986|     89|{
  987|     89|	v = ((((v >>  0) & 0x7f) <<  0) |
  988|     89|	     (((v >>  8) & 0x7f) <<  7) |
  989|     89|	     (((v >> 16) & 0x7f) << 14) |
  990|     89|	     (((v >> 24) & 0x7f) << 21));
  991|     89|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     89|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (991:6): [True: 0, False: 89]
  ------------------
  992|      0|		fprintf(stderr, "id3 offs=%u\n", v);
  993|     89|	return v;
  994|     89|}
softmagic.c:file_fmtcheck:
  160|  87.9k|{
  161|  87.9k|	const char *ptr;
  162|       |
  163|  87.9k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (163:6): [True: 58.6k, False: 29.2k]
  ------------------
  164|  58.6k|		return desc;
  165|       |
  166|  29.2k|	ptr = fmtcheck(desc, def);
  167|  29.2k|	if (ptr == def)
  ------------------
  |  Branch (167:6): [True: 0, False: 29.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|  29.2k|	return ptr;
  172|  87.9k|}
softmagic.c:save_cont:
 1554|  49.4k|{
 1555|  49.4k|	size_t len;
 1556|  49.4k|	*c = ms->c;
 1557|  49.4k|	len = c->len * sizeof(*c->li);
 1558|  49.4k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  426|  49.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1559|  49.4k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1559:6): [True: 0, False: 49.4k]
  ------------------
 1560|      0|		ms->c = *c;
 1561|      0|		return -1;
 1562|      0|	}
 1563|  49.4k|	memcpy(ms->c.li, c->li, len);
 1564|  49.4k|	return 0;
 1565|  49.4k|}
softmagic.c:restore_cont:
 1569|  49.4k|{
 1570|  49.4k|	free(ms->c.li);
 1571|  49.4k|	ms->c = *c;
 1572|  49.4k|}
softmagic.c:mconvert:
 1149|  52.7M|{
 1150|  52.7M|	union VALUETYPE *p = &ms->ms_value;
 1151|       |
 1152|  52.7M|	switch (cvt_flip(m->type, flip)) {
 1153|   660k|	case FILE_BYTE:
  ------------------
  |  |  223|   660k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1153:2): [True: 660k, False: 52.0M]
  ------------------
 1154|   660k|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1154:7): [True: 0, False: 660k]
  ------------------
 1155|      0|			goto out;
 1156|   660k|		return 1;
 1157|   609k|	case FILE_SHORT:
  ------------------
  |  |  224|   609k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1157:2): [True: 609k, False: 52.1M]
  ------------------
 1158|   609k|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|   609k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1158:2): [True: 0, False: 52.7M]
  ------------------
 1159|   609k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|   609k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1159:2): [True: 0, False: 52.7M]
  ------------------
 1160|   609k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|   609k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1160:2): [True: 0, False: 52.7M]
  ------------------
 1161|   609k|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|   609k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1161:2): [True: 0, False: 52.7M]
  ------------------
 1162|   609k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|   609k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1162:2): [True: 0, False: 52.7M]
  ------------------
 1163|   609k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|   609k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1163:2): [True: 0, False: 52.7M]
  ------------------
 1164|   609k|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1164:7): [True: 0, False: 609k]
  ------------------
 1165|      0|			goto out;
 1166|   609k|		return 1;
 1167|   910k|	case FILE_LONG:
  ------------------
  |  |  226|   910k|#define				FILE_LONG		4
  ------------------
  |  Branch (1167:2): [True: 910k, False: 51.8M]
  ------------------
 1168|   910k|	case FILE_DATE:
  ------------------
  |  |  228|   910k|#define				FILE_DATE		6
  ------------------
  |  Branch (1168:2): [True: 0, False: 52.7M]
  ------------------
 1169|   910k|	case FILE_LDATE:
  ------------------
  |  |  236|   910k|#define				FILE_LDATE		14
  ------------------
  |  Branch (1169:2): [True: 0, False: 52.7M]
  ------------------
 1170|   910k|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1170:7): [True: 0, False: 910k]
  ------------------
 1171|      0|			goto out;
 1172|   910k|		return 1;
 1173|  40.8k|	case FILE_QUAD:
  ------------------
  |  |  246|  40.8k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1173:2): [True: 40.8k, False: 52.6M]
  ------------------
 1174|  40.8k|	case FILE_QDATE:
  ------------------
  |  |  249|  40.8k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1174:2): [True: 0, False: 52.7M]
  ------------------
 1175|  40.8k|	case FILE_QLDATE:
  ------------------
  |  |  252|  40.8k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1175:2): [True: 0, False: 52.7M]
  ------------------
 1176|  41.0k|	case FILE_QWDATE:
  ------------------
  |  |  264|  41.0k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1176:2): [True: 112, False: 52.7M]
  ------------------
 1177|  41.0k|	case FILE_OFFSET:
  ------------------
  |  |  272|  41.0k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1177:2): [True: 0, False: 52.7M]
  ------------------
 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|  33.2M|	case FILE_STRING:
  ------------------
  |  |  227|  33.2M|#define				FILE_STRING		5
  ------------------
  |  Branch (1181:2): [True: 33.2M, False: 19.4M]
  ------------------
 1182|  33.2M|	case FILE_BESTRING16:
  ------------------
  |  |  240|  33.2M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1182:2): [True: 105, False: 52.7M]
  ------------------
 1183|  33.2M|	case FILE_LESTRING16:
  ------------------
  |  |  241|  33.2M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1183:2): [True: 39.7k, False: 52.6M]
  ------------------
 1184|  33.2M|	case FILE_OCTAL: {
  ------------------
  |  |  281|  33.2M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1184:2): [True: 0, False: 52.7M]
  ------------------
 1185|       |		/* Null terminate and eat *trailing* return */
 1186|  33.2M|		p->s[sizeof(p->s) - 1] = '\0';
 1187|  33.2M|		return 1;
 1188|  33.2M|	}
 1189|  16.9k|	case FILE_PSTRING: {
  ------------------
  |  |  235|  16.9k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1189:2): [True: 16.9k, False: 52.7M]
  ------------------
 1190|  16.9k|		char *ptr1, *ptr2;
 1191|  16.9k|		size_t len, sz = file_pstring_length_size(ms, m);
 1192|  16.9k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  158|  16.9k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  16.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1192:7): [True: 0, False: 16.9k]
  ------------------
 1193|      0|			return 0;
 1194|  16.9k|		ptr1 = p->s;
 1195|  16.9k|		ptr2 = ptr1 + sz;
 1196|  16.9k|		len = file_pstring_get_length(ms, m, ptr1);
 1197|  16.9k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  158|  16.9k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  16.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1197:7): [True: 50, False: 16.8k]
  ------------------
 1198|     50|			return 0;
 1199|  16.8k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1200|  16.8k|		if (len >= sz) {
  ------------------
  |  Branch (1200:7): [True: 10.0k, False: 6.78k]
  ------------------
 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|  10.0k|			len = sz;
 1210|  10.0k|		}
 1211|  1.60M|		while (len--)
  ------------------
  |  Branch (1211:10): [True: 1.58M, False: 16.8k]
  ------------------
 1212|  1.58M|			*ptr1++ = *ptr2++;
 1213|  16.8k|		*ptr1 = '\0';
 1214|  16.8k|		return 1;
 1215|  16.9k|	}
 1216|  2.57M|	case FILE_BESHORT:
  ------------------
  |  |  229|  2.57M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1216:2): [True: 2.57M, False: 50.1M]
  ------------------
 1217|  2.57M|		p->h = CAST(short, BE16(p));
  ------------------
  |  |  426|  2.57M|#define CAST(T, b)	((T)(b))
  ------------------
 1218|  2.57M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1218:7): [True: 0, False: 2.57M]
  ------------------
 1219|      0|			goto out;
 1220|  2.57M|		return 1;
 1221|  7.77M|	case FILE_BELONG:
  ------------------
  |  |  230|  7.77M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1221:2): [True: 7.77M, False: 44.9M]
  ------------------
 1222|  7.77M|	case FILE_BEDATE:
  ------------------
  |  |  231|  7.77M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1222:2): [True: 120, False: 52.7M]
  ------------------
 1223|  7.77M|	case FILE_BELDATE:
  ------------------
  |  |  237|  7.77M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1223:2): [True: 127, False: 52.7M]
  ------------------
 1224|  7.77M|		p->l = CAST(int32_t, BE32(p));
  ------------------
  |  |  426|  7.77M|#define CAST(T, b)	((T)(b))
  ------------------
 1225|  7.77M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1225:7): [True: 0, False: 7.77M]
  ------------------
 1226|      0|			goto out;
 1227|  7.77M|		return 1;
 1228|   540k|	case FILE_BEQUAD:
  ------------------
  |  |  248|   540k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1228:2): [True: 540k, False: 52.1M]
  ------------------
 1229|   540k|	case FILE_BEQDATE:
  ------------------
  |  |  251|   540k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1229:2): [True: 74, False: 52.7M]
  ------------------
 1230|   540k|	case FILE_BEQLDATE:
  ------------------
  |  |  254|   540k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1230:2): [True: 15, False: 52.7M]
  ------------------
 1231|   540k|	case FILE_BEQWDATE:
  ------------------
  |  |  266|   540k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1231:2): [True: 0, False: 52.7M]
  ------------------
 1232|   540k|		p->q = CAST(uint64_t, BE64(p));
  ------------------
  |  |  426|   540k|#define CAST(T, b)	((T)(b))
  ------------------
 1233|   540k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1233:7): [True: 0, False: 540k]
  ------------------
 1234|      0|			goto out;
 1235|   540k|		return 1;
 1236|  1.60M|	case FILE_LESHORT:
  ------------------
  |  |  232|  1.60M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1236:2): [True: 1.60M, False: 51.1M]
  ------------------
 1237|  1.60M|		p->h = CAST(short, LE16(p));
  ------------------
  |  |  426|  1.60M|#define CAST(T, b)	((T)(b))
  ------------------
 1238|  1.60M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1238:7): [True: 0, False: 1.60M]
  ------------------
 1239|      0|			goto out;
 1240|  1.60M|		return 1;
 1241|  3.38M|	case FILE_LELONG:
  ------------------
  |  |  233|  3.38M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1241:2): [True: 3.38M, False: 49.3M]
  ------------------
 1242|  3.38M|	case FILE_LEDATE:
  ------------------
  |  |  234|  3.38M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1242:2): [True: 251, False: 52.7M]
  ------------------
 1243|  3.38M|	case FILE_LELDATE:
  ------------------
  |  |  238|  3.38M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1243:2): [True: 61, False: 52.7M]
  ------------------
 1244|  3.38M|		p->l = CAST(int32_t, LE32(p));
  ------------------
  |  |  426|  3.38M|#define CAST(T, b)	((T)(b))
  ------------------
 1245|  3.38M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1245:7): [True: 0, False: 3.38M]
  ------------------
 1246|      0|			goto out;
 1247|  3.38M|		return 1;
 1248|   479k|	case FILE_LEQUAD:
  ------------------
  |  |  247|   479k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1248:2): [True: 479k, False: 52.2M]
  ------------------
 1249|   479k|	case FILE_LEQDATE:
  ------------------
  |  |  250|   479k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1249:2): [True: 108, False: 52.7M]
  ------------------
 1250|   479k|	case FILE_LEQLDATE:
  ------------------
  |  |  253|   479k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1250:2): [True: 18, False: 52.7M]
  ------------------
 1251|   480k|	case FILE_LEQWDATE:
  ------------------
  |  |  265|   480k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1251:2): [True: 753, False: 52.7M]
  ------------------
 1252|   480k|		p->q = CAST(uint64_t, LE64(p));
  ------------------
  |  |  426|   480k|#define CAST(T, b)	((T)(b))
  ------------------
 1253|   480k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1253:7): [True: 0, False: 480k]
  ------------------
 1254|      0|			goto out;
 1255|   480k|		return 1;
 1256|      0|	case FILE_MELONG:
  ------------------
  |  |  245|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1256:2): [True: 0, False: 52.7M]
  ------------------
 1257|     68|	case FILE_MEDATE:
  ------------------
  |  |  243|     68|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1257:2): [True: 68, False: 52.7M]
  ------------------
 1258|     68|	case FILE_MELDATE:
  ------------------
  |  |  244|     68|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1258:2): [True: 0, False: 52.7M]
  ------------------
 1259|     68|		p->l = CAST(int32_t, ME32(p));
  ------------------
  |  |  426|     68|#define CAST(T, b)	((T)(b))
  ------------------
 1260|     68|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1260:7): [True: 0, False: 68]
  ------------------
 1261|      0|			goto out;
 1262|     68|		return 1;
 1263|      0|	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1263:2): [True: 0, False: 52.7M]
  ------------------
 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: 52.7M]
  ------------------
 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|    394|	case FILE_LEFLOAT:
  ------------------
  |  |  257|    394|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1272:2): [True: 394, False: 52.7M]
  ------------------
 1273|    394|		p->l = LE32(p);
  ------------------
  |  |   89|    394|#define LE32(p) ( \
  |  |   90|    394|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  426|    394|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   91|    394|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  426|    394|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|    394|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  426|    394|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|    394|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  426|    394|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1274|    394|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1274:7): [True: 0, False: 394]
  ------------------
 1275|      0|			goto out;
 1276|    394|		return 1;
 1277|      0|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1277:2): [True: 0, False: 52.7M]
  ------------------
 1278|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1278:7): [True: 0, False: 0]
  ------------------
 1279|      0|			goto out;
 1280|      0|		return 1;
 1281|    121|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|    121|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1281:2): [True: 121, False: 52.7M]
  ------------------
 1282|    121|		p->q = BE64(p);
  ------------------
  |  |   71|    121|#define BE64(p) ( \
  |  |   72|    121|    (CAST(uint64_t, (p)->hq[0])<<56)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    121|    (CAST(uint64_t, (p)->hq[1])<<48)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   74|    121|    (CAST(uint64_t, (p)->hq[2])<<40)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    121|    (CAST(uint64_t, (p)->hq[3])<<32)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    121|    (CAST(uint64_t, (p)->hq[4])<<24)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    121|    (CAST(uint64_t, (p)->hq[5])<<16)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    121|    (CAST(uint64_t, (p)->hq[6])<<8)| \
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    121|    (CAST(uint64_t, (p)->hq[7])))
  |  |  ------------------
  |  |  |  |  426|    121|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1283|    121|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1283:7): [True: 0, False: 121]
  ------------------
 1284|      0|			goto out;
 1285|    121|		return 1;
 1286|    370|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    370|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1286:2): [True: 370, False: 52.7M]
  ------------------
 1287|    370|		p->q = LE64(p);
  ------------------
  |  |   80|    370|#define LE64(p) ( \
  |  |   81|    370|    (CAST(uint64_t, (p)->hq[7])<<56)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   82|    370|    (CAST(uint64_t, (p)->hq[6])<<48)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   83|    370|    (CAST(uint64_t, (p)->hq[5])<<40)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    370|    (CAST(uint64_t, (p)->hq[4])<<32)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    370|    (CAST(uint64_t, (p)->hq[3])<<24)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    370|    (CAST(uint64_t, (p)->hq[2])<<16)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    370|    (CAST(uint64_t, (p)->hq[1])<<8)| \
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    370|    (CAST(uint64_t, (p)->hq[0])))
  |  |  ------------------
  |  |  |  |  426|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1288|    370|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1288:7): [True: 0, False: 370]
  ------------------
 1289|      0|			goto out;
 1290|    370|		return 1;
 1291|   156k|	case FILE_REGEX:
  ------------------
  |  |  239|   156k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1291:2): [True: 156k, False: 52.5M]
  ------------------
 1292|   544k|	case FILE_SEARCH:
  ------------------
  |  |  242|   544k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1292:2): [True: 388k, False: 52.3M]
  ------------------
 1293|   548k|	case FILE_DEFAULT:
  ------------------
  |  |  225|   548k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1293:2): [True: 3.69k, False: 52.7M]
  ------------------
 1294|   548k|	case FILE_CLEAR:
  ------------------
  |  |  269|   548k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1294:2): [True: 266, False: 52.7M]
  ------------------
 1295|   548k|	case FILE_NAME:
  ------------------
  |  |  267|   548k|#define				FILE_NAME		45
  ------------------
  |  Branch (1295:2): [True: 0, False: 52.7M]
  ------------------
 1296|   548k|	case FILE_USE:
  ------------------
  |  |  268|   548k|#define				FILE_USE		46
  ------------------
  |  Branch (1296:2): [True: 0, False: 52.7M]
  ------------------
 1297|   801k|	case FILE_DER:
  ------------------
  |  |  270|   801k|#define				FILE_DER		48
  ------------------
  |  Branch (1297:2): [True: 252k, False: 52.4M]
  ------------------
 1298|   834k|	case FILE_GUID:
  ------------------
  |  |  271|   834k|#define				FILE_GUID		49
  ------------------
  |  Branch (1298:2): [True: 33.2k, False: 52.7M]
  ------------------
 1299|   834k|		return 1;
 1300|      0|	default:
  ------------------
  |  Branch (1300:2): [True: 0, False: 52.7M]
  ------------------
 1301|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1302|      0|		return 0;
 1303|  52.7M|	}
 1304|      0|out:
 1305|      0|	file_magerror(ms, "zerodivide in mconvert()");
 1306|      0|	return 0;
 1307|  52.7M|}
softmagic.c:cvt_8:
 1083|   660k|{
 1084|   660k|	DO_CVT(b, uint8_t);
  ------------------
  |  | 1047|   660k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|   660k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 54.3k, False: 605k]
  |  |  ------------------
  |  | 1048|   660k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|  54.3k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 54.3k]
  |  |  ------------------
  |  | 1049|  43.9k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|  43.9k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 43.9k, False: 10.4k]
  |  |  ------------------
  |  | 1050|  43.9k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  43.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|  43.9k|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 54.3k]
  |  |  ------------------
  |  | 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: 54.3k]
  |  |  ------------------
  |  | 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: 54.3k]
  |  |  ------------------
  |  | 1059|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|  10.2k|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|  10.2k|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 10.2k, False: 44.1k]
  |  |  ------------------
  |  | 1062|  10.2k|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  10.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|  10.2k|			break; \
  |  | 1064|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 54.3k]
  |  |  ------------------
  |  | 1065|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|    137|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|    137|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 137, False: 54.2k]
  |  |  ------------------
  |  | 1068|    137|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|    137|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 137]
  |  |  ------------------
  |  | 1069|    137|				return -1; \
  |  | 1070|    137|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    137|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|    137|			break; \
  |  | 1072|    137|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|     48|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 48, False: 54.3k]
  |  |  ------------------
  |  | 1073|     48|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|     48|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 48]
  |  |  ------------------
  |  | 1074|     48|				return -1; \
  |  | 1075|     48|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     48|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|     48|			break; \
  |  | 1077|  54.3k|		} \
  |  | 1078|   660k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|   660k|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 660k]
  |  |  ------------------
  |  | 1079|   660k|		p->fld = ~p->fld \
  ------------------
 1085|   660k|	return 0;
 1086|   660k|}
softmagic.c:cvt_16:
 1090|  4.79M|{
 1091|  4.79M|	DO_CVT(h, uint16_t);
  ------------------
  |  | 1047|  4.79M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|  4.79M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 319k, False: 4.47M]
  |  |  ------------------
  |  | 1048|  4.79M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|   319k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 319k]
  |  |  ------------------
  |  | 1049|   301k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|   301k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 301k, False: 17.7k]
  |  |  ------------------
  |  | 1050|   301k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|   301k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|   301k|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 319k]
  |  |  ------------------
  |  | 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: 319k]
  |  |  ------------------
  |  | 1056|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|    101|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|    101|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 101, False: 319k]
  |  |  ------------------
  |  | 1059|    101|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    101|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|    101|			break; \
  |  | 1061|     89|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|     89|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 89, False: 319k]
  |  |  ------------------
  |  | 1062|     89|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     89|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     89|			break; \
  |  | 1064|     73|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|     73|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 73, False: 319k]
  |  |  ------------------
  |  | 1065|     73|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     73|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|     73|			break; \
  |  | 1067|     54|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|     54|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 54, False: 319k]
  |  |  ------------------
  |  | 1068|     54|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|     54|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 54]
  |  |  ------------------
  |  | 1069|     54|				return -1; \
  |  | 1070|     54|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     54|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|     54|			break; \
  |  | 1072|  17.4k|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|  17.4k|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 17.4k, False: 302k]
  |  |  ------------------
  |  | 1073|  17.4k|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|  17.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 17.4k]
  |  |  ------------------
  |  | 1074|  17.4k|				return -1; \
  |  | 1075|  17.4k|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  17.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|  17.4k|			break; \
  |  | 1077|   319k|		} \
  |  | 1078|  4.79M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|  4.79M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 4.79M]
  |  |  ------------------
  |  | 1079|  4.79M|		p->fld = ~p->fld \
  ------------------
 1092|  4.79M|	return 0;
 1093|  4.79M|}
softmagic.c:cvt_32:
 1097|  12.0M|{
 1098|  12.0M|	DO_CVT(l, uint32_t);
  ------------------
  |  | 1047|  12.0M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|  12.0M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 2.33M, False: 9.73M]
  |  |  ------------------
  |  | 1048|  12.0M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|  2.33M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 2.33M]
  |  |  ------------------
  |  | 1049|  2.33M|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|  2.33M|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 2.33M, False: 986]
  |  |  ------------------
  |  | 1050|  2.33M|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  2.33M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|  2.33M|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 2.33M]
  |  |  ------------------
  |  | 1053|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|      0|			break; \
  |  | 1055|     29|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  321|     29|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 29, False: 2.33M]
  |  |  ------------------
  |  | 1056|     29|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     29|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|     29|			break; \
  |  | 1058|     68|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|     68|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 68, False: 2.33M]
  |  |  ------------------
  |  | 1059|     68|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     68|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|     68|			break; \
  |  | 1061|    102|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|    102|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 102, False: 2.33M]
  |  |  ------------------
  |  | 1062|    102|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    102|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|    102|			break; \
  |  | 1064|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  324|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 2.33M]
  |  |  ------------------
  |  | 1065|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|    509|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|    509|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 509, False: 2.33M]
  |  |  ------------------
  |  | 1068|    509|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|    509|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 509]
  |  |  ------------------
  |  | 1069|    509|				return -1; \
  |  | 1070|    509|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    509|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|    509|			break; \
  |  | 1072|    509|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|    278|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 278, False: 2.33M]
  |  |  ------------------
  |  | 1073|    278|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|    278|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1073:8): [True: 0, False: 278]
  |  |  ------------------
  |  | 1074|    278|				return -1; \
  |  | 1075|    278|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|    278|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1076|    278|			break; \
  |  | 1077|  2.33M|		} \
  |  | 1078|  12.0M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|  12.0M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 12.0M]
  |  |  ------------------
  |  | 1079|  12.0M|		p->fld = ~p->fld \
  ------------------
 1099|  12.0M|	return 0;
 1100|  12.0M|}
softmagic.c:cvt_64:
 1104|  1.06M|{
 1105|  1.06M|	DO_CVT(q, uint64_t);
  ------------------
  |  | 1047|  1.06M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|  1.06M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1047:6): [True: 99.3k, False: 962k]
  |  |  ------------------
  |  | 1048|  1.06M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  327|  99.3k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1048:11): [True: 0, False: 99.3k]
  |  |  ------------------
  |  | 1049|  99.2k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  319|  99.2k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1049:3): [True: 99.2k, False: 73]
  |  |  ------------------
  |  | 1050|  99.2k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|  99.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1051|  99.2k|			break; \
  |  | 1052|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  320|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 0, False: 99.3k]
  |  |  ------------------
  |  | 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: 99.3k]
  |  |  ------------------
  |  | 1056|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|     36|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  322|     36|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 36, False: 99.2k]
  |  |  ------------------
  |  | 1059|     36|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     36|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|     36|			break; \
  |  | 1061|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  323|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 0, False: 99.3k]
  |  |  ------------------
  |  | 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: 99.3k]
  |  |  ------------------
  |  | 1065|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|     37|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  325|     37|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 37, False: 99.2k]
  |  |  ------------------
  |  | 1068|     37|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  426|     37|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1068:8): [True: 0, False: 37]
  |  |  ------------------
  |  | 1069|     37|				return -1; \
  |  | 1070|     37|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  426|     37|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1071|     37|			break; \
  |  | 1072|     37|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  326|      0|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1072:3): [True: 0, False: 99.3k]
  |  |  ------------------
  |  | 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|  99.3k|		} \
  |  | 1078|  1.06M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  331|  1.06M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1078:6): [True: 0, False: 1.06M]
  |  |  ------------------
  |  | 1079|  1.06M|		p->fld = ~p->fld \
  ------------------
 1106|  1.06M|	return 0;
 1107|  1.06M|}
softmagic.c:cvt_float:
 1130|    394|{
 1131|    394|	DO_CVT2(f, float);
  ------------------
  |  | 1110|    394|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|    394|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1110:6): [True: 0, False: 394]
  |  |  ------------------
  |  | 1111|    394|		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|    394|	return 0;
 1133|    394|}
softmagic.c:cvt_double:
 1137|    491|{
 1138|    491|	DO_CVT2(d, double);
  ------------------
  |  | 1110|    491|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  355|    491|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1110:6): [True: 0, False: 491]
  |  |  ------------------
  |  | 1111|    491|		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|    491|	return 0;
 1140|    491|}
softmagic.c:magiccheck:
 2084|  52.8M|{
 2085|  52.8M|	uint64_t l = m->value.q;
 2086|  52.8M|	uint64_t v;
 2087|  52.8M|	float fl, fv;
 2088|  52.8M|	double dl, dv;
 2089|  52.8M|	int matched;
 2090|  52.8M|	union VALUETYPE *p = &ms->ms_value;
 2091|       |
 2092|  52.8M|	switch (m->type) {
 2093|   660k|	case FILE_BYTE:
  ------------------
  |  |  223|   660k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2093:2): [True: 660k, False: 52.1M]
  ------------------
 2094|   660k|		v = p->b;
 2095|   660k|		break;
 2096|       |
 2097|   609k|	case FILE_SHORT:
  ------------------
  |  |  224|   609k|#define				FILE_SHORT		2
  ------------------
  |  Branch (2097:2): [True: 609k, False: 52.2M]
  ------------------
 2098|  3.14M|	case FILE_BESHORT:
  ------------------
  |  |  229|  3.14M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2098:2): [True: 2.53M, False: 50.3M]
  ------------------
 2099|  4.79M|	case FILE_LESHORT:
  ------------------
  |  |  232|  4.79M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2099:2): [True: 1.64M, False: 51.2M]
  ------------------
 2100|  4.79M|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|  4.79M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (2100:2): [True: 0, False: 52.8M]
  ------------------
 2101|  4.79M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|  4.79M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (2101:2): [True: 0, False: 52.8M]
  ------------------
 2102|  4.79M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|  4.79M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (2102:2): [True: 0, False: 52.8M]
  ------------------
 2103|  4.79M|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|  4.79M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (2103:2): [True: 0, False: 52.8M]
  ------------------
 2104|  4.79M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|  4.79M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (2104:2): [True: 0, False: 52.8M]
  ------------------
 2105|  4.79M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|  4.79M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (2105:2): [True: 0, False: 52.8M]
  ------------------
 2106|  4.79M|		v = p->h;
 2107|  4.79M|		break;
 2108|       |
 2109|   910k|	case FILE_LONG:
  ------------------
  |  |  226|   910k|#define				FILE_LONG		4
  ------------------
  |  Branch (2109:2): [True: 910k, False: 51.9M]
  ------------------
 2110|  8.68M|	case FILE_BELONG:
  ------------------
  |  |  230|  8.68M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2110:2): [True: 7.77M, False: 45.0M]
  ------------------
 2111|  12.0M|	case FILE_LELONG:
  ------------------
  |  |  233|  12.0M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2111:2): [True: 3.38M, False: 49.4M]
  ------------------
 2112|  12.0M|	case FILE_MELONG:
  ------------------
  |  |  245|  12.0M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2112:2): [True: 0, False: 52.8M]
  ------------------
 2113|  12.0M|	case FILE_DATE:
  ------------------
  |  |  228|  12.0M|#define				FILE_DATE		6
  ------------------
  |  Branch (2113:2): [True: 0, False: 52.8M]
  ------------------
 2114|  12.0M|	case FILE_BEDATE:
  ------------------
  |  |  231|  12.0M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2114:2): [True: 123, False: 52.8M]
  ------------------
 2115|  12.0M|	case FILE_LEDATE:
  ------------------
  |  |  234|  12.0M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2115:2): [True: 248, False: 52.8M]
  ------------------
 2116|  12.0M|	case FILE_MEDATE:
  ------------------
  |  |  243|  12.0M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2116:2): [True: 68, False: 52.8M]
  ------------------
 2117|  12.0M|	case FILE_LDATE:
  ------------------
  |  |  236|  12.0M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2117:2): [True: 0, False: 52.8M]
  ------------------
 2118|  12.0M|	case FILE_BELDATE:
  ------------------
  |  |  237|  12.0M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2118:2): [True: 127, False: 52.8M]
  ------------------
 2119|  12.0M|	case FILE_LELDATE:
  ------------------
  |  |  238|  12.0M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2119:2): [True: 61, False: 52.8M]
  ------------------
 2120|  12.0M|	case FILE_MELDATE:
  ------------------
  |  |  244|  12.0M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2120:2): [True: 0, False: 52.8M]
  ------------------
 2121|  12.0M|		v = p->l;
 2122|  12.0M|		break;
 2123|       |
 2124|  40.8k|	case FILE_QUAD:
  ------------------
  |  |  246|  40.8k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2124:2): [True: 40.8k, False: 52.8M]
  ------------------
 2125|   520k|	case FILE_LEQUAD:
  ------------------
  |  |  247|   520k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2125:2): [True: 479k, False: 52.3M]
  ------------------
 2126|  1.06M|	case FILE_BEQUAD:
  ------------------
  |  |  248|  1.06M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2126:2): [True: 540k, False: 52.3M]
  ------------------
 2127|  1.06M|	case FILE_QDATE:
  ------------------
  |  |  249|  1.06M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2127:2): [True: 0, False: 52.8M]
  ------------------
 2128|  1.06M|	case FILE_BEQDATE:
  ------------------
  |  |  251|  1.06M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2128:2): [True: 182, False: 52.8M]
  ------------------
 2129|  1.06M|	case FILE_LEQDATE:
  ------------------
  |  |  250|  1.06M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2129:2): [True: 0, False: 52.8M]
  ------------------
 2130|  1.06M|	case FILE_QLDATE:
  ------------------
  |  |  252|  1.06M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2130:2): [True: 0, False: 52.8M]
  ------------------
 2131|  1.06M|	case FILE_BEQLDATE:
  ------------------
  |  |  254|  1.06M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2131:2): [True: 15, False: 52.8M]
  ------------------
 2132|  1.06M|	case FILE_LEQLDATE:
  ------------------
  |  |  253|  1.06M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2132:2): [True: 18, False: 52.8M]
  ------------------
 2133|  1.06M|	case FILE_QWDATE:
  ------------------
  |  |  264|  1.06M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2133:2): [True: 112, False: 52.8M]
  ------------------
 2134|  1.06M|	case FILE_BEQWDATE:
  ------------------
  |  |  266|  1.06M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2134:2): [True: 0, False: 52.8M]
  ------------------
 2135|  1.06M|	case FILE_LEQWDATE:
  ------------------
  |  |  265|  1.06M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2135:2): [True: 753, False: 52.8M]
  ------------------
 2136|  1.06M|	case FILE_OFFSET:
  ------------------
  |  |  272|  1.06M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (2136:2): [True: 0, False: 52.8M]
  ------------------
 2137|  1.06M|		v = p->q;
 2138|  1.06M|		break;
 2139|       |
 2140|      0|	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2140:2): [True: 0, False: 52.8M]
  ------------------
 2141|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2141:2): [True: 0, False: 52.8M]
  ------------------
 2142|    394|	case FILE_LEFLOAT:
  ------------------
  |  |  257|    394|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2142:2): [True: 394, False: 52.8M]
  ------------------
 2143|    394|		fl = m->value.f;
 2144|    394|		fv = p->f;
 2145|    394|		switch (m->reln) {
 2146|    147|		case 'x':
  ------------------
  |  Branch (2146:3): [True: 147, False: 247]
  ------------------
 2147|    147|			matched = 1;
 2148|    147|			break;
 2149|       |
 2150|      0|		case '!':
  ------------------
  |  Branch (2150:3): [True: 0, False: 394]
  ------------------
 2151|      0|			matched = fv != fl;
 2152|      0|			break;
 2153|       |
 2154|      0|		case '=':
  ------------------
  |  Branch (2154:3): [True: 0, False: 394]
  ------------------
 2155|      0|			matched = fv == fl;
 2156|      0|			break;
 2157|       |
 2158|    247|		case '>':
  ------------------
  |  Branch (2158:3): [True: 247, False: 147]
  ------------------
 2159|    247|			matched = fv > fl;
 2160|    247|			break;
 2161|       |
 2162|      0|		case '<':
  ------------------
  |  Branch (2162:3): [True: 0, False: 394]
  ------------------
 2163|      0|			matched = fv < fl;
 2164|      0|			break;
 2165|       |
 2166|      0|		default:
  ------------------
  |  Branch (2166:3): [True: 0, False: 394]
  ------------------
 2167|      0|			file_magerror(ms, "cannot happen with float: "
 2168|      0|			    "invalid relation `%c'", m->reln);
 2169|      0|			return -1;
 2170|    394|		}
 2171|    394|		return matched;
 2172|       |
 2173|      0|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2173:2): [True: 0, False: 52.8M]
  ------------------
 2174|    121|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|    121|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2174:2): [True: 121, False: 52.8M]
  ------------------
 2175|    491|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    491|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2175:2): [True: 370, False: 52.8M]
  ------------------
 2176|    491|		dl = m->value.d;
 2177|    491|		dv = p->d;
 2178|    491|		switch (m->reln) {
 2179|    352|		case 'x':
  ------------------
  |  Branch (2179:3): [True: 352, False: 139]
  ------------------
 2180|    352|			matched = 1;
 2181|    352|			break;
 2182|       |
 2183|      0|		case '!':
  ------------------
  |  Branch (2183:3): [True: 0, False: 491]
  ------------------
 2184|      0|			matched = dv != dl;
 2185|      0|			break;
 2186|       |
 2187|    139|		case '=':
  ------------------
  |  Branch (2187:3): [True: 139, False: 352]
  ------------------
 2188|    139|			matched = dv == dl;
 2189|    139|			break;
 2190|       |
 2191|      0|		case '>':
  ------------------
  |  Branch (2191:3): [True: 0, False: 491]
  ------------------
 2192|      0|			matched = dv > dl;
 2193|      0|			break;
 2194|       |
 2195|      0|		case '<':
  ------------------
  |  Branch (2195:3): [True: 0, False: 491]
  ------------------
 2196|      0|			matched = dv < dl;
 2197|      0|			break;
 2198|       |
 2199|      0|		default:
  ------------------
  |  Branch (2199:3): [True: 0, False: 491]
  ------------------
 2200|      0|			file_magerror(ms, "cannot happen with double: "
 2201|      0|			    "invalid relation `%c'", m->reln);
 2202|      0|			return -1;
 2203|    491|		}
 2204|    491|		return matched;
 2205|       |
 2206|  3.69k|	case FILE_DEFAULT:
  ------------------
  |  |  225|  3.69k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2206:2): [True: 3.69k, False: 52.8M]
  ------------------
 2207|  3.96k|	case FILE_CLEAR:
  ------------------
  |  |  269|  3.96k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2207:2): [True: 266, False: 52.8M]
  ------------------
 2208|  3.96k|		l = 0;
 2209|  3.96k|		v = 0;
 2210|  3.96k|		break;
 2211|       |
 2212|  33.2M|	case FILE_STRING:
  ------------------
  |  |  227|  33.2M|#define				FILE_STRING		5
  ------------------
  |  Branch (2212:2): [True: 33.2M, False: 19.5M]
  ------------------
 2213|  33.2M|	case FILE_PSTRING:
  ------------------
  |  |  235|  33.2M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2213:2): [True: 16.8k, False: 52.8M]
  ------------------
 2214|  33.2M|	case FILE_OCTAL:
  ------------------
  |  |  281|  33.2M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (2214:2): [True: 0, False: 52.8M]
  ------------------
 2215|  33.2M|		l = 0;
 2216|  33.2M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  426|  33.2M|#define CAST(T, b)	((T)(b))
  ------------------
 2217|  33.2M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  357|  33.2M|#define str_flags _u._s._flags
  ------------------
 2218|  33.2M|		break;
 2219|       |
 2220|    105|	case FILE_BESTRING16:
  ------------------
  |  |  240|    105|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2220:2): [True: 105, False: 52.8M]
  ------------------
 2221|  39.8k|	case FILE_LESTRING16:
  ------------------
  |  |  241|  39.8k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2221:2): [True: 39.7k, False: 52.8M]
  ------------------
 2222|  39.8k|		l = 0;
 2223|  39.8k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  426|  39.8k|#define CAST(T, b)	((T)(b))
  ------------------
 2224|  39.8k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  357|  39.8k|#define str_flags _u._s._flags
  ------------------
 2225|  39.8k|		break;
 2226|       |
 2227|   388k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  242|   388k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2227:2): [True: 388k, False: 52.4M]
  ------------------
 2228|   388k|		size_t slen;
 2229|   388k|		size_t idx;
 2230|       |
 2231|   388k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2231:7): [True: 0, False: 388k]
  ------------------
 2232|      0|			return 0;
 2233|       |
 2234|   388k|		slen = MIN(m->vallen, sizeof(m->value.s));
 2235|   388k|		l = 0;
 2236|   388k|		v = 0;
 2237|   388k|#ifdef HAVE_MEMMEM
 2238|   388k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  357|   388k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2238:7): [True: 388k, False: 0]
  |  Branch (2238:19): [True: 240k, False: 148k]
  ------------------
 2239|   240k|			const char *found;
 2240|   240k|			idx = m->str_range + slen;
  ------------------
  |  |  356|   240k|#define str_range _u._s._count
  ------------------
 2241|   240k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  356|   240k|#define str_range _u._s._count
  ------------------
  |  Branch (2241:8): [True: 2.51k, False: 237k]
  |  Branch (2241:29): [True: 104k, False: 133k]
  ------------------
 2242|   106k|				idx = ms->search.s_len;
 2243|   240k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  426|   240k|#define CAST(T, b)	((T)(b))
  ------------------
 2244|   240k|			    m->value.s, slen));
 2245|   240k|			if (!found) {
  ------------------
  |  Branch (2245:8): [True: 237k, False: 2.45k]
  ------------------
 2246|   237k|				v = 1;
 2247|   237k|				break;
 2248|   237k|			}
 2249|  2.45k|			idx = found - ms->search.s;
 2250|  2.45k|			ms->search.offset += idx;
 2251|  2.45k|			ms->search.rm_len = ms->search.s_len - idx;
 2252|  2.45k|			break;
 2253|   240k|		}
 2254|   148k|#endif
 2255|       |
 2256|  27.9M|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  356|  27.9M|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  356|  27.9M|#define str_range _u._s._count
  ------------------
  |  Branch (2256:17): [True: 0, False: 27.9M]
  |  Branch (2256:38): [True: 27.8M, False: 75.6k]
  ------------------
 2257|  27.8M|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2257:8): [True: 72.2k, False: 27.7M]
  ------------------
 2258|  72.2k|				v = 1;
 2259|  72.2k|				break;
 2260|  72.2k|			}
 2261|       |
 2262|  27.7M|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2263|  27.7M|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  357|  27.7M|#define str_flags _u._s._flags
  ------------------
 2264|  27.7M|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2264:8): [True: 348, False: 27.7M]
  ------------------
 2265|    348|				ms->search.offset += idx;
 2266|    348|				ms->search.rm_len = ms->search.s_len - idx;
 2267|    348|				break;
 2268|    348|			}
 2269|  27.7M|		}
 2270|   148k|		break;
 2271|   388k|	}
 2272|   156k|	case FILE_REGEX: {
  ------------------
  |  |  239|   156k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2272:2): [True: 156k, False: 52.6M]
  ------------------
 2273|   156k|		int rc;
 2274|   156k|		file_regex_t *rx = *m_cache;
 2275|   156k|		const char *search;
 2276|   156k|		regmatch_t pmatch;
 2277|   156k|		size_t slen = ms->search.s_len;
 2278|   156k|		char *copy;
 2279|       |
 2280|   156k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2280:7): [True: 32, False: 156k]
  ------------------
 2281|     32|			return 0;
 2282|       |
 2283|   156k|		if (rx == NULL) {
  ------------------
  |  Branch (2283:7): [True: 133, False: 156k]
  ------------------
 2284|    133|			rx = *m_cache = alloc_regex(ms, m);
 2285|    133|			if (rx == NULL)
  ------------------
  |  Branch (2285:8): [True: 0, False: 133]
  ------------------
 2286|      0|				return -1;
 2287|    133|		}
 2288|   156k|		l = 0;
 2289|   156k|		if (slen != 0) {
  ------------------
  |  Branch (2289:7): [True: 154k, False: 1.38k]
  ------------------
 2290|   154k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  426|   154k|#define CAST(T, b)	((T)(b))
  ------------------
 2291|   154k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2291:11): [True: 0, False: 154k]
  ------------------
 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|   154k|		    memcpy(copy, ms->search.s, slen);
 2298|   154k|		    copy[--slen] = '\0';
 2299|   154k|		    search = copy;
 2300|   154k|		} else {
 2301|  1.38k|		    search = CCAST(char *, "");
  ------------------
  |  |  428|  1.38k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2302|  1.38k|		    copy = NULL;
 2303|  1.38k|		}
 2304|   156k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  427|   156k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2305|   156k|		    1, &pmatch, 0);
 2306|   156k|		free(copy);
 2307|   156k|		switch (rc) {
 2308|  2.83k|		case 0:
  ------------------
  |  Branch (2308:3): [True: 2.83k, False: 153k]
  ------------------
 2309|  2.83k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  426|  2.83k|#define CAST(T, b)	((T)(b))
  ------------------
 2310|  2.83k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  426|  2.83k|#define CAST(T, b)	((T)(b))
  ------------------
 2311|  2.83k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  426|  2.83k|#define CAST(T, b)	((T)(b))
  ------------------
 2312|  2.83k|			    pmatch.rm_eo - pmatch.rm_so);
 2313|  2.83k|			v = 0;
 2314|  2.83k|			break;
 2315|       |
 2316|   153k|		case REG_NOMATCH:
  ------------------
  |  Branch (2316:3): [True: 153k, False: 2.83k]
  ------------------
 2317|   153k|			v = 1;
 2318|   153k|			break;
 2319|       |
 2320|      0|		default:
  ------------------
  |  Branch (2320:3): [True: 0, False: 156k]
  ------------------
 2321|      0|			return -1;
 2322|   156k|		}
 2323|   156k|		break;
 2324|   156k|	}
 2325|   156k|	case FILE_USE:
  ------------------
  |  |  268|  46.7k|#define				FILE_USE		46
  ------------------
  |  Branch (2325:2): [True: 46.7k, False: 52.7M]
  ------------------
 2326|  46.7k|		return ms->ms_value.q != 0;
 2327|  49.4k|	case FILE_NAME:
  ------------------
  |  |  267|  49.4k|#define				FILE_NAME		45
  ------------------
  |  Branch (2327:2): [True: 49.4k, False: 52.7M]
  ------------------
 2328|  59.7k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  59.7k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2328:2): [True: 10.3k, False: 52.8M]
  ------------------
 2329|  59.7k|		return 1;
 2330|   252k|	case FILE_DER:
  ------------------
  |  |  270|   252k|#define				FILE_DER		48
  ------------------
  |  Branch (2330:2): [True: 252k, False: 52.5M]
  ------------------
 2331|   252k|		matched = der_cmp(ms, m);
 2332|   252k|		if (matched == -1) {
  ------------------
  |  Branch (2332:7): [True: 118k, False: 134k]
  ------------------
 2333|   118k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   118k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2333:8): [True: 0, False: 118k]
  ------------------
 2334|      0|				(void) fprintf(stderr,
 2335|      0|				    "EOF comparing DER entries\n");
 2336|      0|			}
 2337|   118k|			return 0;
 2338|   118k|		}
 2339|   134k|		return matched;
 2340|  33.2k|	case FILE_GUID:
  ------------------
  |  |  271|  33.2k|#define				FILE_GUID		49
  ------------------
  |  Branch (2340:2): [True: 33.2k, False: 52.8M]
  ------------------
 2341|  33.2k|		l = 0;
 2342|  33.2k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2343|  33.2k|		break;
 2344|      0|	default:
  ------------------
  |  Branch (2344:2): [True: 0, False: 52.8M]
  ------------------
 2345|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2346|      0|		return -1;
 2347|  52.8M|	}
 2348|       |
 2349|  52.4M|	v = file_signextend(ms, m, v);
 2350|       |
 2351|  52.4M|	switch (m->reln) {
 2352|  59.5k|	case 'x':
  ------------------
  |  Branch (2352:2): [True: 59.5k, False: 52.4M]
  ------------------
 2353|  59.5k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  59.5k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2353:7): [True: 0, False: 59.5k]
  ------------------
 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|  59.5k|		matched = 1;
 2357|  59.5k|		break;
 2358|       |
 2359|  36.3k|	case '!':
  ------------------
  |  Branch (2359:2): [True: 36.3k, False: 52.4M]
  ------------------
 2360|  36.3k|		matched = v != l;
 2361|  36.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  36.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2361:7): [True: 0, False: 36.3k]
  ------------------
 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|  36.3k|		break;
 2367|       |
 2368|  52.0M|	case '=':
  ------------------
  |  Branch (2368:2): [True: 52.0M, False: 475k]
  ------------------
 2369|  52.0M|		matched = v == l;
 2370|  52.0M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  52.0M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2370:7): [True: 0, False: 52.0M]
  ------------------
 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|  52.0M|		break;
 2376|       |
 2377|   165k|	case '>':
  ------------------
  |  Branch (2377:2): [True: 165k, False: 52.3M]
  ------------------
 2378|   165k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  208|   165k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2378:7): [True: 129k, False: 35.6k]
  ------------------
 2379|   129k|			matched = v > l;
 2380|   129k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   129k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2380:8): [True: 0, False: 129k]
  ------------------
 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|   129k|		}
 2386|  35.6k|		else {
 2387|  35.6k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  426|  35.6k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  426|  35.6k|#define CAST(T, b)	((T)(b))
  ------------------
 2388|  35.6k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  35.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2388:8): [True: 0, False: 35.6k]
  ------------------
 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|  35.6k|		}
 2394|   165k|		break;
 2395|       |
 2396|   192k|	case '<':
  ------------------
  |  Branch (2396:2): [True: 192k, False: 52.2M]
  ------------------
 2397|   192k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  208|   192k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2397:7): [True: 163k, False: 28.5k]
  ------------------
 2398|   163k|			matched = v < l;
 2399|   163k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   163k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2399:8): [True: 0, False: 163k]
  ------------------
 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|   163k|		}
 2405|  28.5k|		else {
 2406|  28.5k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  426|  28.5k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  426|  28.5k|#define CAST(T, b)	((T)(b))
  ------------------
 2407|  28.5k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  28.5k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2407:8): [True: 0, False: 28.5k]
  ------------------
 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|  28.5k|		}
 2413|   192k|		break;
 2414|       |
 2415|  20.9k|	case '&':
  ------------------
  |  Branch (2415:2): [True: 20.9k, False: 52.4M]
  ------------------
 2416|  20.9k|		matched = (v & l) == l;
 2417|  20.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  20.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2417:7): [True: 0, False: 20.9k]
  ------------------
 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|  20.9k|		break;
 2425|       |
 2426|    497|	case '^':
  ------------------
  |  Branch (2426:2): [True: 497, False: 52.4M]
  ------------------
 2427|    497|		matched = (v & l) != l;
 2428|    497|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    497|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2428:7): [True: 0, False: 497]
  ------------------
 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|    497|		break;
 2435|       |
 2436|      0|	default:
  ------------------
  |  Branch (2436:2): [True: 0, False: 52.4M]
  ------------------
 2437|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2438|      0|		    m->reln);
 2439|      0|		return -1;
 2440|  52.4M|	}
 2441|       |
 2442|  52.4M|	return matched;
 2443|  52.4M|}
softmagic.c:file_strncmp:
 1974|  61.1M|{
 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|  61.1M|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  427|  61.1M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1982|  61.1M|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  427|  61.1M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1983|  61.1M|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  371|  61.1M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  370|  61.1M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1984|  61.1M|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  372|  61.1M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  370|  61.1M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1985|  61.1M|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (1985:33): [True: 19.5M, False: 41.5M]
  ------------------
 1986|  61.1M|	uint64_t v;
 1987|       |
 1988|       |	/*
 1989|       |	 * What we want here is v = strncmp(s1, s2, len),
 1990|       |	 * but ignoring any nulls.
 1991|       |	 */
 1992|  61.1M|	v = 0;
 1993|  61.1M|	len++;
 1994|  61.1M|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (1994:6): [True: 31.4M, False: 29.6M]
  ------------------
 1995|  31.7M|		while (--len > 0)
  ------------------
  |  Branch (1995:10): [True: 31.7M, False: 17.4k]
  ------------------
 1996|  31.7M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (1996:8): [True: 31.3M, False: 386k]
  ------------------
 1997|  31.3M|				break;
 1998|  31.4M|	}
 1999|  29.6M|	else { /* combine the others */
 2000|  29.9M|		while (--len > 0) {
  ------------------
  |  Branch (2000:10): [True: 29.8M, False: 20.8k]
  ------------------
 2001|  29.8M|			if (b >= eb) {
  ------------------
  |  Branch (2001:8): [True: 59.4k, False: 29.8M]
  ------------------
 2002|  59.4k|				v = 1;
 2003|  59.4k|				break;
 2004|  59.4k|			}
 2005|  29.8M|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  373|  29.8M|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  370|  29.8M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2005:8): [True: 19.2M, False: 10.6M]
  ------------------
 2006|  29.8M|			    islower(*a)) {
 2007|  1.67M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2007:9): [True: 1.66M, False: 15.0k]
  ------------------
 2008|  1.66M|					break;
 2009|  1.67M|			}
 2010|  28.1M|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  374|  28.1M|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  370|  28.1M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2010:13): [True: 13.1k, False: 28.1M]
  ------------------
 2011|  28.1M|			    isupper(*a)) {
 2012|  12.9k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2012:9): [True: 12.7k, False: 172]
  ------------------
 2013|  12.7k|					break;
 2014|  12.9k|			}
 2015|  28.1M|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  371|  28.1M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  370|  28.1M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2015:13): [True: 13.6M, False: 14.5M]
  ------------------
 2016|  28.1M|			    isspace(*a)) {
 2017|   828k|				a++;
 2018|   828k|				if (isspace(*b)) {
 2019|   126k|					b++;
 2020|   126k|					if (!isspace(*a))
  ------------------
  |  Branch (2020:10): [True: 126k, False: 0]
  ------------------
 2021|  1.83G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2021:14): [True: 1.83G, False: 59.3k]
  ------------------
 2022|  1.83G|							b++;
 2023|   126k|				}
 2024|   701k|				else {
 2025|   701k|					v = 1;
 2026|   701k|					break;
 2027|   701k|				}
 2028|   828k|			}
 2029|  27.3M|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  372|  27.3M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  370|  27.3M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2029:13): [True: 6.00M, False: 21.3M]
  ------------------
 2030|  27.3M|			    isspace(*a)) {
 2031|  2.63k|				a++;
 2032|  7.82k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2032:12): [True: 7.78k, False: 40]
  ------------------
 2033|  5.19k|					b++;
 2034|  2.63k|			}
 2035|  27.3M|			else {
 2036|  27.3M|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2036:9): [True: 27.2M, False: 66.4k]
  ------------------
 2037|  27.2M|					break;
 2038|  27.3M|			}
 2039|  29.8M|		}
 2040|  29.6M|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  389|  20.8k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  370|  20.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2040:7): [True: 20.8k, False: 29.6M]
  |  Branch (2040:19): [True: 20.8k, False: 0]
  |  Branch (2040:29): [True: 151, False: 20.7k]
  ------------------
 2041|    151|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2041:8): [True: 82, False: 69]
  |  Branch (2041:14): [True: 44, False: 38]
  ------------------
 2042|     44|				v = 1;
 2043|    151|		}
 2044|  29.6M|	}
 2045|  61.1M|	return v;
 2046|  61.1M|}
softmagic.c:file_strncmp16:
 2051|  39.8k|{
 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|  39.8k|	flags = 0;
 2058|  39.8k|	return file_strncmp(a, b, len, maxlen, flags);
 2059|  39.8k|}
softmagic.c:alloc_regex:
 2063|    133|{
 2064|    133|	int rc;
 2065|    133|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  426|    133|#define CAST(T, b)	((T)(b))
  ------------------
 2066|       |
 2067|    133|	if (rx == NULL) {
  ------------------
  |  Branch (2067:6): [True: 0, False: 133]
  ------------------
 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|    133|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2074|    133|	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  357|    133|#define str_flags _u._s._flags
  ------------------
              	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  406|    133|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  373|    133|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|    133|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  374|    133|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  370|    133|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2074:7): [True: 17, False: 116]
  ------------------
 2075|    133|	if (rc == 0)
  ------------------
  |  Branch (2075:6): [True: 133, False: 0]
  ------------------
 2076|    133|		return rx;
 2077|       |
 2078|      0|	free(rx);
 2079|      0|	return NULL;
 2080|    133|}
softmagic.c:handle_annotation:
 2447|   455k|{
 2448|   455k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   455k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2448:6): [True: 0, False: 455k]
  |  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|   455k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   455k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2455:6): [True: 0, False: 455k]
  |  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|   455k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   455k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2462:6): [True: 0, False: 455k]
  |  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|   455k|	return 0;
 2476|   455k|}
softmagic.c:varexpand:
  527|   103k|{
  528|   103k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  529|   103k|	size_t l;
  530|       |
  531|   103k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (531:19): [True: 130, False: 103k]
  ------------------
  532|    130|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  426|    130|#define CAST(T, b)	((T)(b))
  ------------------
  533|    130|		if (l >= len)
  ------------------
  |  Branch (533:7): [True: 0, False: 130]
  ------------------
  534|      0|			return -1;
  535|    130|		memcpy(buf, sptr, l);
  536|    130|		buf += l;
  537|    130|		len -= l;
  538|    130|		ptr += 2;
  539|    130|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (539:7): [True: 0, False: 130]
  |  Branch (539:16): [True: 0, False: 130]
  ------------------
  540|      0|			return -1;
  541|  1.95k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (541:26): [True: 1.95k, False: 0]
  |  Branch (541:33): [True: 1.82k, False: 130]
  ------------------
  542|  1.82k|			continue;
  543|    130|		if (*et != ':')
  ------------------
  |  Branch (543:7): [True: 0, False: 130]
  ------------------
  544|      0|			return -1;
  545|  1.82k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (545:25): [True: 1.82k, False: 0]
  |  Branch (545:32): [True: 1.69k, False: 130]
  ------------------
  546|  1.69k|			continue;
  547|    130|		if (*ee != '}')
  ------------------
  |  Branch (547:7): [True: 0, False: 130]
  ------------------
  548|      0|			return -1;
  549|    130|		switch (*ptr) {
  550|    130|		case 'x':
  ------------------
  |  Branch (550:3): [True: 130, False: 0]
  ------------------
  551|    130|			if (ms->mode & 0111) {
  ------------------
  |  Branch (551:8): [True: 0, False: 130]
  ------------------
  552|      0|				ptr = t;
  553|      0|				l = et - t;
  554|    130|			} else {
  555|    130|				ptr = e;
  556|    130|				l = ee - e;
  557|    130|			}
  558|    130|			break;
  559|      0|		default:
  ------------------
  |  Branch (559:3): [True: 0, False: 130]
  ------------------
  560|      0|			return -1;
  561|    130|		}
  562|    130|		if (l >= len)
  ------------------
  |  Branch (562:7): [True: 0, False: 130]
  ------------------
  563|      0|			return -1;
  564|    130|		memcpy(buf, ptr, l);
  565|    130|		buf += l;
  566|    130|		len -= l;
  567|    130|		sptr = ee + 1;
  568|    130|	}
  569|       |
  570|   103k|	l = strlen(sptr);
  571|   103k|	if (l >= len)
  ------------------
  |  Branch (571:6): [True: 0, False: 103k]
  ------------------
  572|      0|		return -1;
  573|       |
  574|   103k|	memcpy(buf, sptr, l);
  575|   103k|	buf[l] = '\0';
  576|   103k|	return 0;
  577|   103k|}
softmagic.c:print_sep:
 2480|  44.0k|{
 2481|  44.0k|	if (firstline)
  ------------------
  |  Branch (2481:6): [True: 25.2k, False: 18.8k]
  ------------------
 2482|  25.2k|		return 0;
 2483|       |	/*
 2484|       |	 * we found another match
 2485|       |	 * put a newline and '-' to do some simple formatting
 2486|       |	 */
 2487|  18.8k|	return file_separator(ms);
 2488|  44.0k|}
softmagic.c:mprint:
  582|   103k|{
  583|   103k|	uint64_t v;
  584|   103k|	float vf;
  585|   103k|	double vd;
  586|   103k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  587|   103k|	const char *desc;
  588|   103k|	union VALUETYPE *p = &ms->ms_value;
  589|       |
  590|   103k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (590:6): [True: 0, False: 103k]
  ------------------
  591|      0|		desc = m->desc;
  592|   103k|	else
  593|   103k|		desc = ebuf;
  594|       |
  595|   103k|#define	PRINTER(value, format, stype, utype)	\
  596|   103k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  597|   103k|	switch (check_fmt(ms, desc)) { \
  598|   103k|	case -1: \
  599|   103k|		return -1; \
  600|   103k|	case 1: \
  601|   103k|		if (m->flag & UNSIGNED) { \
  602|   103k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  603|   103k|			    CAST(utype, v)); \
  604|   103k|		} else { \
  605|   103k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  606|   103k|			    CAST(stype, v)); \
  607|   103k|		} \
  608|   103k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  609|   103k|			return -1; \
  610|   103k|		break; \
  611|   103k|	default: \
  612|   103k|		if (m->flag & UNSIGNED) { \
  613|   103k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  614|   103k|			   CAST(utype, v)) == -1) \
  615|   103k|			   return -1; \
  616|   103k|		} else { \
  617|   103k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  618|   103k|			   CAST(stype, v)) == -1) \
  619|   103k|			   return -1; \
  620|   103k|		} \
  621|   103k|		break; \
  622|   103k|	} \
  623|   103k|	break
  624|       |
  625|   103k|  	switch (m->type) {
  626|  5.75k|  	case FILE_BYTE:
  ------------------
  |  |  223|  5.75k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (626:4): [True: 5.75k, False: 97.4k]
  ------------------
  627|  5.75k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  596|  5.75k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  5.75k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  5.75k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 5.75k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 5.75k]
  |  |  ------------------
  |  |  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|  5.75k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 5.75k, False: 0]
  |  |  ------------------
  |  |  612|  5.75k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  5.75k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 2.60k, False: 3.14k]
  |  |  ------------------
  |  |  613|  2.60k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  2.60k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 2.60k]
  |  |  ------------------
  |  |  614|  2.60k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  2.60k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  2.60k|			   return -1; \
  |  |  616|  3.14k|		} else { \
  |  |  617|  3.14k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|  3.14k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 3.14k]
  |  |  ------------------
  |  |  618|  3.14k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  3.14k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  3.14k|			   return -1; \
  |  |  620|  3.14k|		} \
  |  |  621|  5.75k|		break; \
  |  |  622|  5.75k|	} \
  |  |  623|  5.75k|	break
  ------------------
  628|       |
  629|  5.75k|  	case FILE_SHORT:
  ------------------
  |  |  224|  1.59k|#define				FILE_SHORT		2
  ------------------
  |  Branch (629:4): [True: 1.59k, False: 101k]
  ------------------
  630|  5.42k|  	case FILE_BESHORT:
  ------------------
  |  |  229|  5.42k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (630:4): [True: 3.82k, False: 99.3k]
  ------------------
  631|  9.62k|  	case FILE_LESHORT:
  ------------------
  |  |  232|  9.62k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (631:4): [True: 4.20k, False: 98.9k]
  ------------------
  632|  9.62k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  596|  9.62k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  9.62k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  9.62k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 9.62k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 9.62k]
  |  |  ------------------
  |  |  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|  9.62k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 9.62k, False: 0]
  |  |  ------------------
  |  |  612|  9.62k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  9.62k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 6.71k, False: 2.91k]
  |  |  ------------------
  |  |  613|  6.71k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  6.71k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 6.71k]
  |  |  ------------------
  |  |  614|  6.71k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  6.71k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  6.71k|			   return -1; \
  |  |  616|  6.71k|		} else { \
  |  |  617|  2.91k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|  2.91k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 2.91k]
  |  |  ------------------
  |  |  618|  2.91k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  2.91k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  2.91k|			   return -1; \
  |  |  620|  2.91k|		} \
  |  |  621|  9.62k|		break; \
  |  |  622|  9.62k|	} \
  |  |  623|  9.62k|	break
  ------------------
  633|       |
  634|  9.62k|  	case FILE_LONG:
  ------------------
  |  |  226|    763|#define				FILE_LONG		4
  ------------------
  |  Branch (634:4): [True: 763, False: 102k]
  ------------------
  635|  37.0k|  	case FILE_BELONG:
  ------------------
  |  |  230|  37.0k|#define				FILE_BELONG		8
  ------------------
  |  Branch (635:4): [True: 36.2k, False: 66.8k]
  ------------------
  636|  42.2k|  	case FILE_LELONG:
  ------------------
  |  |  233|  42.2k|#define				FILE_LELONG		11
  ------------------
  |  Branch (636:4): [True: 5.20k, False: 97.9k]
  ------------------
  637|  42.2k|  	case FILE_MELONG:
  ------------------
  |  |  245|  42.2k|#define				FILE_MELONG		23
  ------------------
  |  Branch (637:4): [True: 0, False: 103k]
  ------------------
  638|  42.2k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  596|  42.2k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  42.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  42.2k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 42.2k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 42.2k]
  |  |  ------------------
  |  |  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|  42.2k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 42.2k, False: 0]
  |  |  ------------------
  |  |  612|  42.2k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  42.2k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 9.17k, False: 33.0k]
  |  |  ------------------
  |  |  613|  9.17k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|  9.17k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 9.17k]
  |  |  ------------------
  |  |  614|  9.17k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  9.17k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|  9.17k|			   return -1; \
  |  |  616|  33.0k|		} else { \
  |  |  617|  33.0k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|  33.0k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 33.0k]
  |  |  ------------------
  |  |  618|  33.0k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|  33.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  33.0k|			   return -1; \
  |  |  620|  33.0k|		} \
  |  |  621|  42.2k|		break; \
  |  |  622|  42.2k|	} \
  |  |  623|  42.2k|	break
  ------------------
  639|       |
  640|  42.2k|  	case FILE_QUAD:
  ------------------
  |  |  246|    233|#define				FILE_QUAD		24
  ------------------
  |  Branch (640:4): [True: 233, False: 102k]
  ------------------
  641|  1.00k|  	case FILE_BEQUAD:
  ------------------
  |  |  248|  1.00k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (641:4): [True: 773, False: 102k]
  ------------------
  642|  1.24k|  	case FILE_LEQUAD:
  ------------------
  |  |  247|  1.24k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (642:4): [True: 236, False: 102k]
  ------------------
  643|  1.24k|	case FILE_OFFSET:
  ------------------
  |  |  272|  1.24k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (643:2): [True: 0, False: 103k]
  ------------------
  644|  1.24k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  596|  1.24k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  426|  1.24k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  597|  1.24k|	switch (check_fmt(ms, desc)) { \
  |  |  598|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (598:2): [True: 0, False: 1.24k]
  |  |  ------------------
  |  |  599|      0|		return -1; \
  |  |  600|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (600:2): [True: 0, False: 1.24k]
  |  |  ------------------
  |  |  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|  1.24k|	default: \
  |  |  ------------------
  |  |  |  Branch (611:2): [True: 1.24k, False: 0]
  |  |  ------------------
  |  |  612|  1.24k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  208|  1.24k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (612:7): [True: 825, False: 417]
  |  |  ------------------
  |  |  613|    825|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  155|    825|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (613:14): [True: 0, False: 825]
  |  |  ------------------
  |  |  614|    825|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|    825|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  615|    825|			   return -1; \
  |  |  616|    825|		} else { \
  |  |  617|    417|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  155|    417|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (617:14): [True: 0, False: 417]
  |  |  ------------------
  |  |  618|    417|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  426|    417|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|    417|			   return -1; \
  |  |  620|    417|		} \
  |  |  621|  1.24k|		break; \
  |  |  622|  1.24k|	} \
  |  |  623|  1.24k|	break
  ------------------
  645|       |
  646|  13.3k|  	case FILE_STRING:
  ------------------
  |  |  227|  13.3k|#define				FILE_STRING		5
  ------------------
  |  Branch (646:4): [True: 13.3k, False: 89.7k]
  ------------------
  647|  14.6k|  	case FILE_PSTRING:
  ------------------
  |  |  235|  14.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (647:4): [True: 1.27k, False: 101k]
  ------------------
  648|  14.7k|  	case FILE_BESTRING16:
  ------------------
  |  |  240|  14.7k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (648:4): [True: 105, False: 103k]
  ------------------
  649|  15.1k|  	case FILE_LESTRING16:
  ------------------
  |  |  241|  15.1k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (649:4): [True: 389, False: 102k]
  ------------------
  650|  15.1k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (650:7): [True: 7.11k, False: 8.05k]
  |  Branch (650:25): [True: 676, False: 7.37k]
  ------------------
  651|  7.78k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|  7.78k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (651:8): [True: 0, False: 7.78k]
  ------------------
  652|  7.78k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  653|  7.78k|			    sizeof(m->value.s))) == -1)
  654|      0|				return -1;
  655|  7.78k|		}
  656|  7.37k|		else {
  657|  7.37k|			char *str = p->s;
  658|       |
  659|       |			/* compute t before we mangle the string? */
  660|       |
  661|  7.37k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (661:8): [True: 7.16k, False: 209]
  ------------------
  662|  7.16k|				str[strcspn(str, "\r\n")] = '\0';
  663|       |
  664|  7.37k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  357|  7.37k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  388|  7.37k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  370|  7.37k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (664:8): [True: 52, False: 7.32k]
  ------------------
  665|     52|				str = file_strtrim(str);
  666|       |
  667|  7.37k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|  7.37k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (667:8): [True: 0, False: 7.37k]
  ------------------
  668|  7.37k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  669|  7.37k|				sizeof(p->s) - (str - p->s))) == -1)
  670|      0|				return -1;
  671|       |
  672|  7.37k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  235|  7.37k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (672:8): [True: 1.27k, False: 6.10k]
  ------------------
  673|  1.27k|				size_t l = file_pstring_length_size(ms, m);
  674|  1.27k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  158|  1.27k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  1.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (674:9): [True: 0, False: 1.27k]
  ------------------
  675|      0|					return -1;
  676|  1.27k|			}
  677|  7.37k|		}
  678|  15.1k|		break;
  679|       |
  680|  15.1k|	case FILE_DATE:
  ------------------
  |  |  228|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (680:2): [True: 0, False: 103k]
  ------------------
  681|     67|	case FILE_BEDATE:
  ------------------
  |  |  231|     67|#define				FILE_BEDATE		9
  ------------------
  |  Branch (681:2): [True: 67, False: 103k]
  ------------------
  682|    237|	case FILE_LEDATE:
  ------------------
  |  |  234|    237|#define				FILE_LEDATE		12
  ------------------
  |  Branch (682:2): [True: 170, False: 103k]
  ------------------
  683|    305|	case FILE_MEDATE:
  ------------------
  |  |  243|    305|#define				FILE_MEDATE		21
  ------------------
  |  Branch (683:2): [True: 68, False: 103k]
  ------------------
  684|    305|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    305|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (684:7): [True: 0, False: 305]
  ------------------
  685|    305|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  686|      0|			return -1;
  687|    305|		break;
  688|       |
  689|    305|	case FILE_LDATE:
  ------------------
  |  |  236|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (689:2): [True: 0, False: 103k]
  ------------------
  690|    127|	case FILE_BELDATE:
  ------------------
  |  |  237|    127|#define				FILE_BELDATE		15
  ------------------
  |  Branch (690:2): [True: 127, False: 103k]
  ------------------
  691|    188|	case FILE_LELDATE:
  ------------------
  |  |  238|    188|#define				FILE_LELDATE		16
  ------------------
  |  Branch (691:2): [True: 61, False: 103k]
  ------------------
  692|    188|	case FILE_MELDATE:
  ------------------
  |  |  244|    188|#define				FILE_MELDATE		22
  ------------------
  |  Branch (692:2): [True: 0, False: 103k]
  ------------------
  693|    188|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    188|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (693:7): [True: 0, False: 188]
  ------------------
  694|    188|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  508|    188|#define FILE_T_LOCAL	1
  ------------------
  695|    188|			== -1)
  696|      0|			return -1;
  697|    188|		break;
  698|       |
  699|    188|	case FILE_QDATE:
  ------------------
  |  |  249|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (699:2): [True: 0, False: 103k]
  ------------------
  700|    182|	case FILE_BEQDATE:
  ------------------
  |  |  251|    182|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (700:2): [True: 182, False: 103k]
  ------------------
  701|    182|	case FILE_LEQDATE:
  ------------------
  |  |  250|    182|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (701:2): [True: 0, False: 103k]
  ------------------
  702|    182|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    182|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (702:7): [True: 0, False: 182]
  ------------------
  703|    182|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  704|      0|			return -1;
  705|    182|		break;
  706|       |
  707|    182|	case FILE_QLDATE:
  ------------------
  |  |  252|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (707:2): [True: 0, False: 103k]
  ------------------
  708|     15|	case FILE_BEQLDATE:
  ------------------
  |  |  254|     15|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (708:2): [True: 15, False: 103k]
  ------------------
  709|     33|	case FILE_LEQLDATE:
  ------------------
  |  |  253|     33|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (709:2): [True: 18, False: 103k]
  ------------------
  710|     33|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|     33|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (710:7): [True: 0, False: 33]
  ------------------
  711|     33|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  508|     33|#define FILE_T_LOCAL	1
  ------------------
  712|      0|			return -1;
  713|     33|		break;
  714|       |
  715|    112|	case FILE_QWDATE:
  ------------------
  |  |  264|    112|#define				FILE_QWDATE		42
  ------------------
  |  Branch (715:2): [True: 112, False: 103k]
  ------------------
  716|    112|	case FILE_BEQWDATE:
  ------------------
  |  |  266|    112|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (716:2): [True: 0, False: 103k]
  ------------------
  717|    865|	case FILE_LEQWDATE:
  ------------------
  |  |  265|    865|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (717:2): [True: 753, False: 102k]
  ------------------
  718|    865|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    865|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (718:7): [True: 0, False: 865]
  ------------------
  719|    865|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  509|    865|#define FILE_T_WINDOWS	2
  ------------------
  720|    865|		    == -1)
  721|      0|			return -1;
  722|    865|		break;
  723|       |
  724|    865|	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (724:2): [True: 0, False: 103k]
  ------------------
  725|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (725:2): [True: 0, False: 103k]
  ------------------
  726|    196|	case FILE_LEFLOAT:
  ------------------
  |  |  257|    196|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (726:2): [True: 196, False: 102k]
  ------------------
  727|    196|		vf = p->f;
  728|    196|		switch (check_fmt(ms, desc)) {
  729|      0|		case -1:
  ------------------
  |  Branch (729:3): [True: 0, False: 196]
  ------------------
  730|      0|			return -1;
  731|      0|		case 1:
  ------------------
  |  Branch (731:3): [True: 0, False: 196]
  ------------------
  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|    196|		default:
  ------------------
  |  Branch (736:3): [True: 196, False: 0]
  ------------------
  737|    196|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  155|    196|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (737:8): [True: 0, False: 196]
  ------------------
  738|      0|				return -1;
  739|    196|			break;
  740|    196|		}
  741|    196|  		break;
  742|       |
  743|    196|	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (743:2): [True: 0, False: 103k]
  ------------------
  744|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (744:2): [True: 0, False: 103k]
  ------------------
  745|    352|	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    352|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (745:2): [True: 352, False: 102k]
  ------------------
  746|    352|		vd = p->d;
  747|    352|		switch (check_fmt(ms, desc)) {
  748|      0|		case -1:
  ------------------
  |  Branch (748:3): [True: 0, False: 352]
  ------------------
  749|      0|			return -1;
  750|      0|		case 1:
  ------------------
  |  Branch (750:3): [True: 0, False: 352]
  ------------------
  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|    352|		default:
  ------------------
  |  Branch (755:3): [True: 352, False: 0]
  ------------------
  756|    352|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  155|    352|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (756:8): [True: 0, False: 352]
  ------------------
  757|      0|				return -1;
  758|    352|			break;
  759|    352|		}
  760|    352|  		break;
  761|       |
  762|    352|	case FILE_SEARCH:
  ------------------
  |  |  242|    244|#define				FILE_SEARCH		20
  ------------------
  |  Branch (762:2): [True: 244, False: 102k]
  ------------------
  763|    814|	case FILE_REGEX: {
  ------------------
  |  |  239|    814|#define				FILE_REGEX		17
  ------------------
  |  Branch (763:2): [True: 570, False: 102k]
  ------------------
  764|    814|		char *cp, *scp;
  765|    814|		int rval;
  766|       |
  767|    814|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  427|    814|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  768|    814|		    ms->search.rm_len);
  769|    814|		if (cp == NULL) {
  ------------------
  |  Branch (769:7): [True: 0, False: 814]
  ------------------
  770|      0|			file_oomem(ms, ms->search.rm_len);
  771|      0|			return -1;
  772|      0|		}
  773|    814|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  357|    814|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  388|    814|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  370|    814|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (773:9): [True: 48, False: 766]
  ------------------
  774|       |
  775|    814|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  155|    814|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  776|    814|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  777|    814|		free(cp);
  778|       |
  779|    814|		if (rval == -1)
  ------------------
  |  Branch (779:7): [True: 0, False: 814]
  ------------------
  780|      0|			return -1;
  781|    814|		break;
  782|    814|	}
  783|       |
  784|    814|	case FILE_DEFAULT:
  ------------------
  |  |  225|    578|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (784:2): [True: 578, False: 102k]
  ------------------
  785|    583|	case FILE_CLEAR:
  ------------------
  |  |  269|    583|#define				FILE_CLEAR		47
  ------------------
  |  Branch (785:2): [True: 5, False: 103k]
  ------------------
  786|    583|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (786:9): [True: 0, False: 583]
  ------------------
  787|      0|			return -1;
  788|    583|		break;
  789|       |
  790|  7.01k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  7.01k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (790:2): [True: 7.01k, False: 96.1k]
  ------------------
  791|  7.01k|	case FILE_USE:
  ------------------
  |  |  268|  7.01k|#define				FILE_USE		46
  ------------------
  |  Branch (791:2): [True: 0, False: 103k]
  ------------------
  792|  25.0k|	case FILE_NAME:
  ------------------
  |  |  267|  25.0k|#define				FILE_NAME		45
  ------------------
  |  Branch (792:2): [True: 18.0k, False: 85.1k]
  ------------------
  793|  25.0k|		break;
  794|    248|	case FILE_DER:
  ------------------
  |  |  270|    248|#define				FILE_DER		48
  ------------------
  |  Branch (794:2): [True: 248, False: 102k]
  ------------------
  795|    248|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  155|    248|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (795:7): [True: 0, False: 248]
  ------------------
  796|    248|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  797|    248|			sizeof(ms->ms_value.s))) == -1)
  798|      0|			return -1;
  799|    248|		break;
  800|    317|	case FILE_GUID:
  ------------------
  |  |  271|    317|#define				FILE_GUID		49
  ------------------
  |  Branch (800:2): [True: 317, False: 102k]
  ------------------
  801|    317|		(void) file_print_guid(buf, sizeof(buf), ms->ms_value.guid);
  802|    317|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  155|    317|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (802:7): [True: 0, False: 317]
  ------------------
  803|      0|			return -1;
  804|    317|		break;
  805|    317|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|      0|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (805:2): [True: 0, False: 103k]
  ------------------
  806|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|      0|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (806:2): [True: 0, False: 103k]
  ------------------
  807|      0|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|      0|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (807:2): [True: 0, False: 103k]
  ------------------
  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: 103k]
  ------------------
  813|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|      0|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (813:2): [True: 0, False: 103k]
  ------------------
  814|      0|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|      0|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (814:2): [True: 0, False: 103k]
  ------------------
  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: 103k]
  ------------------
  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: 103k]
  ------------------
  825|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  826|      0|		return -1;
  827|   103k|	}
  828|   103k|	return 0;
  829|   103k|}
softmagic.c:check_fmt:
  486|  59.4k|{
  487|  59.4k|	file_regex_t rx;
  488|  59.4k|	int rc, rv = -1;
  489|  59.4k|        const char* pat = "%[-0-9\\.]*s";
  490|       |
  491|  59.4k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (491:6): [True: 35.5k, False: 23.8k]
  ------------------
  492|  35.5k|		return 0;
  493|       |
  494|  23.8k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  495|  23.8k|	if (rc == 0) {
  ------------------
  |  Branch (495:6): [True: 23.8k, False: 0]
  ------------------
  496|  23.8k|		rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
  497|  23.8k|		rv = !rc;
  498|  23.8k|	}
  499|  23.8k|	file_regfree(&rx);
  500|  23.8k|	return rv;
  501|  59.4k|}
softmagic.c:moffset:
  834|   455k|{
  835|   455k|	size_t nbytes = b->flen;
  836|   455k|	int32_t o;
  837|       |
  838|   455k|  	switch (m->type) {
  839|  93.4k|  	case FILE_BYTE:
  ------------------
  |  |  223|  93.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (839:4): [True: 93.4k, False: 362k]
  ------------------
  840|  93.4k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  426|  93.4k|#define CAST(T, b)	((T)(b))
  ------------------
  841|  93.4k|		break;
  842|       |
  843|  12.6k|  	case FILE_SHORT:
  ------------------
  |  |  224|  12.6k|#define				FILE_SHORT		2
  ------------------
  |  Branch (843:4): [True: 12.6k, False: 442k]
  ------------------
  844|  31.7k|  	case FILE_BESHORT:
  ------------------
  |  |  229|  31.7k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (844:4): [True: 19.0k, False: 436k]
  ------------------
  845|  45.1k|  	case FILE_LESHORT:
  ------------------
  |  |  232|  45.1k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (845:4): [True: 13.3k, False: 442k]
  ------------------
  846|  45.1k|	case FILE_MSDOSDATE:
  ------------------
  |  |  275|  45.1k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (846:2): [True: 0, False: 455k]
  ------------------
  847|  45.1k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  276|  45.1k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (847:2): [True: 0, False: 455k]
  ------------------
  848|  45.1k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  277|  45.1k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (848:2): [True: 0, False: 455k]
  ------------------
  849|  45.1k|	case FILE_MSDOSTIME:
  ------------------
  |  |  278|  45.1k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (849:2): [True: 0, False: 455k]
  ------------------
  850|  45.1k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  279|  45.1k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (850:2): [True: 0, False: 455k]
  ------------------
  851|  45.1k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  280|  45.1k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (851:2): [True: 0, False: 455k]
  ------------------
  852|  45.1k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  426|  45.1k|#define CAST(T, b)	((T)(b))
  ------------------
  853|  45.1k|		break;
  854|       |
  855|  3.39k|  	case FILE_LONG:
  ------------------
  |  |  226|  3.39k|#define				FILE_LONG		4
  ------------------
  |  Branch (855:4): [True: 3.39k, False: 452k]
  ------------------
  856|   108k|  	case FILE_BELONG:
  ------------------
  |  |  230|   108k|#define				FILE_BELONG		8
  ------------------
  |  Branch (856:4): [True: 104k, False: 350k]
  ------------------
  857|   124k|  	case FILE_LELONG:
  ------------------
  |  |  233|   124k|#define				FILE_LELONG		11
  ------------------
  |  Branch (857:4): [True: 16.1k, False: 439k]
  ------------------
  858|   124k|  	case FILE_MELONG:
  ------------------
  |  |  245|   124k|#define				FILE_MELONG		23
  ------------------
  |  Branch (858:4): [True: 0, False: 455k]
  ------------------
  859|   124k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  426|   124k|#define CAST(T, b)	((T)(b))
  ------------------
  860|   124k|		break;
  861|       |
  862|  17.8k|  	case FILE_QUAD:
  ------------------
  |  |  246|  17.8k|#define				FILE_QUAD		24
  ------------------
  |  Branch (862:4): [True: 17.8k, False: 437k]
  ------------------
  863|  20.9k|  	case FILE_BEQUAD:
  ------------------
  |  |  248|  20.9k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (863:4): [True: 3.08k, False: 452k]
  ------------------
  864|  21.5k|  	case FILE_LEQUAD:
  ------------------
  |  |  247|  21.5k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (864:4): [True: 572, False: 454k]
  ------------------
  865|  21.5k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  426|  21.5k|#define CAST(T, b)	((T)(b))
  ------------------
  866|  21.5k|		break;
  867|       |
  868|  42.1k|  	case FILE_STRING:
  ------------------
  |  |  227|  42.1k|#define				FILE_STRING		5
  ------------------
  |  Branch (868:4): [True: 42.1k, False: 413k]
  ------------------
  869|  43.4k|  	case FILE_PSTRING:
  ------------------
  |  |  235|  43.4k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (869:4): [True: 1.27k, False: 454k]
  ------------------
  870|  43.5k|  	case FILE_BESTRING16:
  ------------------
  |  |  240|  43.5k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (870:4): [True: 105, False: 455k]
  ------------------
  871|  43.9k|  	case FILE_LESTRING16:
  ------------------
  |  |  241|  43.9k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (871:4): [True: 389, False: 455k]
  ------------------
  872|  43.9k|	case FILE_OCTAL:
  ------------------
  |  |  281|  43.9k|#define				FILE_OCTAL		59
  ------------------
  |  Branch (872:2): [True: 0, False: 455k]
  ------------------
  873|  43.9k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (873:7): [True: 13.3k, False: 30.5k]
  |  Branch (873:25): [True: 1.60k, False: 28.9k]
  ------------------
  874|  14.9k|			o = ms->offset + m->vallen;
  875|  28.9k|		} else {
  876|  28.9k|			union VALUETYPE *p = &ms->ms_value;
  877|       |
  878|  28.9k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (878:8): [True: 24.7k, False: 4.22k]
  ------------------
  879|  24.7k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  880|  28.9k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  426|  28.9k|#define CAST(T, b)	((T)(b))
  ------------------
  881|  28.9k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  235|  28.9k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (881:8): [True: 1.27k, False: 27.7k]
  ------------------
  882|  1.27k|				size_t l = file_pstring_length_size(ms, m);
  883|  1.27k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  158|  1.27k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  426|  1.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (883:9): [True: 0, False: 1.27k]
  ------------------
  884|      0|					return -1;
  885|  1.27k|				o += CAST(uint32_t, l);
  ------------------
  |  |  426|  1.27k|#define CAST(T, b)	((T)(b))
  ------------------
  886|  1.27k|			}
  887|  28.9k|		}
  888|  43.9k|		break;
  889|       |
  890|  43.9k|	case FILE_DATE:
  ------------------
  |  |  228|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (890:2): [True: 0, False: 455k]
  ------------------
  891|     67|	case FILE_BEDATE:
  ------------------
  |  |  231|     67|#define				FILE_BEDATE		9
  ------------------
  |  Branch (891:2): [True: 67, False: 455k]
  ------------------
  892|    237|	case FILE_LEDATE:
  ------------------
  |  |  234|    237|#define				FILE_LEDATE		12
  ------------------
  |  Branch (892:2): [True: 170, False: 455k]
  ------------------
  893|    305|	case FILE_MEDATE:
  ------------------
  |  |  243|    305|#define				FILE_MEDATE		21
  ------------------
  |  Branch (893:2): [True: 68, False: 455k]
  ------------------
  894|    305|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  426|    305|#define CAST(T, b)	((T)(b))
  ------------------
  895|    305|		break;
  896|       |
  897|      0|	case FILE_LDATE:
  ------------------
  |  |  236|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (897:2): [True: 0, False: 455k]
  ------------------
  898|    127|	case FILE_BELDATE:
  ------------------
  |  |  237|    127|#define				FILE_BELDATE		15
  ------------------
  |  Branch (898:2): [True: 127, False: 455k]
  ------------------
  899|    188|	case FILE_LELDATE:
  ------------------
  |  |  238|    188|#define				FILE_LELDATE		16
  ------------------
  |  Branch (899:2): [True: 61, False: 455k]
  ------------------
  900|    188|	case FILE_MELDATE:
  ------------------
  |  |  244|    188|#define				FILE_MELDATE		22
  ------------------
  |  Branch (900:2): [True: 0, False: 455k]
  ------------------
  901|    188|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  426|    188|#define CAST(T, b)	((T)(b))
  ------------------
  902|    188|		break;
  903|       |
  904|      0|	case FILE_QDATE:
  ------------------
  |  |  249|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (904:2): [True: 0, False: 455k]
  ------------------
  905|    182|	case FILE_BEQDATE:
  ------------------
  |  |  251|    182|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (905:2): [True: 182, False: 455k]
  ------------------
  906|    182|	case FILE_LEQDATE:
  ------------------
  |  |  250|    182|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (906:2): [True: 0, False: 455k]
  ------------------
  907|    182|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  426|    182|#define CAST(T, b)	((T)(b))
  ------------------
  908|    182|		break;
  909|       |
  910|      0|	case FILE_QLDATE:
  ------------------
  |  |  252|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (910:2): [True: 0, False: 455k]
  ------------------
  911|     15|	case FILE_BEQLDATE:
  ------------------
  |  |  254|     15|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (911:2): [True: 15, False: 455k]
  ------------------
  912|     33|	case FILE_LEQLDATE:
  ------------------
  |  |  253|     33|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (912:2): [True: 18, False: 455k]
  ------------------
  913|     33|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  426|     33|#define CAST(T, b)	((T)(b))
  ------------------
  914|     33|		break;
  915|       |
  916|      0|  	case FILE_FLOAT:
  ------------------
  |  |  255|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (916:4): [True: 0, False: 455k]
  ------------------
  917|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  256|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (917:4): [True: 0, False: 455k]
  ------------------
  918|    196|  	case FILE_LEFLOAT:
  ------------------
  |  |  257|    196|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (918:4): [True: 196, False: 455k]
  ------------------
  919|    196|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  426|    196|#define CAST(T, b)	((T)(b))
  ------------------
  920|    196|		break;
  921|       |
  922|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  258|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (922:4): [True: 0, False: 455k]
  ------------------
  923|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  259|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (923:4): [True: 0, False: 455k]
  ------------------
  924|    352|  	case FILE_LEDOUBLE:
  ------------------
  |  |  260|    352|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (924:4): [True: 352, False: 455k]
  ------------------
  925|    352|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  426|    352|#define CAST(T, b)	((T)(b))
  ------------------
  926|    352|		break;
  927|       |
  928|  1.26k|	case FILE_REGEX:
  ------------------
  |  |  239|  1.26k|#define				FILE_REGEX		17
  ------------------
  |  Branch (928:2): [True: 1.26k, False: 454k]
  ------------------
  929|  1.26k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  357|  1.26k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  1.26k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  370|  1.26k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (929:7): [True: 40, False: 1.22k]
  ------------------
  930|     40|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  426|     40|#define CAST(T, b)	((T)(b))
  ------------------
  931|  1.22k|		else
  932|  1.22k|			o = CAST(int32_t,
  ------------------
  |  |  426|  1.22k|#define CAST(T, b)	((T)(b))
  ------------------
  933|  1.26k|			    (ms->search.offset + ms->search.rm_len));
  934|  1.26k|		break;
  935|       |
  936|  6.14k|	case FILE_SEARCH:
  ------------------
  |  |  242|  6.14k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (936:2): [True: 6.14k, False: 449k]
  ------------------
  937|  6.14k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  357|  6.14k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  6.14k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  370|  6.14k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (937:7): [True: 144, False: 6.00k]
  ------------------
  938|    144|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  426|    144|#define CAST(T, b)	((T)(b))
  ------------------
  939|  6.00k|		else
  940|  6.00k|			o = CAST(int32_t, (ms->search.offset + m->vallen));
  ------------------
  |  |  426|  6.00k|#define CAST(T, b)	((T)(b))
  ------------------
  941|  6.14k|		break;
  942|       |
  943|    266|	case FILE_CLEAR:
  ------------------
  |  |  269|    266|#define				FILE_CLEAR		47
  ------------------
  |  Branch (943:2): [True: 266, False: 455k]
  ------------------
  944|  2.52k|	case FILE_DEFAULT:
  ------------------
  |  |  225|  2.52k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (944:2): [True: 2.26k, False: 453k]
  ------------------
  945|  12.8k|	case FILE_INDIRECT:
  ------------------
  |  |  263|  12.8k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (945:2): [True: 10.3k, False: 445k]
  ------------------
  946|  12.8k|	case FILE_OFFSET:
  ------------------
  |  |  272|  12.8k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (946:2): [True: 0, False: 455k]
  ------------------
  947|  44.2k|	case FILE_USE:
  ------------------
  |  |  268|  44.2k|#define				FILE_USE		46
  ------------------
  |  Branch (947:2): [True: 31.4k, False: 424k]
  ------------------
  948|  44.2k|		o = ms->offset;
  949|  44.2k|		break;
  950|       |
  951|  23.7k|	case FILE_DER:
  ------------------
  |  |  270|  23.7k|#define				FILE_DER		48
  ------------------
  |  Branch (951:2): [True: 23.7k, False: 431k]
  ------------------
  952|  23.7k|		o = der_offs(ms, m, nbytes);
  953|  23.7k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  426|  23.7k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (953:7): [True: 0, False: 23.7k]
  |  Branch (953:18): [True: 0, False: 23.7k]
  ------------------
  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|  23.7k|		break;
  963|       |
  964|  23.7k|	case FILE_GUID:
  ------------------
  |  |  271|    317|#define				FILE_GUID		49
  ------------------
  |  Branch (964:2): [True: 317, False: 455k]
  ------------------
  965|    317|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  426|    317|#define CAST(T, b)	((T)(b))
  ------------------
  966|    317|		break;
  967|       |
  968|  50.3k|	default:
  ------------------
  |  Branch (968:2): [True: 50.3k, False: 405k]
  ------------------
  969|  50.3k|		o = 0;
  970|  50.3k|		break;
  971|   455k|	}
  972|       |
  973|   455k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  426|   455k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (973:6): [True: 19.2k, False: 436k]
  ------------------
  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|  19.2k|		return -1;
  979|  19.2k|	}
  980|   436k|	*op = o;
  981|   436k|	return 1;
  982|   455k|}

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

LLVMFuzzerInitialize:
   39|      2|extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
   40|      2|  char* exe_path = (*argv)[0];
   41|       |  // dirname() can modify its argument.
   42|      2|  char* exe_path_copy = strdup(exe_path);
   43|      2|  char* dir = dirname(exe_path_copy);
   44|      2|  env = new Environment(dir);
   45|      2|  free(exe_path_copy);
   46|      2|  return 0;
   47|      2|}
LLVMFuzzerTestOneInput:
   49|  5.87k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   50|  5.87k|  if (size < 1)
  ------------------
  |  Branch (50:7): [True: 0, False: 5.87k]
  ------------------
   51|      0|    return 0;
   52|  5.87k|  magic_buffer(env->magic, data, size);
   53|  5.87k|  return 0;
   54|  5.87k|}
_ZN11EnvironmentC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   25|      2|  Environment(std::string data_dir) {
   26|      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 */
  ------------------
   27|      2|    std::string magic_path = data_dir + "/magic";
   28|      2|    if (magic_load(magic, magic_path.c_str())) {
  ------------------
  |  Branch (28:9): [True: 0, False: 2]
  ------------------
   29|      0|      fprintf(stderr, "error loading magic file: %s\n", magic_error(magic));
   30|      0|      exit(1);
   31|      0|    }
   32|      2|  }

