file_ms_alloc:
  539|      2|{
  540|      2|	struct magic_set *ms;
  541|      2|	size_t i, len;
  542|       |
  543|      2|	if ((ms = CAST(struct magic_set *, calloc(CAST(size_t, 1u),
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (543:6): [True: 0, False: 2]
  ------------------
  544|      2|	    sizeof(*ms)))) == NULL)
  545|      0|		return NULL;
  546|       |
  547|      2|	if (magic_setflags(ms, flags) == -1) {
  ------------------
  |  Branch (547:6): [True: 0, False: 2]
  ------------------
  548|      0|		errno = EINVAL;
  549|      0|		goto free;
  550|      0|	}
  551|       |
  552|      2|	ms->o.buf = ms->o.pbuf = NULL;
  553|      2|	ms->o.blen = 0;
  554|      2|	len = (ms->c.len = 10) * sizeof(*ms->c.li);
  555|       |
  556|      2|	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (556:6): [True: 0, False: 2]
  ------------------
  557|      0|		goto free;
  558|       |
  559|      2|	ms->event_flags = 0;
  560|      2|	ms->error = -1;
  561|      6|	for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  471|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (561:14): [True: 4, False: 2]
  ------------------
  562|      4|		ms->mlist[i] = NULL;
  563|      2|	ms->fnamebuf = NULL;
  564|      2|	ms->file = "unknown";
  565|      2|	ms->line = 0;
  566|      2|	ms->magwarn = 0;
  567|      2|	ms->indir_max = FILE_INDIR_MAX;
  ------------------
  |  |  522|      2|#define	FILE_INDIR_MAX			50
  ------------------
  568|      2|	ms->name_max = FILE_NAME_MAX;
  ------------------
  |  |  523|      2|#define	FILE_NAME_MAX			150
  ------------------
  569|      2|	ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
  ------------------
  |  |  520|      2|#define	FILE_ELF_SHNUM_MAX		32768
  ------------------
  570|      2|	ms->elf_shsize_max = FILE_ELF_SHSIZE_MAX;
  ------------------
  |  |  521|      2|#define	FILE_ELF_SHSIZE_MAX		(128 * 1024 * 1024)
  ------------------
  571|      2|	ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
  ------------------
  |  |  519|      2|#define	FILE_ELF_PHNUM_MAX		2048
  ------------------
  572|      2|	ms->elf_notes_max = FILE_ELF_NOTES_MAX;
  ------------------
  |  |  518|      2|#define	FILE_ELF_NOTES_MAX		256
  ------------------
  573|      2|	ms->regex_max = FILE_REGEX_MAX;
  ------------------
  |  |  524|      2|#define	FILE_REGEX_MAX			8192
  ------------------
  574|      2|	ms->bytes_max = FILE_BYTES_MAX;
  ------------------
  |  |  516|      2|# define FILE_BYTES_MAX (7 * 1024 * 1024)/* how much of the file to look at */
  ------------------
  575|      2|	ms->encoding_max = FILE_ENCODING_MAX;
  ------------------
  |  |  525|      2|#define	FILE_ENCODING_MAX		(64 * 1024)
  ------------------
  576|      2|	ms->magwarn_max = FILE_MAGWARN_MAX;
  ------------------
  |  |  526|      2|#define	FILE_MAGWARN_MAX		64
  ------------------
  577|      2|#ifdef USE_C_LOCALE
  578|      2|	ms->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
  579|      2|	assert(ms->c_lc_ctype != NULL);
  ------------------
  |  Branch (579:2): [True: 0, False: 2]
  |  Branch (579:2): [True: 2, False: 0]
  ------------------
  580|      2|#endif
  581|      2|	return ms;
  582|      0|free:
  583|      0|	free(ms);
  584|       |	return NULL;
  585|      2|}
file_apprentice:
  726|      2|{
  727|      2|	char *p;
  728|      2|	int fileerr, errs = -1;
  729|      2|	size_t i, j;
  730|       |
  731|      2|	(void)file_reset(ms, 0);
  732|       |
  733|      2|	if ((fn = magic_getpath(fn, action)) == NULL)
  ------------------
  |  Branch (733:6): [True: 0, False: 2]
  ------------------
  734|      0|		return -1;
  735|       |
  736|      2|	init_file_tables();
  737|       |
  738|      2|	free(ms->fnamebuf);
  739|      2|	ms->file = NULL;
  740|      2|	if ((ms->fnamebuf = strdup(fn)) == NULL) {
  ------------------
  |  Branch (740:6): [True: 0, False: 2]
  ------------------
  741|      0|		file_oomem(ms, strlen(fn));
  742|      0|		return -1;
  743|      0|	}
  744|       |
  745|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  471|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (745:14): [True: 4, False: 2]
  ------------------
  746|      4|		mlist_free(ms->mlist[i]);
  747|      4|		if ((ms->mlist[i] = mlist_alloc()) == NULL) {
  ------------------
  |  Branch (747:7): [True: 0, False: 4]
  ------------------
  748|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  749|      0|			for (j = 0; j < i; j++) {
  ------------------
  |  Branch (749:16): [True: 0, False: 0]
  ------------------
  750|      0|				mlist_free(ms->mlist[j]);
  751|      0|				ms->mlist[j] = NULL;
  752|      0|			}
  753|      0|			return -1;
  754|      0|		}
  755|      4|	}
  756|      2|	fn = ms->fnamebuf;
  757|       |
  758|      4|	while (fn) {
  ------------------
  |  Branch (758:9): [True: 2, False: 2]
  ------------------
  759|      2|		p = CCAST(char *, strchr(fn, PATHSEP));
  ------------------
  |  |  454|      2|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  760|      2|		if (p)
  ------------------
  |  Branch (760:7): [True: 0, False: 2]
  ------------------
  761|      0|			*p++ = '\0';
  762|      2|		if (*fn == '\0')
  ------------------
  |  Branch (762:7): [True: 0, False: 2]
  ------------------
  763|      0|			break;
  764|      2|		fileerr = apprentice_1(ms, fn, action);
  765|      2|		errs = MAX(errs, fileerr);
  ------------------
  |  Branch (765:10): [True: 0, False: 2]
  ------------------
  766|      2|		fn = p;
  767|      2|	}
  768|       |
  769|      2|	if (errs == -1) {
  ------------------
  |  Branch (769:6): [True: 0, False: 2]
  ------------------
  770|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  471|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (770:15): [True: 0, False: 0]
  ------------------
  771|      0|			mlist_free(ms->mlist[i]);
  772|      0|			ms->mlist[i] = NULL;
  773|      0|		}
  774|      0|		file_error(ms, 0, "could not find any valid magic files!");
  775|      0|		return -1;
  776|      0|	}
  777|       |
  778|       |#if 0
  779|       |	/*
  780|       |	 * Always leave the database loaded
  781|       |	 */
  782|       |	if (action == FILE_LOAD)
  783|       |		return 0;
  784|       |
  785|       |	for (i = 0; i < MAGIC_SETS; i++) {
  786|       |		mlist_free(ms->mlist[i]);
  787|       |		ms->mlist[i] = NULL;
  788|       |	}
  789|       |#endif
  790|       |
  791|      2|	switch (action) {
  792|      2|	case FILE_LOAD:
  ------------------
  |  |  187|      2|#define	FILE_LOAD	0
  ------------------
  |  Branch (792:2): [True: 2, False: 0]
  ------------------
  793|      2|	case FILE_COMPILE:
  ------------------
  |  |  189|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (793:2): [True: 0, False: 2]
  ------------------
  794|      2|	case FILE_CHECK:
  ------------------
  |  |  188|      2|#define FILE_CHECK	1
  ------------------
  |  Branch (794:2): [True: 0, False: 2]
  ------------------
  795|      2|	case FILE_LIST:
  ------------------
  |  |  190|      2|#define FILE_LIST	3
  ------------------
  |  Branch (795:2): [True: 0, False: 2]
  ------------------
  796|      2|		return 0;
  797|      0|	default:
  ------------------
  |  Branch (797:2): [True: 0, False: 2]
  ------------------
  798|      0|		file_error(ms, 0, "Invalid action %d", action);
  799|      0|		return -1;
  800|      2|	}
  801|      2|}
file_signextend:
 1653|  85.2M|{
 1654|  85.2M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  229|  85.2M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1654:6): [True: 79.9M, False: 5.26M]
  ------------------
 1655|  79.9M|		switch(m->type) {
 1656|       |		/*
 1657|       |		 * Do not remove the casts below.  They are
 1658|       |		 * vital.  When later compared with the data,
 1659|       |		 * the sign extension must have happened.
 1660|       |		 */
 1661|   897k|		case FILE_BYTE:
  ------------------
  |  |  246|   897k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1661:3): [True: 897k, False: 79.0M]
  ------------------
 1662|   897k|			v = CAST(signed char,  v);
  ------------------
  |  |  452|   897k|#define CAST(T, b)	((T)(b))
  ------------------
 1663|   897k|			break;
 1664|  1.52M|		case FILE_SHORT:
  ------------------
  |  |  247|  1.52M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1664:3): [True: 1.52M, False: 78.4M]
  ------------------
 1665|  4.87M|		case FILE_BESHORT:
  ------------------
  |  |  252|  4.87M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1665:3): [True: 3.35M, False: 76.6M]
  ------------------
 1666|  7.86M|		case FILE_LESHORT:
  ------------------
  |  |  255|  7.86M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1666:3): [True: 2.98M, False: 76.9M]
  ------------------
 1667|  7.86M|			v = CAST(short, v);
  ------------------
  |  |  452|  7.86M|#define CAST(T, b)	((T)(b))
  ------------------
 1668|  7.86M|			break;
 1669|      0|		case FILE_DATE:
  ------------------
  |  |  251|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1669:3): [True: 0, False: 79.9M]
  ------------------
 1670|    313|		case FILE_BEDATE:
  ------------------
  |  |  254|    313|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1670:3): [True: 313, False: 79.9M]
  ------------------
 1671|    610|		case FILE_LEDATE:
  ------------------
  |  |  257|    610|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1671:3): [True: 297, False: 79.9M]
  ------------------
 1672|    646|		case FILE_MEDATE:
  ------------------
  |  |  266|    646|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1672:3): [True: 36, False: 79.9M]
  ------------------
 1673|    646|		case FILE_LDATE:
  ------------------
  |  |  259|    646|#define				FILE_LDATE		14
  ------------------
  |  Branch (1673:3): [True: 0, False: 79.9M]
  ------------------
 1674|    933|		case FILE_BELDATE:
  ------------------
  |  |  260|    933|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1674:3): [True: 287, False: 79.9M]
  ------------------
 1675|    933|		case FILE_LELDATE:
  ------------------
  |  |  261|    933|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1675:3): [True: 0, False: 79.9M]
  ------------------
 1676|    933|		case FILE_MELDATE:
  ------------------
  |  |  267|    933|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1676:3): [True: 0, False: 79.9M]
  ------------------
 1677|  1.32M|		case FILE_LONG:
  ------------------
  |  |  249|  1.32M|#define				FILE_LONG		4
  ------------------
  |  Branch (1677:3): [True: 1.32M, False: 78.6M]
  ------------------
 1678|  11.7M|		case FILE_BELONG:
  ------------------
  |  |  253|  11.7M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1678:3): [True: 10.3M, False: 69.5M]
  ------------------
 1679|  15.7M|		case FILE_LELONG:
  ------------------
  |  |  256|  15.7M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1679:3): [True: 4.03M, False: 75.9M]
  ------------------
 1680|  15.7M|		case FILE_MELONG:
  ------------------
  |  |  268|  15.7M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1680:3): [True: 60, False: 79.9M]
  ------------------
 1681|  15.7M|		case FILE_FLOAT:
  ------------------
  |  |  278|  15.7M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1681:3): [True: 0, False: 79.9M]
  ------------------
 1682|  15.7M|		case FILE_BEFLOAT:
  ------------------
  |  |  279|  15.7M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1682:3): [True: 0, False: 79.9M]
  ------------------
 1683|  15.7M|		case FILE_LEFLOAT:
  ------------------
  |  |  280|  15.7M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1683:3): [True: 0, False: 79.9M]
  ------------------
 1684|  15.7M|		case FILE_MSDOSDATE:
  ------------------
  |  |  300|  15.7M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1684:3): [True: 0, False: 79.9M]
  ------------------
 1685|  15.7M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|  15.7M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1685:3): [True: 0, False: 79.9M]
  ------------------
 1686|  15.7M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|  15.7M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1686:3): [True: 219, False: 79.9M]
  ------------------
 1687|  15.7M|		case FILE_MSDOSTIME:
  ------------------
  |  |  303|  15.7M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1687:3): [True: 0, False: 79.9M]
  ------------------
 1688|  15.7M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|  15.7M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1688:3): [True: 0, False: 79.9M]
  ------------------
 1689|  15.7M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|  15.7M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1689:3): [True: 219, False: 79.9M]
  ------------------
 1690|  15.7M|			v = CAST(int32_t, v);
  ------------------
  |  |  452|  15.7M|#define CAST(T, b)	((T)(b))
  ------------------
 1691|  15.7M|			break;
 1692|  59.7k|		case FILE_QUAD:
  ------------------
  |  |  269|  59.7k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1692:3): [True: 59.7k, False: 79.9M]
  ------------------
 1693|   710k|		case FILE_BEQUAD:
  ------------------
  |  |  271|   710k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1693:3): [True: 651k, False: 79.3M]
  ------------------
 1694|  1.04M|		case FILE_LEQUAD:
  ------------------
  |  |  270|  1.04M|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1694:3): [True: 336k, False: 79.6M]
  ------------------
 1695|  1.04M|		case FILE_QDATE:
  ------------------
  |  |  272|  1.04M|#define				FILE_QDATE		27
  ------------------
  |  Branch (1695:3): [True: 0, False: 79.9M]
  ------------------
 1696|  1.04M|		case FILE_QLDATE:
  ------------------
  |  |  275|  1.04M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1696:3): [True: 0, False: 79.9M]
  ------------------
 1697|  1.04M|		case FILE_QWDATE:
  ------------------
  |  |  287|  1.04M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1697:3): [True: 162, False: 79.9M]
  ------------------
 1698|  1.04M|		case FILE_BEQDATE:
  ------------------
  |  |  274|  1.04M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1698:3): [True: 434, False: 79.9M]
  ------------------
 1699|  1.04M|		case FILE_BEQLDATE:
  ------------------
  |  |  277|  1.04M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1699:3): [True: 148, False: 79.9M]
  ------------------
 1700|  1.04M|		case FILE_BEQWDATE:
  ------------------
  |  |  289|  1.04M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1700:3): [True: 0, False: 79.9M]
  ------------------
 1701|  1.04M|		case FILE_LEQDATE:
  ------------------
  |  |  273|  1.04M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1701:3): [True: 0, False: 79.9M]
  ------------------
 1702|  1.04M|		case FILE_LEQLDATE:
  ------------------
  |  |  276|  1.04M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1702:3): [True: 13, False: 79.9M]
  ------------------
 1703|  1.04M|		case FILE_LEQWDATE:
  ------------------
  |  |  288|  1.04M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1703:3): [True: 978, False: 79.9M]
  ------------------
 1704|  1.04M|		case FILE_DOUBLE:
  ------------------
  |  |  281|  1.04M|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1704:3): [True: 0, False: 79.9M]
  ------------------
 1705|  1.04M|		case FILE_BEDOUBLE:
  ------------------
  |  |  282|  1.04M|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1705:3): [True: 0, False: 79.9M]
  ------------------
 1706|  1.04M|		case FILE_LEDOUBLE:
  ------------------
  |  |  283|  1.04M|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1706:3): [True: 0, False: 79.9M]
  ------------------
 1707|  1.05M|		case FILE_OFFSET:
  ------------------
  |  |  297|  1.05M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1707:3): [True: 7.59k, False: 79.9M]
  ------------------
 1708|  1.05M|		case FILE_BEVARINT:
  ------------------
  |  |  298|  1.05M|#define				FILE_BEVARINT		53
  ------------------
  |  Branch (1708:3): [True: 0, False: 79.9M]
  ------------------
 1709|  1.05M|		case FILE_LEVARINT:
  ------------------
  |  |  299|  1.05M|#define				FILE_LEVARINT		54
  ------------------
  |  Branch (1709:3): [True: 0, False: 79.9M]
  ------------------
 1710|  1.05M|			v = CAST(int64_t, v);
  ------------------
  |  |  452|  1.05M|#define CAST(T, b)	((T)(b))
  ------------------
 1711|  1.05M|			break;
 1712|  53.2M|		case FILE_STRING:
  ------------------
  |  |  250|  53.2M|#define				FILE_STRING		5
  ------------------
  |  Branch (1712:3): [True: 53.2M, False: 26.6M]
  ------------------
 1713|  53.3M|		case FILE_PSTRING:
  ------------------
  |  |  258|  53.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1713:3): [True: 22.5k, False: 79.9M]
  ------------------
 1714|  53.3M|		case FILE_BESTRING16:
  ------------------
  |  |  263|  53.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1714:3): [True: 290, False: 79.9M]
  ------------------
 1715|  53.3M|		case FILE_LESTRING16:
  ------------------
  |  |  264|  53.3M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1715:3): [True: 57.7k, False: 79.9M]
  ------------------
 1716|  53.6M|		case FILE_REGEX:
  ------------------
  |  |  262|  53.6M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1716:3): [True: 260k, False: 79.7M]
  ------------------
 1717|  54.2M|		case FILE_SEARCH:
  ------------------
  |  |  265|  54.2M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1717:3): [True: 591k, False: 79.3M]
  ------------------
 1718|  54.2M|		case FILE_DEFAULT:
  ------------------
  |  |  248|  54.2M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1718:3): [True: 12.2k, False: 79.9M]
  ------------------
 1719|  54.2M|		case FILE_INDIRECT:
  ------------------
  |  |  286|  54.2M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1719:3): [True: 0, False: 79.9M]
  ------------------
 1720|  54.2M|		case FILE_NAME:
  ------------------
  |  |  290|  54.2M|#define				FILE_NAME		45
  ------------------
  |  Branch (1720:3): [True: 0, False: 79.9M]
  ------------------
 1721|  54.2M|		case FILE_USE:
  ------------------
  |  |  291|  54.2M|#define				FILE_USE		46
  ------------------
  |  Branch (1721:3): [True: 0, False: 79.9M]
  ------------------
 1722|  54.2M|		case FILE_CLEAR:
  ------------------
  |  |  292|  54.2M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1722:3): [True: 3.04k, False: 79.9M]
  ------------------
 1723|  54.2M|		case FILE_DER:
  ------------------
  |  |  293|  54.2M|#define				FILE_DER		48
  ------------------
  |  Branch (1723:3): [True: 0, False: 79.9M]
  ------------------
 1724|  54.4M|		case FILE_GUID:
  ------------------
  |  |  294|  54.4M|#define				FILE_GUID		49
  ------------------
  |  Branch (1724:3): [True: 168k, False: 79.8M]
  ------------------
 1725|  54.4M|		case FILE_LEGUID:
  ------------------
  |  |  295|  54.4M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1725:3): [True: 0, False: 79.9M]
  ------------------
 1726|  54.4M|		case FILE_BEGUID:
  ------------------
  |  |  296|  54.4M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1726:3): [True: 18, False: 79.9M]
  ------------------
 1727|  54.4M|		case FILE_OCTAL:
  ------------------
  |  |  306|  54.4M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1727:3): [True: 0, False: 79.9M]
  ------------------
 1728|  54.4M|			break;
 1729|      0|		default:
  ------------------
  |  Branch (1729:3): [True: 0, False: 79.9M]
  ------------------
 1730|      0|			if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (1730:8): [True: 0, False: 0]
  ------------------
 1731|      0|			    file_magwarn(ms, "cannot happen: m->type=%d\n",
 1732|      0|				    m->type);
 1733|      0|			return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1734|  79.9M|		}
 1735|  79.9M|	}
 1736|  85.2M|	return v;
 1737|  85.2M|}
file_pstring_length_size:
 3630|  25.5k|{
 3631|  25.5k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  382|  25.5k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  411|  25.5k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  403|  25.5k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  25.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  406|  25.5k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  25.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  405|  25.5k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  25.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  408|  25.5k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  25.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  407|  25.5k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  25.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3632|  21.9k|	case PSTRING_1_LE:
  ------------------
  |  |  404|  21.9k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  395|  21.9k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3632:2): [True: 21.9k, False: 3.67k]
  ------------------
 3633|  21.9k|		return 1;
 3634|    384|	case PSTRING_2_LE:
  ------------------
  |  |  406|    384|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  395|    384|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3634:2): [True: 384, False: 25.2k]
  ------------------
 3635|  3.20k|	case PSTRING_2_BE:
  ------------------
  |  |  405|  3.20k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  395|  3.20k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3635:2): [True: 2.82k, False: 22.7k]
  ------------------
 3636|  3.20k|		return 2;
 3637|    103|	case PSTRING_4_LE:
  ------------------
  |  |  408|    103|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  395|    103|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3637:2): [True: 103, False: 25.4k]
  ------------------
 3638|    472|	case PSTRING_4_BE:
  ------------------
  |  |  407|    472|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  395|    472|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3638:2): [True: 369, False: 25.2k]
  ------------------
 3639|    472|		return 4;
 3640|      0|	default:
  ------------------
  |  Branch (3640:2): [True: 0, False: 25.5k]
  ------------------
 3641|      0|		file_error(ms, 0, "corrupt magic file "
 3642|      0|		    "(bad pascal string length %d)",
 3643|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  382|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  411|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  403|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  406|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  405|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  408|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  407|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3644|      0|		return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3645|  25.5k|	}
 3646|  25.5k|}
file_pstring_get_length:
 3651|  22.6k|{
 3652|  22.6k|	size_t len = 0;
 3653|  22.6k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  453|  22.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3654|  22.6k|	unsigned int s3, s2, s1, s0;
 3655|       |
 3656|  22.6k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  382|  22.6k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  411|  22.6k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  403|  22.6k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  22.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  406|  22.6k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  22.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  405|  22.6k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  22.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  408|  22.6k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  22.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  407|  22.6k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  22.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3657|  21.6k|	case PSTRING_1_LE:
  ------------------
  |  |  404|  21.6k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  395|  21.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3657:2): [True: 21.6k, False: 1.03k]
  ------------------
 3658|  21.6k|		len = *s;
 3659|  21.6k|		break;
 3660|    128|	case PSTRING_2_LE:
  ------------------
  |  |  406|    128|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  395|    128|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3660:2): [True: 128, False: 22.5k]
  ------------------
 3661|    128|		s0 = s[0];
 3662|    128|		s1 = s[1];
 3663|    128|		len = (s1 << 8) | s0;
 3664|    128|		break;
 3665|    748|	case PSTRING_2_BE:
  ------------------
  |  |  405|    748|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  395|    748|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3665:2): [True: 748, False: 21.8k]
  ------------------
 3666|    748|		s0 = s[0];
 3667|    748|		s1 = s[1];
 3668|    748|		len = (s0 << 8) | s1;
 3669|    748|		break;
 3670|     37|	case PSTRING_4_LE:
  ------------------
  |  |  408|     37|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  395|     37|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3670:2): [True: 37, False: 22.6k]
  ------------------
 3671|     37|		s0 = s[0];
 3672|     37|		s1 = s[1];
 3673|     37|		s2 = s[2];
 3674|     37|		s3 = s[3];
 3675|     37|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3676|     37|		break;
 3677|    123|	case PSTRING_4_BE:
  ------------------
  |  |  407|    123|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  395|    123|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3677:2): [True: 123, False: 22.5k]
  ------------------
 3678|    123|		s0 = s[0];
 3679|    123|		s1 = s[1];
 3680|    123|		s2 = s[2];
 3681|    123|		s3 = s[3];
 3682|    123|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3683|    123|		break;
 3684|      0|	default:
  ------------------
  |  Branch (3684:2): [True: 0, False: 22.6k]
  ------------------
 3685|      0|		file_error(ms, 0, "corrupt magic file "
 3686|      0|		    "(bad pascal string length %d)",
 3687|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  382|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  411|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  403|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  406|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  405|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  408|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  407|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3688|      0|		return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3689|  22.6k|	}
 3690|       |
 3691|  22.6k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  382|  22.6k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  412|  22.6k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  395|  22.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3691:6): [True: 718, False: 21.9k]
  ------------------
 3692|    718|		size_t l = file_pstring_length_size(ms, m);
 3693|    718|		if (l == FILE_BADSIZE)
  ------------------
  |  |  175|    718|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|    718|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3693:7): [True: 0, False: 718]
  ------------------
 3694|      0|			return l;
 3695|    718|		len -= l;
 3696|    718|	}
 3697|       |
 3698|  22.6k|	return len;
 3699|  22.6k|}
file_magicfind:
 3703|  60.9k|{
 3704|  60.9k|	uint32_t i, j;
 3705|  60.9k|	struct mlist *mlist, *ml;
 3706|       |
 3707|  60.9k|	mlist = ms->mlist[1];
 3708|       |
 3709|  60.9k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3709:25): [True: 60.9k, False: 0]
  ------------------
 3710|  60.9k|		struct magic *ma = ml->magic;
 3711|   266M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3711:15): [True: 266M, False: 0]
  ------------------
 3712|   266M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  290|   266M|#define				FILE_NAME		45
  ------------------
  |  Branch (3712:8): [True: 253M, False: 12.6M]
  ------------------
 3713|   253M|				continue;
 3714|  12.6M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3714:8): [True: 60.9k, False: 12.5M]
  ------------------
 3715|  60.9k|				v->magic = &ma[i];
 3716|  60.9k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3717|  2.97M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3717:21): [True: 2.97M, False: 12]
  ------------------
 3718|  2.97M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3718:13): [True: 60.9k, False: 2.91M]
  ------------------
 3719|  60.9k|					    break;
 3720|  60.9k|				v->nmagic = j - i;
 3721|  60.9k|				return 0;
 3722|  60.9k|			}
 3723|  12.6M|		}
 3724|  60.9k|	}
 3725|      0|	return -1;
 3726|  60.9k|}
apprentice.c:mlist_free:
  665|      4|{
  666|      4|	struct mlist *ml, *next;
  667|       |
  668|      4|	if (mlist == NULL)
  ------------------
  |  Branch (668:6): [True: 4, False: 0]
  ------------------
  669|      4|		return;
  670|       |
  671|      0|	for (ml = mlist->next; ml != mlist;) {
  ------------------
  |  Branch (671:25): [True: 0, False: 0]
  ------------------
  672|      0|		next = ml->next;
  673|      0|		mlist_free_one(ml);
  674|      0|		ml = next;
  675|      0|	}
  676|      0|	mlist_free_one(mlist);
  677|      0|}
apprentice.c:init_file_tables:
  413|      2|{
  414|      2|	static int done = 0;
  415|      2|	const struct type_tbl_s *p;
  416|       |
  417|      2|	if (done)
  ------------------
  |  Branch (417:6): [True: 0, False: 2]
  ------------------
  418|      0|		return;
  419|      2|	done++;
  420|       |
  421|    126|	for (p = type_tbl; p->len; p++) {
  ------------------
  |  Branch (421:21): [True: 124, False: 2]
  ------------------
  422|    124|		assert(p->type < FILE_NAMES_SIZE);
  ------------------
  |  Branch (422:3): [True: 0, False: 124]
  |  Branch (422:3): [True: 124, False: 0]
  ------------------
  423|    124|		file_names[p->type] = p->name;
  424|    124|		file_formats[p->type] = p->format;
  425|    124|	}
  426|      2|	assert(p - type_tbl == FILE_NAMES_SIZE);
  ------------------
  |  Branch (426:2): [True: 0, False: 2]
  |  Branch (426:2): [True: 2, False: 0]
  ------------------
  427|      2|}
apprentice.c:mlist_alloc:
  623|      4|{
  624|      4|	struct mlist *mlist;
  625|      4|	if ((mlist = CAST(struct mlist *, calloc(1, sizeof(*mlist)))) == NULL) {
  ------------------
  |  |  452|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (625:6): [True: 0, False: 4]
  ------------------
  626|      0|		return NULL;
  627|      0|	}
  628|      4|	mlist->next = mlist->prev = mlist;
  629|      4|	return mlist;
  630|      4|}
apprentice.c:add_mlist:
  431|      4|{
  432|      4|	struct mlist *ml;
  433|       |
  434|      4|	mlp->map = NULL;
  435|      4|	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
  ------------------
  |  |  452|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (435:6): [True: 0, False: 4]
  ------------------
  436|      0|		return -1;
  437|       |
  438|      4|	ml->map = idx == 0 ? map : NULL;
  ------------------
  |  Branch (438:12): [True: 2, False: 2]
  ------------------
  439|      4|	ml->magic = map->magic[idx];
  440|      4|	ml->nmagic = map->nmagic[idx];
  441|      4|	if (ml->nmagic) {
  ------------------
  |  Branch (441:6): [True: 4, False: 0]
  ------------------
  442|      4|		ml->magic_rxcomp = CAST(file_regex_t **,
  ------------------
  |  |  452|      4|#define CAST(T, b)	((T)(b))
  ------------------
  443|      4|		    calloc(ml->nmagic, sizeof(*ml->magic_rxcomp)));
  444|      4|		if (ml->magic_rxcomp == NULL) {
  ------------------
  |  Branch (444:7): [True: 0, False: 4]
  ------------------
  445|      0|			free(ml);
  446|      0|			return -1;
  447|      0|		}
  448|      4|	} else
  449|      0|		ml->magic_rxcomp = NULL;
  450|      4|	mlp->prev->next = ml;
  451|      4|	ml->prev = mlp->prev;
  452|      4|	ml->next = mlp;
  453|      4|	mlp->prev = ml;
  454|      4|	return 0;
  455|      4|}
apprentice.c:apprentice_1:
  462|      2|{
  463|      2|	struct magic_map *map;
  464|      2|#ifndef COMPILE_ONLY
  465|      2|	size_t i;
  466|      2|#endif
  467|       |
  468|      2|	if (magicsize != FILE_MAGICSIZE) {
  ------------------
  |  |  183|      2|#define FILE_MAGICSIZE	432
  ------------------
  |  Branch (468:6): [True: 0, False: 2]
  ------------------
  469|      0|		file_error(ms, 0, "magic element size %lu != %lu",
  470|      0|		    CAST(unsigned long, sizeof(*map->magic[0])),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  471|      0|		    CAST(unsigned long, FILE_MAGICSIZE));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  472|      0|		return -1;
  473|      0|	}
  474|       |
  475|      2|	if (action == FILE_COMPILE) {
  ------------------
  |  |  189|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (475:6): [True: 0, False: 2]
  ------------------
  476|      0|		map = apprentice_load(ms, fn, action);
  477|      0|		if (map == NULL)
  ------------------
  |  Branch (477:7): [True: 0, False: 0]
  ------------------
  478|      0|			return -1;
  479|      0|		return apprentice_compile(ms, map, fn);
  480|      0|	}
  481|       |
  482|      2|#ifndef COMPILE_ONLY
  483|      2|	map = apprentice_map(ms, fn);
  484|      2|	if (map == NULL) {
  ------------------
  |  Branch (484:6): [True: 0, False: 2]
  ------------------
  485|      0|		if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (485:7): [True: 0, False: 0]
  ------------------
  486|      0|			file_magwarn(ms, "using regular magic file `%s'", fn);
  487|      0|		map = apprentice_load(ms, fn, action);
  488|      0|		if (map == NULL)
  ------------------
  |  Branch (488:7): [True: 0, False: 0]
  ------------------
  489|      0|			return -1;
  490|      0|	}
  491|       |
  492|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  471|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (492:14): [True: 4, False: 2]
  ------------------
  493|      4|		if (add_mlist(ms->mlist[i], map, i) == -1) {
  ------------------
  |  Branch (493:7): [True: 0, False: 4]
  ------------------
  494|       |			/* failed to add to any list, free explicitly */
  495|      0|			if (i == 0)
  ------------------
  |  Branch (495:8): [True: 0, False: 0]
  ------------------
  496|      0|				apprentice_unmap(map);
  497|      0|			else
  498|      0|				mlist_free_all(ms);
  499|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  500|      0|			return -1;
  501|      0|		}
  502|      4|	}
  503|       |
  504|      2|	if (action == FILE_LIST) {
  ------------------
  |  |  190|      2|#define FILE_LIST	3
  ------------------
  |  Branch (504:6): [True: 0, False: 2]
  ------------------
  505|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  471|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (505:15): [True: 0, False: 0]
  ------------------
  506|      0|			printf("Set %" SIZE_T_FORMAT "u:\nBinary patterns:\n",
  507|      0|			    i);
  508|      0|			apprentice_list(ms->mlist[i], BINTEST);
  ------------------
  |  |  231|      0|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  509|      0|			printf("Text patterns:\n");
  510|      0|			apprentice_list(ms->mlist[i], TEXTTEST);
  ------------------
  |  |  233|      0|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  511|      0|		}
  512|      0|	}
  513|      2|	return 0;
  514|       |#else
  515|       |	return 0;
  516|       |#endif /* COMPILE_ONLY */
  517|      2|}
apprentice.c:mkdbname:
 3526|      2|{
 3527|      2|	const char *p, *q;
 3528|      2|	char *buf;
 3529|       |
 3530|      2|	if (strip) {
  ------------------
  |  Branch (3530:6): [True: 0, False: 2]
  ------------------
 3531|      0|		if ((p = strrchr(fn, '/')) != NULL)
  ------------------
  |  Branch (3531:7): [True: 0, False: 0]
  ------------------
 3532|      0|			fn = ++p;
 3533|      0|	}
 3534|       |
 3535|     94|	for (q = fn; *q; q++)
  ------------------
  |  Branch (3535:15): [True: 92, False: 2]
  ------------------
 3536|     92|		continue;
 3537|       |	/* Look for .mgc */
 3538|      6|	for (p = ext + sizeof(ext) - 1; p >= ext && q >= fn; p--, q--)
  ------------------
  |  Branch (3538:34): [True: 6, False: 0]
  |  Branch (3538:46): [True: 6, False: 0]
  ------------------
 3539|      6|		if (*p != *q)
  ------------------
  |  Branch (3539:7): [True: 2, False: 4]
  ------------------
 3540|      2|			break;
 3541|       |
 3542|       |	/* Did not find .mgc, restore q */
 3543|      2|	if (p >= ext)
  ------------------
  |  Branch (3543:6): [True: 2, False: 0]
  ------------------
 3544|     94|		for (q = fn; *q; q++)
  ------------------
  |  Branch (3544:16): [True: 92, False: 2]
  ------------------
 3545|     92|			continue;
 3546|       |
 3547|      2|	q++;
 3548|       |	/* Compatibility with old code that looked in .mime */
 3549|      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 (3549:6): [True: 0, False: 2]
  ------------------
 3550|      0|		if (asprintf(&buf, "%.*s.mime%s", CAST(int, q - fn), fn, ext)
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3550:7): [True: 0, False: 0]
  ------------------
 3551|      0|		    < 0)
 3552|      0|			return NULL;
 3553|      0|		if (access(buf, R_OK) != -1) {
  ------------------
  |  Branch (3553:7): [True: 0, False: 0]
  ------------------
 3554|      0|			ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3555|      0|			return buf;
 3556|      0|		}
 3557|      0|		free(buf);
 3558|      0|	}
 3559|      2|	if (asprintf(&buf, "%.*s%s", CAST(int, q - fn), fn, ext) < 0)
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3559:6): [True: 0, False: 2]
  ------------------
 3560|      0|		return NULL;
 3561|       |
 3562|       |	/* Compatibility with old code that looked in .mime */
 3563|      2|	if (strstr(fn, ".mime") != NULL)
  ------------------
  |  Branch (3563:6): [True: 0, False: 2]
  ------------------
 3564|      0|		ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3565|      2|	return buf;
 3566|      2|}
apprentice.c:apprentice_map:
 3323|      2|{
 3324|      2|	int fd;
 3325|      2|	struct stat st;
 3326|      2|	char *dbname = NULL;
 3327|      2|	struct magic_map *map;
 3328|      2|	struct magic_map *rv = NULL;
 3329|       |
 3330|      2|	fd = -1;
 3331|      2|	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3331:6): [True: 0, False: 2]
  ------------------
 3332|      0|		file_oomem(ms, sizeof(*map));
 3333|      0|		goto error;
 3334|      0|	}
 3335|      2|	map->type = MAP_TYPE_USER;	/* unspecified */
  ------------------
  |  |   81|      2|#define MAP_TYPE_USER	0
  ------------------
 3336|       |
 3337|      2|	dbname = mkdbname(ms, fn, 0);
 3338|      2|	if (dbname == NULL)
  ------------------
  |  Branch (3338:6): [True: 0, False: 2]
  ------------------
 3339|      0|		goto error;
 3340|       |
 3341|      2|	if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1)
  ------------------
  |  |  728|      2|#define O_BINARY	0
  ------------------
  |  Branch (3341:6): [True: 0, False: 2]
  ------------------
 3342|      0|		goto error;
 3343|       |
 3344|      2|	if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (3344:6): [True: 0, False: 2]
  ------------------
 3345|      0|		file_error(ms, errno, "cannot stat `%s'", dbname);
 3346|      0|		goto error;
 3347|      0|	}
 3348|      2|	if (st.st_size < 8 || st.st_size > maxoff_t()) {
  ------------------
  |  Branch (3348:6): [True: 0, False: 2]
  |  Branch (3348:24): [True: 0, False: 2]
  ------------------
 3349|      0|		file_error(ms, 0, "file `%s' is too %s", dbname,
 3350|      0|		    st.st_size < 8 ? "small" : "large");
  ------------------
  |  Branch (3350:7): [True: 0, False: 0]
  ------------------
 3351|      0|		goto error;
 3352|      0|	}
 3353|       |
 3354|      2|	map->len = CAST(size_t, st.st_size);
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3355|      2|#ifdef QUICK
 3356|      2|	map->type = MAP_TYPE_MMAP;
  ------------------
  |  |   83|      2|#define MAP_TYPE_MMAP	2
  ------------------
 3357|      2|	if ((map->p = mmap(0, CAST(size_t, st.st_size), PROT_READ|PROT_WRITE,
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3357:6): [True: 0, False: 2]
  ------------------
 3358|      2|	    MAP_PRIVATE|MAP_FILE, fd, CAST(off_t, 0))) == MAP_FAILED) {
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3359|      0|		file_error(ms, errno, "cannot map `%s'", dbname);
 3360|      0|		goto error;
 3361|      0|	}
 3362|       |#else
 3363|       |	map->type = MAP_TYPE_MALLOC;
 3364|       |	if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
 3365|       |		file_oomem(ms, map->len);
 3366|       |		goto error;
 3367|       |	}
 3368|       |	if (read(fd, map->p, map->len) != (ssize_t)map->len) {
 3369|       |		file_badread(ms);
 3370|       |		goto error;
 3371|       |	}
 3372|       |#endif
 3373|      2|	(void)close(fd);
 3374|      2|	fd = -1;
 3375|       |
 3376|      2|	if (check_buffer(ms, map, dbname) != 0) {
  ------------------
  |  Branch (3376:6): [True: 0, False: 2]
  ------------------
 3377|      0|		goto error;
 3378|      0|	}
 3379|      2|#ifdef QUICK
 3380|      2|	if (mprotect(map->p, CAST(size_t, st.st_size), PROT_READ) == -1) {
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3380:6): [True: 0, False: 2]
  ------------------
 3381|      0|		file_error(ms, errno, "cannot mprotect `%s'", dbname);
 3382|      0|		goto error;
 3383|      0|	}
 3384|      2|#endif
 3385|       |
 3386|      2|	free(dbname);
 3387|      2|	return map;
 3388|       |
 3389|      0|error:
 3390|      0|	if (fd != -1)
  ------------------
  |  Branch (3390:6): [True: 0, False: 0]
  ------------------
 3391|      0|		(void)close(fd);
 3392|      0|	apprentice_unmap(map);
 3393|      0|	free(dbname);
 3394|      0|	return rv;
 3395|      2|}
apprentice.c:maxoff_t:
  314|      2|maxoff_t(void) {
  315|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(int))
  ------------------
  |  Branch (315:19): [Folded, False: 2]
  ------------------
  316|      0|		return CAST(off_t, INT_MAX);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  317|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(long))
  ------------------
  |  Branch (317:19): [True: 2, Folded]
  ------------------
  318|      2|		return CAST(off_t, LONG_MAX);
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
  319|      0|	return 0x7fffffff;
  320|      2|}
apprentice.c:check_buffer:
 3399|      2|{
 3400|      2|	uint32_t *ptr;
 3401|      2|	uint32_t entries, nentries;
 3402|      2|	uint32_t version;
 3403|      2|	int i, needsbyteswap;
 3404|       |
 3405|      2|	entries = CAST(uint32_t, map->len / sizeof(struct magic));
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3406|      2|	if (entries < MAGIC_SETS) {
  ------------------
  |  |  471|      2|#define MAGIC_SETS	2
  ------------------
  |  Branch (3406:6): [True: 0, False: 2]
  ------------------
 3407|      0|		file_error(ms, 0, "Too few magic entries %u in `%s'",
 3408|      0|		    entries, dbname);
 3409|      0|		return -1;
 3410|      0|	}
 3411|      2|	if ((entries * sizeof(struct magic)) != map->len) {
  ------------------
  |  Branch (3411:6): [True: 0, False: 2]
  ------------------
 3412|      0|		file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not "
 3413|      0|		    "a multiple of %" SIZE_T_FORMAT "u",
 3414|      0|		    dbname, map->len, sizeof(struct magic));
 3415|      0|		return -1;
 3416|      0|	}
 3417|       |
 3418|      2|	ptr = CAST(uint32_t *, map->p);
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3419|      2|	if (*ptr != MAGICNO) {
  ------------------
  |  |  181|      2|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3419:6): [True: 0, False: 2]
  ------------------
 3420|      0|		if (file_swap4(*ptr) != MAGICNO) {
  ------------------
  |  |   38|      0|#define file_swap4(x)	bswap_32(x)
  ------------------
              		if (file_swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  181|      0|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3420:7): [True: 0, False: 0]
  ------------------
 3421|      0|			file_error(ms, 0, "bad magic in `%s'", dbname);
 3422|      0|			return -1;
 3423|      0|		}
 3424|      0|		needsbyteswap = 1;
 3425|      0|	} else
 3426|      2|		needsbyteswap = 0;
 3427|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3427:6): [True: 0, False: 2]
  ------------------
 3428|      0|		version = file_swap4(ptr[1]);
  ------------------
  |  |   38|      0|#define file_swap4(x)	bswap_32(x)
  ------------------
 3429|      2|	else
 3430|      2|		version = ptr[1];
 3431|      2|	if (version != VERSIONNO) {
  ------------------
  |  |  182|      2|#define VERSIONNO	21
  ------------------
  |  Branch (3431:6): [True: 0, False: 2]
  ------------------
 3432|      0|		file_error(ms, 0, "File %s supports only version %d magic "
 3433|      0|		    "files. `%s' is version %d", VERSION,
  ------------------
  |  |  386|      0|#define VERSION "5.48"
  ------------------
 3434|      0|		    VERSIONNO, dbname, version);
  ------------------
  |  |  182|      0|#define VERSIONNO	21
  ------------------
 3435|      0|		return -1;
 3436|      0|	}
 3437|      2|	map->magic[0] = CAST(struct magic *, map->p) + 1;
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3438|      2|	nentries = 0;
 3439|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  471|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (3439:14): [True: 4, False: 2]
  ------------------
 3440|      4|		if (needsbyteswap)
  ------------------
  |  Branch (3440:7): [True: 0, False: 4]
  ------------------
 3441|      0|			map->nmagic[i] = file_swap4(ptr[i + 2]);
  ------------------
  |  |   38|      0|#define file_swap4(x)	bswap_32(x)
  ------------------
 3442|      4|		else
 3443|      4|			map->nmagic[i] = ptr[i + 2];
 3444|      4|		if (map->nmagic[i] > entries) {
  ------------------
  |  Branch (3444:7): [True: 0, False: 4]
  ------------------
 3445|      0|			file_error(ms, 0, "nmagic[%u] too large in `%s'", i,
 3446|      0|			    dbname);
 3447|      0|			return -1;
 3448|      0|		}
 3449|      4|		if (i != MAGIC_SETS - 1)
  ------------------
  |  |  471|      4|#define MAGIC_SETS	2
  ------------------
  |  Branch (3449:7): [True: 2, False: 2]
  ------------------
 3450|      2|			map->magic[i + 1] = map->magic[i] + map->nmagic[i];
 3451|      4|		nentries += map->nmagic[i];
 3452|      4|	}
 3453|      2|	if (entries != nentries + 1) {
  ------------------
  |  Branch (3453:6): [True: 0, False: 2]
  ------------------
 3454|      0|		file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
 3455|      0|		    dbname, entries, nentries + 1);
 3456|      0|		return -1;
 3457|      0|	}
 3458|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3458:6): [True: 0, False: 2]
  ------------------
 3459|      0|		for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  471|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (3459:15): [True: 0, False: 0]
  ------------------
 3460|      0|			byteswap(map->magic[i], map->nmagic[i]);
 3461|      2|	return 0;
 3462|      2|}

file_ascmagic:
   72|  12.8k|{
   73|  12.8k|	file_unichar_t *ubuf = NULL;
   74|  12.8k|	size_t ulen = 0;
   75|  12.8k|	int rv = 1;
   76|  12.8k|	struct buffer bb;
   77|       |
   78|  12.8k|	const char *code = NULL;
   79|  12.8k|	const char *code_mime = NULL;
   80|  12.8k|	const char *type = NULL;
   81|       |
   82|  12.8k|	bb = *b;
   83|  12.8k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  452|  12.8k|#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|  12.8k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 5.85k, False: 7.02k]
  |  Branch (88:23): [True: 1.71k, False: 4.13k]
  ------------------
   89|  1.71k|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  12.8k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 10.8k, False: 2.06k]
  ------------------
   93|  12.8k|	    &type) == 0)
   94|  10.8k|		rv = 0;
   95|  2.06k|        else
   96|  2.06k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  2.06k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  12.8k|	free(ubuf);
  100|       |
  101|  12.8k|	return rv;
  102|  12.8k|}
file_ascmagic_with_encoding:
  108|  2.06k|{
  109|  2.06k|	struct buffer bb;
  110|  2.06k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  2.06k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  2.06k|	size_t nbytes = b->flen;
  112|  2.06k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  2.06k|	size_t mlen, i, len;
  114|  2.06k|	int rv = -1;
  115|  2.06k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  2.06k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.06k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.06k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  2.06k|	int need_separator = 0;
  117|       |
  118|  2.06k|	const char *subtype = NULL;
  119|       |
  120|  2.06k|	int has_escapes = 0;
  121|  2.06k|	int has_backspace = 0;
  122|  2.06k|	int seen_cr = 0;
  123|       |
  124|  2.06k|	size_t n_crlf = 0;
  125|  2.06k|	size_t n_lf = 0;
  126|  2.06k|	size_t n_cr = 0;
  127|  2.06k|	size_t n_nel = 0;
  128|  2.06k|	int executable = 0;
  129|       |
  130|  2.06k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  452|  2.06k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  2.06k|	size_t has_long_lines = 0;
  132|       |
  133|  2.06k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  2.06k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 28, False: 2.03k]
  ------------------
  137|     28|		rv = 0;
  138|     28|		goto done;
  139|     28|	}
  140|       |
  141|  2.03k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  1.96k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 1.96k, False: 78]
  |  Branch (141:18): [True: 1.96k, 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.96k|		if (ulen > SIZE_MAX / 6) {
  ------------------
  |  Branch (145:7): [True: 0, False: 1.96k]
  ------------------
  146|      0|			goto done;
  147|      0|		}
  148|  1.96k|		mlen = ulen * 6;
  149|  1.96k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  452|  1.96k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (149:7): [True: 0, False: 1.96k]
  ------------------
  150|      0|			file_oomem(ms, mlen);
  151|      0|			goto done;
  152|      0|		}
  153|  1.96k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (153:7): [True: 46, False: 1.91k]
  ------------------
  154|  1.96k|		    == NULL) {
  155|     46|			rv = 0;
  156|     46|			goto done;
  157|     46|		}
  158|  1.91k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  159|  1.91k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  452|  1.91k|#define CAST(T, b)	((T)(b))
  ------------------
  160|       |
  161|  1.91k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (161:7): [True: 1.80k, False: 108]
  ------------------
  162|  1.91k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  233|  1.91k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  163|  1.80k|			rv = -1;
  164|    108|		else
  165|    108|			need_separator = 1;
  166|  1.91k|		buffer_fini(&bb);
  167|  1.91k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.91k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.91k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (167:7): [True: 0, False: 1.91k]
  ------------------
  168|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (168:9): [True: 0, False: 0]
  ------------------
  169|      0|			goto done;
  170|      0|		}
  171|  1.91k|	}
  172|       |
  173|  1.99k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.99k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.99k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (173:6): [True: 0, False: 1.99k]
  ------------------
  174|      0|		rv = 0;
  175|      0|		goto done;
  176|      0|	}
  177|       |
  178|       |	/* Now try to discover other details about the file. */
  179|  8.99M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (179:14): [True: 8.99M, False: 1.99k]
  ------------------
  180|  8.99M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (180:7): [True: 971k, False: 8.02M]
  ------------------
  181|   971k|			if (seen_cr)
  ------------------
  |  Branch (181:8): [True: 31.7k, False: 939k]
  ------------------
  182|  31.7k|				n_crlf++;
  183|   939k|			else
  184|   939k|				n_lf++;
  185|   971k|			last_line_end = i;
  186|  8.02M|		} else if (seen_cr)
  ------------------
  |  Branch (186:14): [True: 726k, False: 7.29M]
  ------------------
  187|   726k|			n_cr++;
  188|       |
  189|  8.99M|		seen_cr = (ubuf[i] == '\r');
  190|  8.99M|		if (seen_cr)
  ------------------
  |  Branch (190:7): [True: 758k, False: 8.23M]
  ------------------
  191|   758k|			last_line_end = i;
  192|       |
  193|  8.99M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (193:7): [True: 447k, False: 8.54M]
  ------------------
  194|   447k|			n_nel++;
  195|   447k|			last_line_end = i;
  196|   447k|		}
  197|       |
  198|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  199|  8.99M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  8.99M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (199:7): [True: 6.63M, False: 2.35M]
  ------------------
  200|  6.63M|			size_t ll = i - last_line_end;
  201|  6.63M|			if (ll > has_long_lines)
  ------------------
  |  Branch (201:8): [True: 6.55M, False: 77.1k]
  ------------------
  202|  6.55M|				has_long_lines = ll;
  203|  6.63M|		}
  204|       |
  205|  8.99M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (205:7): [True: 27.0k, False: 8.96M]
  ------------------
  206|  27.0k|			has_escapes = 1;
  207|  8.99M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (207:7): [True: 157k, False: 8.83M]
  ------------------
  208|   157k|			has_backspace = 1;
  209|  8.99M|	}
  210|       |
  211|  1.99k|	if (seen_cr && n_cr == 0 && n_crlf == 0)
  ------------------
  |  Branch (211:6): [True: 66, False: 1.92k]
  |  Branch (211:17): [True: 23, False: 43]
  |  Branch (211:30): [True: 21, False: 2]
  ------------------
  212|     21|		n_cr++;
  213|       |
  214|  1.99k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (214:6): [True: 0, False: 1.99k]
  ------------------
  215|      0|		rv = 0;
  216|      0|		goto done;
  217|      0|	}
  218|  1.99k|	len = file_printedlen(ms);
  219|  1.99k|	if (mime) {
  ------------------
  |  Branch (219:6): [True: 0, False: 1.99k]
  ------------------
  220|      0|		if ((mime & MAGIC_MIME_TYPE) != 0) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (220:7): [True: 0, False: 0]
  ------------------
  221|      0|			if (len) {
  ------------------
  |  Branch (221:8): [True: 0, False: 0]
  ------------------
  222|       |				/*
  223|       |				 * Softmagic printed something, we
  224|       |				 * are either done, or we need a separator
  225|       |				 */
  226|      0|				if ((ms->flags & MAGIC_CONTINUE) == 0) {
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (226:9): [True: 0, False: 0]
  ------------------
  227|      0|					rv = 1;
  228|      0|					goto done;
  229|      0|				}
  230|      0|				if (need_separator && file_separator(ms) == -1)
  ------------------
  |  Branch (230:9): [True: 0, False: 0]
  |  Branch (230:27): [True: 0, False: 0]
  ------------------
  231|      0|					goto done;
  232|      0|			}
  233|      0|			if (file_printf(ms, "text/plain") == -1)
  ------------------
  |  Branch (233:8): [True: 0, False: 0]
  ------------------
  234|      0|				goto done;
  235|      0|		}
  236|  1.99k|	} else {
  237|  1.99k|		if (len) {
  ------------------
  |  Branch (237:7): [True: 649, False: 1.34k]
  ------------------
  238|    649|			switch (file_replace(ms, " text$", ", ")) {
  239|    618|			case 0:
  ------------------
  |  Branch (239:4): [True: 618, False: 31]
  ------------------
  240|    618|				switch (file_replace(ms, " text executable$",
  241|    618|				    ", ")) {
  242|    554|				case 0:
  ------------------
  |  Branch (242:5): [True: 554, False: 64]
  ------------------
  243|    554|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (243:10): [True: 0, False: 554]
  ------------------
  244|      0|						goto done;
  245|    554|					break;
  246|    554|				case -1:
  ------------------
  |  Branch (246:5): [True: 0, False: 618]
  ------------------
  247|      0|					goto done;
  248|     64|				default:
  ------------------
  |  Branch (248:5): [True: 64, False: 554]
  ------------------
  249|     64|					executable = 1;
  250|     64|					break;
  251|    618|				}
  252|    618|				break;
  253|    618|			case -1:
  ------------------
  |  Branch (253:4): [True: 0, False: 649]
  ------------------
  254|      0|				goto done;
  255|     31|			default:
  ------------------
  |  Branch (255:4): [True: 31, False: 618]
  ------------------
  256|     31|				break;
  257|    649|			}
  258|    649|		}
  259|       |
  260|  1.99k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (260:7): [True: 0, False: 1.99k]
  ------------------
  261|      0|			goto done;
  262|       |
  263|  1.99k|		if (subtype) {
  ------------------
  |  Branch (263:7): [True: 0, False: 1.99k]
  ------------------
  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.99k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (268:7): [True: 0, False: 1.99k]
  ------------------
  269|      0|			goto done;
  270|       |
  271|  1.99k|		if (executable)
  ------------------
  |  Branch (271:7): [True: 64, False: 1.92k]
  ------------------
  272|     64|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (272:8): [True: 0, False: 64]
  ------------------
  273|      0|				goto done;
  274|       |
  275|  1.99k|		if (has_long_lines)
  ------------------
  |  Branch (275:7): [True: 174, False: 1.81k]
  ------------------
  276|    174|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (276:8): [True: 0, False: 174]
  ------------------
  277|    174|			    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.99k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (284:8): [True: 1.95k, False: 36]
  |  Branch (284:23): [True: 1.86k, False: 88]
  |  Branch (284:36): [True: 1.82k, False: 40]
  |  Branch (284:50): [True: 1.71k, False: 111]
  ------------------
  285|  1.88k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (285:8): [True: 36, False: 239]
  |  Branch (285:23): [True: 88, False: 151]
  |  Branch (285:36): [True: 40, False: 111]
  ------------------
  286|  1.88k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (286:8): [True: 0, False: 1.88k]
  ------------------
  287|      0|				goto done;
  288|       |
  289|  1.88k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (289:8): [True: 1.84k, False: 36]
  |  Branch (289:23): [True: 1.75k, False: 88]
  ------------------
  290|  1.75k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (290:8): [True: 1.71k, False: 40]
  |  Branch (290:22): [True: 1.71k, False: 0]
  ------------------
  291|  1.71k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (291:9): [True: 0, False: 1.71k]
  ------------------
  292|      0|					goto done;
  293|  1.71k|			} else {
  294|    164|				if (n_crlf) {
  ------------------
  |  Branch (294:9): [True: 36, False: 128]
  ------------------
  295|     36|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (295:10): [True: 0, False: 36]
  ------------------
  296|      0|						goto done;
  297|     36|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (297:10): [True: 19, False: 17]
  |  Branch (297:18): [True: 6, False: 11]
  |  Branch (297:26): [True: 3, False: 8]
  ------------------
  298|     28|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (298:11): [True: 0, False: 28]
  ------------------
  299|      0|							goto done;
  300|     36|				}
  301|    164|				if (n_cr) {
  ------------------
  |  Branch (301:9): [True: 107, False: 57]
  ------------------
  302|    107|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (302:10): [True: 0, False: 107]
  ------------------
  303|      0|						goto done;
  304|    107|					if (n_lf || n_nel)
  ------------------
  |  Branch (304:10): [True: 22, False: 85]
  |  Branch (304:18): [True: 4, False: 81]
  ------------------
  305|     26|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (305:11): [True: 0, False: 26]
  ------------------
  306|      0|							goto done;
  307|    107|				}
  308|    164|				if (n_lf) {
  ------------------
  |  Branch (308:9): [True: 38, False: 126]
  ------------------
  309|     38|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (309:10): [True: 0, False: 38]
  ------------------
  310|      0|						goto done;
  311|     38|					if (n_nel)
  ------------------
  |  Branch (311:10): [True: 10, False: 28]
  ------------------
  312|     10|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (312:11): [True: 0, False: 10]
  ------------------
  313|      0|							goto done;
  314|     38|				}
  315|    164|				if (n_nel)
  ------------------
  |  Branch (315:9): [True: 47, False: 117]
  ------------------
  316|     47|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (316:10): [True: 0, False: 47]
  ------------------
  317|      0|						goto done;
  318|    164|			}
  319|       |
  320|  1.88k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (320:8): [True: 0, False: 1.88k]
  ------------------
  321|      0|				goto done;
  322|  1.88k|		}
  323|       |
  324|  1.99k|		if (has_escapes)
  ------------------
  |  Branch (324:7): [True: 16, False: 1.97k]
  ------------------
  325|     16|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (325:8): [True: 0, False: 16]
  ------------------
  326|      0|				goto done;
  327|  1.99k|		if (has_backspace)
  ------------------
  |  Branch (327:7): [True: 48, False: 1.94k]
  ------------------
  328|     48|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (328:8): [True: 0, False: 48]
  ------------------
  329|      0|				goto done;
  330|  1.99k|	}
  331|  1.99k|	rv = 1;
  332|  2.06k|done:
  333|  2.06k|	free(utf8_buf);
  334|       |
  335|  2.06k|	return rv;
  336|  1.99k|}
ascmagic.c:trim_nuls:
   63|  14.9k|{
   64|   181M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 181M, False: 226]
  |  Branch (64:23): [True: 181M, False: 14.7k]
  ------------------
   65|   181M|		nbytes--;
   66|       |
   67|  14.9k|	return nbytes;
   68|  14.9k|}
ascmagic.c:encode_utf8:
  344|  1.96k|{
  345|  1.96k|	size_t i;
  346|  1.96k|	unsigned char *end = buf + len;
  347|       |
  348|  8.99M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (348:14): [True: 8.99M, False: 1.91k]
  ------------------
  349|  8.99M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (349:7): [True: 5.89M, False: 3.09M]
  ------------------
  350|  5.89M|			if (end - buf < 1)
  ------------------
  |  Branch (350:8): [True: 0, False: 5.89M]
  ------------------
  351|      0|				return NULL;
  352|  5.89M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  452|  5.89M|#define CAST(T, b)	((T)(b))
  ------------------
  353|  5.89M|			continue;
  354|  5.89M|		} 
  355|  3.09M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (355:7): [True: 2.86M, False: 233k]
  ------------------
  356|  2.86M|			if (end - buf < 2)
  ------------------
  |  Branch (356:8): [True: 0, False: 2.86M]
  ------------------
  357|      0|				return NULL;
  358|  2.86M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  452|  2.86M|#define CAST(T, b)	((T)(b))
  ------------------
  359|  2.86M|			goto out1;
  360|  2.86M|		}
  361|   233k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (361:7): [True: 157k, False: 75.5k]
  ------------------
  362|   157k|			if (end - buf < 3)
  ------------------
  |  Branch (362:8): [True: 0, False: 157k]
  ------------------
  363|      0|				return NULL;
  364|   157k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  452|   157k|#define CAST(T, b)	((T)(b))
  ------------------
  365|   157k|			goto out2;
  366|   157k|		}
  367|  75.5k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (367:7): [True: 6.76k, False: 68.7k]
  ------------------
  368|  6.76k|			if (end - buf < 4)
  ------------------
  |  Branch (368:8): [True: 0, False: 6.76k]
  ------------------
  369|      0|				return NULL;
  370|  6.76k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  452|  6.76k|#define CAST(T, b)	((T)(b))
  ------------------
  371|  6.76k|			goto out3;
  372|  6.76k|		}
  373|  68.7k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (373:7): [True: 44.9k, False: 23.8k]
  ------------------
  374|  44.9k|			if (end - buf < 5)
  ------------------
  |  Branch (374:8): [True: 0, False: 44.9k]
  ------------------
  375|      0|				return NULL;
  376|  44.9k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  452|  44.9k|#define CAST(T, b)	((T)(b))
  ------------------
  377|  44.9k|			goto out4;
  378|  44.9k|		} 
  379|  23.8k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (379:7): [True: 23.7k, False: 46]
  ------------------
  380|  23.7k|			if (end - buf < 6)
  ------------------
  |  Branch (380:8): [True: 0, False: 23.7k]
  ------------------
  381|      0|				return NULL;
  382|  23.7k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  452|  23.7k|#define CAST(T, b)	((T)(b))
  ------------------
  383|  23.7k|			goto out5;
  384|  23.7k|		} 
  385|       |		/* Invalid character */
  386|     46|		return NULL;
  387|  23.7k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  452|  23.7k|#define CAST(T, b)	((T)(b))
  ------------------
  388|  68.7k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  452|  68.7k|#define CAST(T, b)	((T)(b))
  ------------------
  389|  75.4k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  452|  75.4k|#define CAST(T, b)	((T)(b))
  ------------------
  390|   233k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  452|   233k|#define CAST(T, b)	((T)(b))
  ------------------
  391|  3.09M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  452|  3.09M|#define CAST(T, b)	((T)(b))
  ------------------
  392|  3.09M|	}
  393|       |
  394|  1.91k|	return buf;
  395|  1.96k|}

buffer_init:
   42|  97.7M|{
   43|  97.7M|	b->fd = fd;
   44|  97.7M|	if (st)
  ------------------
  |  Branch (44:6): [True: 12.2k, False: 97.7M]
  ------------------
   45|  12.2k|		memcpy(&b->st, st, sizeof(b->st));
   46|  97.7M|	else if (b->fd == -1 || fstat(b->fd, &b->st) == -1)
  ------------------
  |  Branch (46:11): [True: 97.7M, False: 0]
  |  Branch (46:26): [True: 0, False: 0]
  ------------------
   47|  97.7M|		memset(&b->st, 0, sizeof(b->st));
   48|  97.7M|	b->fbuf = data;
   49|  97.7M|	b->flen = len;
   50|  97.7M|	b->eoff = 0;
   51|       |	b->ebuf = NULL;
   52|  97.7M|	b->elen = 0;
   53|  97.7M|}
buffer_fini:
   57|  32.7k|{
   58|  32.7k|	free(b->ebuf);
   59|       |	b->ebuf = NULL;
   60|  32.7k|	b->elen = 0;
   61|  32.7k|}
buffer_fill:
   65|   289k|{
   66|   289k|	struct buffer *b = CCAST(struct buffer *, bb);
  ------------------
  |  |  454|   289k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
   67|       |
   68|   289k|	if (b->elen != 0)
  ------------------
  |  Branch (68:6): [True: 197k, False: 92.2k]
  ------------------
   69|   197k|		return b->elen == FILE_BADSIZE ? -1 : 0;
  ------------------
  |  |  175|   197k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|   197k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (69:10): [True: 0, False: 197k]
  ------------------
   70|       |
   71|       |	// Nothing to refill, everything is in memory
   72|  92.2k|	if (b->fd == -1)
  ------------------
  |  Branch (72:6): [True: 68.8k, False: 23.4k]
  ------------------
   73|  68.8k|		return 0;
   74|       |
   75|  23.4k|	if (!S_ISREG(b->st.st_mode))
  ------------------
  |  Branch (75:6): [True: 0, False: 23.4k]
  ------------------
   76|      0|		goto out;
   77|       |
   78|  23.4k|	b->elen = CAST(size_t, b->st.st_size) < b->flen ?
  ------------------
  |  |  452|  23.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (78:12): [True: 0, False: 23.4k]
  ------------------
   79|  23.4k|	    CAST(size_t, b->st.st_size) : b->flen;
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
   80|  23.4k|	if (b->elen == 0) {
  ------------------
  |  Branch (80:6): [True: 1.80k, False: 21.6k]
  ------------------
   81|  1.80k|		free(b->ebuf);
   82|  1.80k|		b->ebuf = NULL;
   83|  1.80k|		return 0;
   84|  1.80k|	}
   85|  21.6k|	if ((b->ebuf = malloc(b->elen)) == NULL)
  ------------------
  |  Branch (85:6): [True: 0, False: 21.6k]
  ------------------
   86|      0|		goto out;
   87|       |
   88|  21.6k|	b->eoff = b->st.st_size - b->elen;
   89|  21.6k|	if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
  ------------------
  |  Branch (89:6): [True: 0, False: 21.6k]
  ------------------
   90|      0|		free(b->ebuf);
   91|      0|		b->ebuf = NULL;
   92|      0|		goto out;
   93|      0|	}
   94|       |
   95|  21.6k|	return 0;
   96|      0|out:
   97|      0|	b->elen = FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
   98|      0|	return -1;
   99|  21.6k|}

cdf_swap_header:
  229|  3.22k|{
  230|  3.22k|	size_t i;
  231|       |
  232|  3.22k|	h->h_magic = CDF_TOLE8(h->h_magic);
  ------------------
  |  |   81|  3.22k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  233|  3.22k|	h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
  ------------------
  |  |   81|  3.22k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  3.22k|	h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
  ------------------
  |  |   81|  3.22k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  3.22k|	h->h_revision = CDF_TOLE2(h->h_revision);
  ------------------
  |  |   85|  3.22k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  3.22k|	h->h_version = CDF_TOLE2(h->h_version);
  ------------------
  |  |   85|  3.22k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  3.22k|	h->h_byte_order = CDF_TOLE2(h->h_byte_order);
  ------------------
  |  |   85|  3.22k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  3.22k|	h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
  ------------------
  |  |   85|  3.22k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  3.22k|	h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
  ------------------
  |  |   85|  3.22k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  3.22k|	h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  3.22k|	h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|  3.22k|	h->h_min_size_standard_stream =
  243|  3.22k|	    CDF_TOLE4(h->h_min_size_standard_stream);
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  244|  3.22k|	h->h_secid_first_sector_in_short_sat =
  245|  3.22k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_short_sat));
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|  3.22k|	h->h_num_sectors_in_short_sat =
  247|  3.22k|	    CDF_TOLE4(h->h_num_sectors_in_short_sat);
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  248|  3.22k|	h->h_secid_first_sector_in_master_sat =
  249|  3.22k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_master_sat));
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  250|  3.22k|	h->h_num_sectors_in_master_sat =
  251|  3.22k|	    CDF_TOLE4(h->h_num_sectors_in_master_sat);
  ------------------
  |  |   83|  3.22k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  252|   354k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  130|   354k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (252:14): [True: 351k, False: 3.22k]
  ------------------
  253|   351k|		h->h_master_sat[i] =
  254|   351k|		    CDF_TOLE4(CAST(uint32_t, h->h_master_sat[i]));
  ------------------
  |  |   83|   351k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|   703k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 351k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  255|   351k|	}
  256|  3.22k|}
cdf_unpack_header:
  260|  3.22k|{
  261|  3.22k|	size_t i;
  262|  3.22k|	size_t len = 0;
  263|       |
  264|  3.22k|	CDF_UNPACK(h->h_magic);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  265|  3.22k|	CDF_UNPACKA(h->h_uuid);
  ------------------
  |  |  207|  3.22k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  266|  3.22k|	CDF_UNPACK(h->h_revision);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  267|  3.22k|	CDF_UNPACK(h->h_version);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  268|  3.22k|	CDF_UNPACK(h->h_byte_order);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  269|  3.22k|	CDF_UNPACK(h->h_sec_size_p2);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  270|  3.22k|	CDF_UNPACK(h->h_short_sec_size_p2);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  271|  3.22k|	CDF_UNPACKA(h->h_unused0);
  ------------------
  |  |  207|  3.22k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  272|  3.22k|	CDF_UNPACK(h->h_num_sectors_in_sat);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  273|  3.22k|	CDF_UNPACK(h->h_secid_first_directory);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  274|  3.22k|	CDF_UNPACKA(h->h_unused1);
  ------------------
  |  |  207|  3.22k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  275|  3.22k|	CDF_UNPACK(h->h_min_size_standard_stream);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  276|  3.22k|	CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  277|  3.22k|	CDF_UNPACK(h->h_num_sectors_in_short_sat);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  278|  3.22k|	CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  279|  3.22k|	CDF_UNPACK(h->h_num_sectors_in_master_sat);
  ------------------
  |  |  205|  3.22k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  280|   354k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  130|   354k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (280:14): [True: 351k, False: 3.22k]
  ------------------
  281|   351k|		CDF_UNPACK(h->h_master_sat[i]);
  ------------------
  |  |  205|   351k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  282|  3.22k|}
cdf_swap_class:
  303|    670|{
  304|    670|	d->cl_dword = CDF_TOLE4(d->cl_dword);
  ------------------
  |  |   83|    670|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  305|    670|	d->cl_word[0] = CDF_TOLE2(d->cl_word[0]);
  ------------------
  |  |   85|    670|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|    670|	d->cl_word[1] = CDF_TOLE2(d->cl_word[1]);
  ------------------
  |  |   85|    670|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|    670|}
cdf_unpack_dir:
  311|  14.0k|{
  312|  14.0k|	size_t len = 0;
  313|       |
  314|  14.0k|	CDF_UNPACKA(d->d_name);
  ------------------
  |  |  207|  14.0k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  315|  14.0k|	CDF_UNPACK(d->d_namelen);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  316|  14.0k|	CDF_UNPACK(d->d_type);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  317|  14.0k|	CDF_UNPACK(d->d_color);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  318|  14.0k|	CDF_UNPACK(d->d_left_child);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  319|  14.0k|	CDF_UNPACK(d->d_right_child);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  320|  14.0k|	CDF_UNPACK(d->d_storage);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  321|  14.0k|	CDF_UNPACKA(d->d_storage_uuid);
  ------------------
  |  |  207|  14.0k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  322|  14.0k|	CDF_UNPACK(d->d_flags);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  323|  14.0k|	CDF_UNPACK(d->d_created);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  324|  14.0k|	CDF_UNPACK(d->d_modified);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  325|  14.0k|	CDF_UNPACK(d->d_stream_first_sector);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  326|  14.0k|	CDF_UNPACK(d->d_size);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  327|  14.0k|	CDF_UNPACK(d->d_unused0);
  ------------------
  |  |  205|  14.0k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  328|  14.0k|}
cdf_zero_stream:
  332|  3.21k|{
  333|  3.21k|	scn->sst_len = 0;
  334|  3.21k|	scn->sst_dirlen = 0;
  335|  3.21k|	scn->sst_ss = 0;
  336|  3.21k|	free(scn->sst_tab);
  337|       |	scn->sst_tab = NULL;
  338|  3.21k|	return -1;
  339|  3.21k|}
cdf_read_header:
  395|  12.9k|{
  396|  12.9k|	char buf[512];
  397|       |
  398|  12.9k|	(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
  399|  12.9k|	if (cdf_read(info, CAST(off_t, 0), buf, sizeof(buf)) == -1)
  ------------------
  |  |  452|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (399:6): [True: 9.68k, False: 3.22k]
  ------------------
  400|  9.68k|		return -1;
  401|  3.22k|	cdf_unpack_header(h, buf);
  402|  3.22k|	cdf_swap_header(h);
  403|  3.22k|	if (h->h_magic != CDF_MAGIC) {
  ------------------
  |  |   61|  3.22k|#define CDF_MAGIC	0xE11AB1A1E011CFD0LL
  ------------------
  |  Branch (403:6): [True: 1.80k, False: 1.42k]
  ------------------
  404|  1.80k|		DPRINTF(("Bad magic %#" INT64_T_FORMAT "x != %#"
  405|  1.80k|		    INT64_T_FORMAT "x\n",
  406|  1.80k|		    (unsigned long long)h->h_magic,
  407|  1.80k|		    (unsigned long long)CDF_MAGIC));
  408|  1.80k|		goto out;
  409|  1.80k|	}
  410|  1.42k|	if (h->h_sec_size_p2 > 20) {
  ------------------
  |  Branch (410:6): [True: 10, False: 1.41k]
  ------------------
  411|     10|		DPRINTF(("Bad sector size %hu\n", h->h_sec_size_p2));
  412|     10|		goto out;
  413|     10|	}
  414|  1.41k|	if (h->h_short_sec_size_p2 > 20) {
  ------------------
  |  Branch (414:6): [True: 7, False: 1.40k]
  ------------------
  415|      7|		DPRINTF(("Bad short sector size %hu\n",
  416|      7|		    h->h_short_sec_size_p2));
  417|      7|		goto out;
  418|      7|	}
  419|  1.40k|	return 0;
  420|  1.82k|out:
  421|  1.82k|	errno = EFTYPE;
  ------------------
  |  |   58|  1.82k|#define EFTYPE EINVAL
  ------------------
  422|  1.82k|	return -1;
  423|  1.41k|}
cdf_read_sector:
  429|   166k|{
  430|   166k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|   166k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|   166k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  431|   166k|	size_t pos;
  432|       |
  433|   166k|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   62|   166k|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  452|   166k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  452|   166k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (433:6): [True: 0, False: 166k]
  ------------------
  434|      0|		return -1;
  435|       |
  436|   166k|	pos = CDF_SEC_POS(h, id);
  ------------------
  |  |   81|   166k|#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|   166k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   166k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|   166k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   166k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  437|   166k|	assert(ss == len);
  ------------------
  |  Branch (437:2): [True: 0, False: 166k]
  |  Branch (437:2): [True: 166k, False: 0]
  ------------------
  438|   166k|	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  452|   166k|#define CAST(T, b)	((T)(b))
  ------------------
              	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  453|   166k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  439|   166k|}
cdf_read_short_sector:
  444|    656|{
  445|    656|	size_t ss = CDF_SHORT_SEC_SIZE(h);
  ------------------
  |  |   82|    656|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|    656|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  446|    656|	size_t pos;
  447|       |
  448|    656|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   62|    656|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  452|    656|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  452|    656|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (448:6): [True: 0, False: 656]
  ------------------
  449|      0|		return -1;
  450|       |
  451|    656|	pos = CDF_SHORT_SEC_POS(h, id);
  ------------------
  |  |   83|    656|#define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   82|    656|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    656|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  452|    656|	assert(ss == len);
  ------------------
  |  Branch (452:2): [True: 0, False: 656]
  |  Branch (452:2): [True: 656, False: 0]
  ------------------
  453|    656|	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
  ------------------
  |  |   80|    656|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|    656|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (453:6): [True: 11, False: 645]
  ------------------
  454|     11|		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
  455|     11|		    SIZE_T_FORMAT "u\n",
  456|     11|		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
  457|     11|		goto out;
  458|     11|	}
  459|    645|	(void)memcpy(RCAST(char *, buf) + offs,
  ------------------
  |  |  453|    645|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  460|    645|	    RCAST(const char *, sst->sst_tab) + pos, len);
  ------------------
  |  |  453|    645|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  461|    645|	return len;
  462|     11|out:
  463|     11|	errno = EFTYPE;
  ------------------
  |  |   58|     11|#define EFTYPE EINVAL
  ------------------
  464|     11|	return -1;
  465|    656|}
cdf_read_sat:
  472|  1.40k|{
  473|  1.40k|	size_t i, j, k;
  474|  1.40k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  1.40k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|  1.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  475|  1.40k|	cdf_secid_t *msa, mid, sec;
  476|  1.40k|	size_t nsatpersec = (ss / sizeof(mid)) - 1;
  477|       |
  478|  97.6k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  130|  97.6k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (478:14): [True: 96.8k, False: 782]
  ------------------
  479|  96.8k|		if (h->h_master_sat[i] == CDF_SECID_FREE)
  ------------------
  |  |   54|  96.8k|#define CDF_SECID_FREE					-1
  ------------------
  |  Branch (479:7): [True: 623, False: 96.2k]
  ------------------
  480|    623|			break;
  481|       |
  482|  1.40k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  483|  1.40k|	if ((nsatpersec > 0 &&
  ------------------
  |  Branch (483:7): [True: 1.25k, False: 147]
  ------------------
  484|  1.25k|	    h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
  ------------------
  |  |  482|  1.25k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (484:6): [True: 16, False: 1.24k]
  ------------------
  485|  1.38k|	    i > CDF_SEC_LIMIT) {
  ------------------
  |  |  482|  1.38k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (485:6): [True: 1, False: 1.38k]
  ------------------
  486|     17|		DPRINTF(("Number of sectors in master SAT too big %u %"
  487|     17|		    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));
  488|     17|		errno = EFTYPE;
  ------------------
  |  |   58|     17|#define EFTYPE EINVAL
  ------------------
  489|     17|		return -1;
  490|     17|	}
  491|       |
  492|  1.38k|	sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
  493|  1.38k|#define CDF_SAT_LIMIT	(16 * 1024 * 1024)
  494|  1.38k|	if (ss != 0 && sat->sat_len > CDF_SAT_LIMIT / ss) {
  ------------------
  |  |  493|  1.38k|#define CDF_SAT_LIMIT	(16 * 1024 * 1024)
  ------------------
  |  Branch (494:6): [True: 1.38k, False: 0]
  |  Branch (494:17): [True: 29, False: 1.35k]
  ------------------
  495|     29|		errno = EFTYPE;
  ------------------
  |  |   58|     29|#define EFTYPE EINVAL
  ------------------
  496|     29|		return -1;
  497|     29|	}
  498|  1.35k|	DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
  499|  1.35k|	    sat->sat_len, ss));
  500|  1.35k|	if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
  ------------------
  |  |  452|  1.35k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (500:6): [True: 0, False: 1.35k]
  ------------------
  501|  1.35k|	    == NULL)
  502|      0|		return -1;
  503|       |
  504|  37.6k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  130|  37.6k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (504:14): [True: 37.3k, False: 306]
  ------------------
  505|  37.3k|		if (h->h_master_sat[i] < 0)
  ------------------
  |  Branch (505:7): [True: 1.03k, False: 36.3k]
  ------------------
  506|  1.03k|			break;
  507|  36.3k|		if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (507:7): [True: 21, False: 36.3k]
  ------------------
  508|  36.3k|		    h->h_master_sat[i]) != CAST(ssize_t, ss)) {
  ------------------
  |  |  452|  36.3k|#define CAST(T, b)	((T)(b))
  ------------------
  509|     21|			DPRINTF(("Reading sector %d", h->h_master_sat[i]));
  510|     21|			goto out1;
  511|     21|		}
  512|  36.3k|	}
  513|       |
  514|  1.33k|	if ((msa = CAST(cdf_secid_t *, CDF_CALLOC(1, ss))) == NULL)
  ------------------
  |  |  452|  1.33k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (514:6): [True: 0, False: 1.33k]
  ------------------
  515|      0|		goto out1;
  516|       |
  517|  1.33k|	mid = h->h_secid_first_sector_in_master_sat;
  518|  23.9k|	for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
  ------------------
  |  Branch (518:14): [True: 23.4k, False: 568]
  ------------------
  519|  23.4k|		if (mid < 0)
  ------------------
  |  Branch (519:7): [True: 176, False: 23.2k]
  ------------------
  520|    176|			goto out;
  521|  23.2k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  23.2k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (521:7): [True: 2, False: 23.2k]
  ------------------
  522|      2|			DPRINTF(("Reading master sector loop limit"));
  523|      2|			goto out3;
  524|      2|		}
  525|  23.2k|		if (cdf_read_sector(info, msa, 0, ss, h, mid) !=
  ------------------
  |  Branch (525:7): [True: 65, False: 23.1k]
  ------------------
  526|  23.2k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  452|  23.2k|#define CAST(T, b)	((T)(b))
  ------------------
  527|     65|			DPRINTF(("Reading master sector %d", mid));
  528|     65|			goto out2;
  529|     65|		}
  530|   122k|		for (k = 0; k < nsatpersec; k++, i++) {
  ------------------
  |  Branch (530:15): [True: 99.7k, False: 22.6k]
  ------------------
  531|  99.7k|			sec = CDF_TOLE4(CAST(uint32_t, msa[k]));
  ------------------
  |  |   83|  99.7k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|   199k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 99.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  532|  99.7k|			if (sec < 0)
  ------------------
  |  Branch (532:8): [True: 500, False: 99.2k]
  ------------------
  533|    500|				goto out;
  534|  99.2k|			if (i >= sat->sat_len) {
  ------------------
  |  Branch (534:8): [True: 0, False: 99.2k]
  ------------------
  535|      0|			    DPRINTF(("Out of bounds reading MSA %"
  536|      0|				SIZE_T_FORMAT "u >= %" SIZE_T_FORMAT "u",
  537|      0|				i, sat->sat_len));
  538|      0|			    goto out3;
  539|      0|			}
  540|  99.2k|			if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (540:8): [True: 27, False: 99.1k]
  ------------------
  541|  99.2k|			    sec) != CAST(ssize_t, ss)) {
  ------------------
  |  |  452|  99.2k|#define CAST(T, b)	((T)(b))
  ------------------
  542|     27|				DPRINTF(("Reading sector %d",
  543|     27|				    CDF_TOLE4(msa[k])));
  544|     27|				goto out2;
  545|     27|			}
  546|  99.2k|		}
  547|  22.6k|		mid = CDF_TOLE4(CAST(uint32_t, msa[nsatpersec]));
  ------------------
  |  |   83|  22.6k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  45.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 22.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  548|  22.6k|	}
  549|  1.24k|out:
  550|  1.24k|	sat->sat_len = i;
  551|  1.24k|	free(msa);
  552|  1.24k|	return 0;
  553|      2|out3:
  554|      2|	errno = EFTYPE;
  ------------------
  |  |   58|      2|#define EFTYPE EINVAL
  ------------------
  555|     94|out2:
  556|     94|	free(msa);
  557|    115|out1:
  558|    115|	free(sat->sat_tab);
  559|    115|	return -1;
  560|     94|}
cdf_count_chain:
  564|  3.36k|{
  565|  3.36k|	size_t i, j;
  566|  3.36k|	cdf_secid_t maxsector = CAST(cdf_secid_t, (sat->sat_len * size)
  ------------------
  |  |  452|  3.36k|#define CAST(T, b)	((T)(b))
  ------------------
  567|  3.36k|	    / sizeof(maxsector));
  568|       |
  569|  3.36k|	DPRINTF(("Chain:"));
  570|  3.36k|	if (sid == CDF_SECID_END_OF_CHAIN) {
  ------------------
  |  |   55|  3.36k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (570:6): [True: 31, False: 3.32k]
  ------------------
  571|       |		/* 0-length chain. */
  572|     31|		DPRINTF((" empty\n"));
  573|     31|		return 0;
  574|     31|	}
  575|       |
  576|   301k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (576:18): [True: 298k, False: 3.03k]
  ------------------
  577|   298k|		DPRINTF((" %d", sid));
  578|   298k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   298k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (578:7): [True: 29, False: 298k]
  ------------------
  579|     29|			DPRINTF(("Counting chain loop limit"));
  580|     29|			goto out;
  581|     29|		}
  582|   298k|		if (sid >= maxsector) {
  ------------------
  |  Branch (582:7): [True: 266, False: 298k]
  ------------------
  583|    266|			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
  584|    266|			goto out;
  585|    266|		}
  586|   298k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   83|   298k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|   596k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 298k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  587|   298k|	}
  588|  3.03k|	if (i == 0) {
  ------------------
  |  Branch (588:6): [True: 166, False: 2.86k]
  ------------------
  589|    166|		DPRINTF((" none, sid: %d\n", sid));
  590|    166|		goto out;
  591|       |
  592|    166|	}
  593|  2.86k|	DPRINTF(("\n"));
  594|  2.86k|	return i;
  595|    461|out:
  596|    461|	errno = EFTYPE;
  ------------------
  |  |   58|    461|#define EFTYPE EINVAL
  ------------------
  597|    461|	return CAST(size_t, -1);
  ------------------
  |  |  452|    461|#define CAST(T, b)	((T)(b))
  ------------------
  598|  3.03k|}
cdf_read_long_sector_chain:
  603|    898|{
  604|    898|	size_t ss = CDF_SEC_SIZE(h), i, j;
  ------------------
  |  |   80|    898|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|    898|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  605|    898|	ssize_t nr;
  606|    898|	scn->sst_tab = NULL;
  607|    898|	scn->sst_len = cdf_count_chain(sat, sid, ss);
  608|    898|	scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
  ------------------
  |  Branch (608:20): [True: 429, False: 469]
  ------------------
  609|    898|	scn->sst_ss = ss;
  610|       |
  611|    898|	if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
  ------------------
  |  |   55|  1.79k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (611:6): [True: 4, False: 894]
  |  Branch (611:39): [True: 31, False: 863]
  ------------------
  612|     35|		return cdf_zero_stream(scn);
  613|       |
  614|    863|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  452|    863|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (614:6): [True: 65, False: 798]
  ------------------
  615|     65|		goto out;
  616|       |
  617|    798|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   95|    798|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  618|    798|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (618:6): [True: 0, False: 798]
  ------------------
  619|      0|		return cdf_zero_stream(scn);
  620|       |
  621|  3.46k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (621:18): [True: 2.68k, False: 777]
  ------------------
  622|  2.68k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  2.68k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (622:7): [True: 0, False: 2.68k]
  ------------------
  623|      0|			DPRINTF(("Read long sector chain loop limit"));
  624|      0|			goto out;
  625|      0|		}
  626|  2.68k|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (626:7): [True: 0, False: 2.68k]
  ------------------
  627|      0|			DPRINTF(("Out of bounds reading long sector chain "
  628|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  629|      0|			    scn->sst_len));
  630|      0|			goto out;
  631|      0|		}
  632|  2.68k|		if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (632:7): [True: 21, False: 2.66k]
  ------------------
  633|  2.68k|		    sid)) != CAST(ssize_t, ss)) {
  ------------------
  |  |  452|  2.68k|#define CAST(T, b)	((T)(b))
  ------------------
  634|     21|			if (i == scn->sst_len - 1 && nr > 0) {
  ------------------
  |  Branch (634:8): [True: 12, False: 9]
  |  Branch (634:33): [True: 0, False: 12]
  ------------------
  635|       |				/* Last sector might be truncated */
  636|      0|				return 0;
  637|      0|			}
  638|     21|			DPRINTF(("Reading long sector chain %d", sid));
  639|     21|			goto out;
  640|     21|		}
  641|  2.66k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   83|  2.66k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  5.32k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 2.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  642|  2.66k|	}
  643|    777|	return 0;
  644|     86|out:
  645|     86|	errno = EFTYPE;
  ------------------
  |  |   58|     86|#define EFTYPE EINVAL
  ------------------
  646|     86|	return cdf_zero_stream(scn);
  647|    798|}
cdf_read_short_sector_chain:
  653|    198|{
  654|    198|	size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
  ------------------
  |  |   82|    198|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|    198|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  655|    198|	scn->sst_tab = NULL;
  656|    198|	scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
  ------------------
  |  |   80|    198|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|    198|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  657|    198|	scn->sst_dirlen = len;
  658|    198|	scn->sst_ss = ss;
  659|       |
  660|    198|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  452|    198|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (660:6): [True: 72, False: 126]
  ------------------
  661|     72|		goto out;
  662|       |
  663|    126|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   95|    126|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  664|    126|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (664:6): [True: 0, False: 126]
  ------------------
  665|      0|		return cdf_zero_stream(scn);
  666|       |
  667|    771|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (667:18): [True: 656, False: 115]
  ------------------
  668|    656|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    656|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (668:7): [True: 0, False: 656]
  ------------------
  669|      0|			DPRINTF(("Read short sector chain loop limit"));
  670|      0|			goto out;
  671|      0|		}
  672|    656|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (672:7): [True: 0, False: 656]
  ------------------
  673|      0|			DPRINTF(("Out of bounds reading short sector chain "
  674|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n",
  675|      0|			    i, scn->sst_len));
  676|      0|			goto out;
  677|      0|		}
  678|    656|		if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (678:7): [True: 11, False: 645]
  ------------------
  679|    656|		    sid) != CAST(ssize_t, ss)) {
  ------------------
  |  |  452|    656|#define CAST(T, b)	((T)(b))
  ------------------
  680|     11|			DPRINTF(("Reading short sector chain %d", sid));
  681|     11|			goto out;
  682|     11|		}
  683|    645|		sid = CDF_TOLE4(CAST(uint32_t, ssat->sat_tab[sid]));
  ------------------
  |  |   83|    645|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.29k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 645]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  684|    645|	}
  685|    115|	return 0;
  686|     83|out:
  687|     83|	errno = EFTYPE;
  ------------------
  |  |   58|     83|#define EFTYPE EINVAL
  ------------------
  688|     83|	return cdf_zero_stream(scn);
  689|    126|}
cdf_read_sector_chain:
  695|    865|{
  696|       |
  697|    865|	if (len < h->h_min_size_standard_stream && sst->sst_tab != NULL)
  ------------------
  |  Branch (697:6): [True: 433, False: 432]
  |  Branch (697:45): [True: 198, False: 235]
  ------------------
  698|    198|		return cdf_read_short_sector_chain(h, ssat, sst, sid, len,
  699|    198|		    scn);
  700|    667|	else
  701|    667|		return cdf_read_long_sector_chain(info, h, sat, sid, len, scn);
  702|    865|}
cdf_read_dir:
  707|  1.02k|{
  708|  1.02k|	size_t i, j;
  709|  1.02k|	size_t ss = CDF_SEC_SIZE(h), ns, nd;
  ------------------
  |  |   80|  1.02k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|  1.02k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  710|  1.02k|	char *buf;
  711|  1.02k|	cdf_secid_t sid = h->h_secid_first_directory;
  712|       |
  713|  1.02k|	ns = cdf_count_chain(sat, sid, ss);
  714|  1.02k|	if (ns == CAST(size_t, -1))
  ------------------
  |  |  452|  1.02k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (714:6): [True: 95, False: 925]
  ------------------
  715|     95|		return -1;
  716|       |
  717|    925|	nd = ss / CDF_DIRECTORY_SIZE;
  ------------------
  |  |  117|    925|#define CDF_DIRECTORY_SIZE	128
  ------------------
  718|       |
  719|    925|	dir->dir_len = ns * nd;
  720|    925|	dir->dir_tab = CAST(cdf_directory_t *,
  ------------------
  |  |  452|    925|#define CAST(T, b)	((T)(b))
  ------------------
  721|    925|	    CDF_CALLOC(dir->dir_len, sizeof(dir->dir_tab[0])));
  722|    925|	if (dir->dir_tab == NULL)
  ------------------
  |  Branch (722:6): [True: 0, False: 925]
  ------------------
  723|      0|		return -1;
  724|       |
  725|    925|	if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
  ------------------
  |  |  452|    925|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (725:6): [True: 0, False: 925]
  ------------------
  726|      0|		free(dir->dir_tab);
  727|      0|		return -1;
  728|      0|	}
  729|       |
  730|  4.02k|	for (j = i = 0; i < ns; i++, j++) {
  ------------------
  |  Branch (730:18): [True: 3.11k, False: 913]
  ------------------
  731|  3.11k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  3.11k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (731:7): [True: 0, False: 3.11k]
  ------------------
  732|      0|			DPRINTF(("Read dir loop limit"));
  733|      0|			goto out;
  734|      0|		}
  735|  3.11k|		if (cdf_read_sector(info, buf, 0, ss, h, sid) !=
  ------------------
  |  Branch (735:7): [True: 12, False: 3.10k]
  ------------------
  736|  3.11k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  452|  3.11k|#define CAST(T, b)	((T)(b))
  ------------------
  737|     12|			DPRINTF(("Reading directory sector %d", sid));
  738|     12|			goto out;
  739|     12|		}
  740|  17.1k|		for (j = 0; j < nd; j++) {
  ------------------
  |  Branch (740:15): [True: 14.0k, False: 3.10k]
  ------------------
  741|  14.0k|			cdf_unpack_dir(&dir->dir_tab[i * nd + j],
  742|  14.0k|			    &buf[j * CDF_DIRECTORY_SIZE]);
  ------------------
  |  |  117|  14.0k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  743|  14.0k|		}
  744|  3.10k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   83|  3.10k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  6.20k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 3.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  745|  3.10k|	}
  746|    913|	if (NEED_SWAP)
  ------------------
  |  |   78|    913|#define NEED_SWAP	(cdf_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  452|    913|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (78:19): [True: 0, False: 913]
  |  |  ------------------
  ------------------
  747|      0|		for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (747:15): [True: 0, False: 0]
  ------------------
  748|      0|			cdf_swap_dir(&dir->dir_tab[i]);
  749|    913|	free(buf);
  750|    913|	return 0;
  751|     12|out:
  752|     12|	free(dir->dir_tab);
  753|     12|	free(buf);
  754|     12|	errno = EFTYPE;
  ------------------
  |  |   58|     12|#define EFTYPE EINVAL
  ------------------
  755|     12|	return -1;
  756|    925|}
cdf_read_ssat:
  762|  1.24k|{
  763|  1.24k|	size_t i, j;
  764|  1.24k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  1.24k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|  1.24k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  765|  1.24k|	cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
  766|       |
  767|  1.24k|	ssat->sat_tab = NULL;
  768|  1.24k|	ssat->sat_len = cdf_count_chain(sat, sid, ss);
  769|  1.24k|	if (ssat->sat_len == CAST(size_t, -1))
  ------------------
  |  |  452|  1.24k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (769:6): [True: 206, False: 1.03k]
  ------------------
  770|    206|		goto out;
  771|       |
  772|  1.03k|	ssat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(ssat->sat_len, ss));
  ------------------
  |  |  452|  1.03k|#define CAST(T, b)	((T)(b))
  ------------------
  773|  1.03k|	if (ssat->sat_tab == NULL)
  ------------------
  |  Branch (773:6): [True: 0, False: 1.03k]
  ------------------
  774|      0|		goto out1;
  775|       |
  776|  2.69k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (776:18): [True: 1.67k, False: 1.02k]
  ------------------
  777|  1.67k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.67k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (777:7): [True: 0, False: 1.67k]
  ------------------
  778|      0|			DPRINTF(("Read short sat sector loop limit"));
  779|      0|			goto out;
  780|      0|		}
  781|  1.67k|		if (i >= ssat->sat_len) {
  ------------------
  |  Branch (781:7): [True: 0, False: 1.67k]
  ------------------
  782|      0|			DPRINTF(("Out of bounds reading short sector chain "
  783|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  784|      0|			    ssat->sat_len));
  785|      0|			goto out;
  786|      0|		}
  787|  1.67k|		if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
  ------------------
  |  Branch (787:7): [True: 18, False: 1.65k]
  ------------------
  788|  1.67k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  452|  1.67k|#define CAST(T, b)	((T)(b))
  ------------------
  789|     18|			DPRINTF(("Reading short sat sector %d", sid));
  790|     18|			goto out1;
  791|     18|		}
  792|  1.65k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   83|  1.65k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  3.31k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 1.65k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  793|  1.65k|	}
  794|  1.02k|	return 0;
  795|    206|out:
  796|    206|	errno = EFTYPE;
  ------------------
  |  |   58|    206|#define EFTYPE EINVAL
  ------------------
  797|    224|out1:
  798|    224|	free(ssat->sat_tab);
  799|    224|	return -1;
  800|    206|}
cdf_read_short_stream:
  806|    913|{
  807|    913|	size_t i;
  808|    913|	const cdf_directory_t *d;
  809|       |
  810|    913|	*root = NULL;
  811|  8.91k|	for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (811:14): [True: 8.30k, False: 612]
  ------------------
  812|  8.30k|		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
  ------------------
  |  |  101|  8.30k|#define CDF_DIR_TYPE_ROOT_STORAGE	5
  ------------------
  |  Branch (812:7): [True: 301, False: 8.00k]
  ------------------
  813|    301|			break;
  814|       |
  815|       |	/* If the it is not there, just fake it; some docs don't have it */
  816|    913|	if (i == dir->dir_len) {
  ------------------
  |  Branch (816:6): [True: 612, False: 301]
  ------------------
  817|    612|		DPRINTF(("Cannot find root storage dir\n"));
  818|    612|		goto out;
  819|    612|	}
  820|    301|	d = &dir->dir_tab[i];
  821|    301|	*root = d;
  822|       |
  823|       |	/* If the it is not there, just fake it; some docs don't have it */
  824|    301|	if (d->d_stream_first_sector < 0) {
  ------------------
  |  Branch (824:6): [True: 70, False: 231]
  ------------------
  825|     70|		DPRINTF(("No first secror in dir\n"));
  826|     70|		goto out;
  827|     70|	}
  828|       |
  829|    231|	return cdf_read_long_sector_chain(info, h, sat,
  830|    231|	    d->d_stream_first_sector, d->d_size, scn);
  831|    682|out:
  832|       |	scn->sst_tab = NULL;
  833|    682|	(void)cdf_zero_stream(scn);
  834|    682|	return 0;
  835|    301|}
cdf_namecmp:
  839|  14.7k|{
  840|  34.6k|	for (; l--; d++, s++)
  ------------------
  |  Branch (840:9): [True: 33.8k, False: 887]
  ------------------
  841|  33.8k|		if (*d != CDF_TOLE2(*s))
  ------------------
  |  |   85|  33.8k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  67.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 33.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (841:7): [True: 13.8k, False: 19.9k]
  ------------------
  842|  13.8k|			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |  452|  13.8k|#define CAST(T, b)	((T)(b))
  ------------------
              			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |   85|  13.8k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  27.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 13.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  843|    887|	return 0;
  844|  14.7k|}
cdf_read_doc_summary_info:
  850|    751|{
  851|    751|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  852|    751|	    "\05DocumentSummaryInformation", scn);
  853|    751|}
cdf_read_summary_info:
  859|    863|{
  860|    863|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  861|    863|	    "\05SummaryInformation", scn);
  862|    863|}
cdf_read_user_stream:
  868|  2.47k|{
  869|  2.47k|	const cdf_directory_t *d;
  870|  2.47k|	int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
  ------------------
  |  |   98|  2.47k|#define CDF_DIR_TYPE_USER_STREAM	2
  ------------------
  871|       |
  872|  2.47k|	if (i <= 0) {
  ------------------
  |  Branch (872:6): [True: 1.61k, False: 865]
  ------------------
  873|  1.61k|		memset(scn, 0, sizeof(*scn));
  874|  1.61k|		return -1;
  875|  1.61k|	}
  876|       |
  877|    865|	d = &dir->dir_tab[i - 1];
  878|    865|	return cdf_read_sector_chain(info, h, sat, ssat, sst,
  879|    865|	    d->d_stream_first_sector, d->d_size, scn);
  880|  2.47k|}
cdf_find_stream:
  884|  2.47k|{
  885|  2.47k|	size_t i, name_len = strlen(name) + 1;
  886|       |
  887|  23.2k|	for (i = 1; i <= dir->dir_len; i++)
  ------------------
  |  Branch (887:14): [True: 21.6k, False: 1.61k]
  ------------------
  888|  21.6k|		if (dir->dir_tab[i-1].d_type == type &&
  ------------------
  |  Branch (888:7): [True: 3.90k, False: 17.7k]
  ------------------
  889|  3.90k|		    cdf_namecmp(name, dir->dir_tab[i-1].d_name, name_len)
  ------------------
  |  Branch (889:7): [True: 865, False: 3.03k]
  ------------------
  890|  3.90k|		    == 0)
  891|    865|			break;
  892|  2.47k|	if (i <= dir->dir_len)
  ------------------
  |  Branch (892:6): [True: 865, False: 1.61k]
  ------------------
  893|    865|		return CAST(int, i);
  ------------------
  |  |  452|    865|#define CAST(T, b)	((T)(b))
  ------------------
  894|       |
  895|  1.61k|	DPRINTF(("Cannot find type %d `%s'\n", type, name));
  896|  1.61k|	errno = ESRCH;
  897|  1.61k|	return 0;
  898|  2.47k|}
cdf_read_property_info:
  997|    670|{
  998|    670|	const cdf_section_header_t *shp;
  999|    670|	cdf_section_header_t sh;
 1000|    670|	const uint8_t *p, *q, *e;
 1001|    670|	size_t i, o4, nelements, j, slen, left;
 1002|    670|	cdf_property_info_t *inp;
 1003|       |
 1004|    670|	if (offs > UINT32_MAX / 4) {
  ------------------
  |  Branch (1004:6): [True: 11, False: 659]
  ------------------
 1005|     11|		errno = EFTYPE;
  ------------------
  |  |   58|     11|#define EFTYPE EINVAL
  ------------------
 1006|     11|		goto out;
 1007|     11|	}
 1008|    659|	shp = CAST(const cdf_section_header_t *,
  ------------------
  |  |  452|    659|#define CAST(T, b)	((T)(b))
  ------------------
 1009|    659|	    cdf_offset(sst->sst_tab, offs));
 1010|    659|	if (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)
  ------------------
  |  Branch (1010:6): [True: 59, False: 600]
  ------------------
 1011|     59|		goto out;
 1012|    600|	sh.sh_len = CDF_TOLE4(shp->sh_len);
  ------------------
  |  |   83|    600|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.20k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 600]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1013|    600|	if (sh.sh_len > CDF_SHLEN_LIMIT) {
  ------------------
  |  |  900|    600|#define CDF_SHLEN_LIMIT (UINT32_MAX / 64)
  ------------------
  |  Branch (1013:6): [True: 16, False: 584]
  ------------------
 1014|     16|		errno = EFTYPE;
  ------------------
  |  |   58|     16|#define EFTYPE EINVAL
  ------------------
 1015|     16|		goto out;
 1016|     16|	}
 1017|       |
 1018|    584|	if (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)
  ------------------
  |  Branch (1018:6): [True: 41, False: 543]
  ------------------
 1019|     41|		goto out;
 1020|       |
 1021|    543|	sh.sh_properties = CDF_TOLE4(shp->sh_properties);
  ------------------
  |  |   83|    543|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.08k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 543]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1022|    543|	DPRINTF(("section len: %u properties %u\n", sh.sh_len,
 1023|    543|	    sh.sh_properties));
 1024|    543|	if (sh.sh_properties > CDF_PROP_LIMIT)
  ------------------
  |  |  901|    543|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (1024:6): [True: 18, False: 525]
  ------------------
 1025|     18|		goto out;
 1026|    525|	inp = cdf_grow_info(info, maxcount, sh.sh_properties);
 1027|    525|	if (inp == NULL)
  ------------------
  |  Branch (1027:6): [True: 0, False: 525]
  ------------------
 1028|      0|		goto out;
 1029|    525|	inp += *count;
 1030|    525|	*count += sh.sh_properties;
 1031|    525|	p = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));
  ------------------
  |  |  452|    525|#define CAST(T, b)	((T)(b))
  ------------------
 1032|    525|	e = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));
  ------------------
  |  |  452|    525|#define CAST(T, b)	((T)(b))
  ------------------
 1033|    525|	if (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
  ------------------
  |  Branch (1033:6): [True: 20, False: 505]
  |  Branch (1033:16): [True: 0, False: 505]
  ------------------
 1034|     20|		goto out;
 1035|       |
 1036|  8.47k|	for (i = 0; i < sh.sh_properties; i++) {
  ------------------
  |  Branch (1036:14): [True: 8.23k, False: 236]
  ------------------
 1037|  8.23k|		if ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)
  ------------------
  |  Branch (1037:7): [True: 198, False: 8.04k]
  ------------------
 1038|    198|			goto out;
 1039|  8.04k|		inp[i].pi_id = CDF_GETUINT32(p, i << 1);
  ------------------
  |  |   91|  8.04k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1040|  8.04k|		left = CAST(size_t, e - q);
  ------------------
  |  |  452|  8.04k|#define CAST(T, b)	((T)(b))
  ------------------
 1041|  8.04k|		if (left < sizeof(uint32_t)) {
  ------------------
  |  Branch (1041:7): [True: 3, False: 8.03k]
  ------------------
 1042|      3|			DPRINTF(("short info (no type)_\n"));
 1043|      3|			goto out;
 1044|      3|		}
 1045|  8.03k|		inp[i].pi_type = CDF_GETUINT32(q, 0);
  ------------------
  |  |   91|  8.03k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1046|  8.03k|		DPRINTF(("%" SIZE_T_FORMAT "u) id=%#x type=%#x offs=%#tx,%#x\n",
 1047|  8.03k|		    i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
 1048|  8.03k|		if (inp[i].pi_type & CDF_VECTOR) {
  ------------------
  |  |  237|  8.03k|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1048:7): [True: 1.03k, False: 7.00k]
  ------------------
 1049|  1.03k|			if (left < sizeof(uint32_t) * 2) {
  ------------------
  |  Branch (1049:8): [True: 3, False: 1.03k]
  ------------------
 1050|      3|				DPRINTF(("missing CDF_VECTOR length\n"));
 1051|      3|				goto out;
 1052|      3|			}
 1053|  1.03k|			nelements = CDF_GETUINT32(q, 1);
  ------------------
  |  |   91|  1.03k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1054|  1.03k|			if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
  ------------------
  |  |   51|  2.06k|#define CDF_ELEMENT_LIMIT				100000
  ------------------
  |  Branch (1054:8): [True: 18, False: 1.01k]
  |  Branch (1054:41): [True: 6, False: 1.00k]
  ------------------
 1055|     24|				DPRINTF(("CDF_VECTOR with nelements == %"
 1056|     24|				    SIZE_T_FORMAT "u\n", nelements));
 1057|     24|				goto out;
 1058|     24|			}
 1059|  1.00k|			slen = 2;
 1060|  7.00k|		} else {
 1061|  7.00k|			nelements = 1;
 1062|  7.00k|			slen = 1;
 1063|  7.00k|		}
 1064|  8.01k|		o4 = slen * sizeof(uint32_t);
 1065|  8.01k|		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  238|  8.01k|#define CDF_ARRAY		0x00002000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  239|  8.01k|#define CDF_BYREF		0x00004000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  240|  8.01k|#define CDF_RESERVED		0x00008000
  ------------------
  |  Branch (1065:7): [True: 399, False: 7.61k]
  ------------------
 1066|    399|			goto unknown;
 1067|  7.61k|		switch (inp[i].pi_type & CDF_TYPEMASK) {
  ------------------
  |  |  243|  7.61k|#define CDF_TYPEMASK		0x00000fff
  ------------------
 1068|    425|		case CDF_NULL:
  ------------------
  |  |  198|    425|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (1068:3): [True: 425, False: 7.18k]
  ------------------
 1069|    960|		case CDF_EMPTY:
  ------------------
  |  |  197|    960|#define CDF_EMPTY		0x00000000
  ------------------
  |  Branch (1069:3): [True: 535, False: 7.07k]
  ------------------
 1070|    960|			break;
 1071|  1.02k|		case CDF_SIGNED16:
  ------------------
  |  |  199|  1.02k|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (1071:3): [True: 1.02k, False: 6.59k]
  ------------------
 1072|  1.02k|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))
  ------------------
  |  Branch (1072:8): [True: 660, False: 360]
  ------------------
 1073|    660|				goto unknown;
 1074|    360|			break;
 1075|    360|		case CDF_SIGNED32:
  ------------------
  |  |  200|    280|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (1075:3): [True: 280, False: 7.33k]
  ------------------
 1076|    502|		case CDF_BOOL:
  ------------------
  |  |  208|    502|#define CDF_BOOL		0x0000000b
  ------------------
  |  Branch (1076:3): [True: 222, False: 7.39k]
  ------------------
 1077|    863|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|    863|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (1077:3): [True: 361, False: 7.25k]
  ------------------
 1078|  1.37k|		case CDF_FLOAT:
  ------------------
  |  |  201|  1.37k|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (1078:3): [True: 509, False: 7.10k]
  ------------------
 1079|  1.37k|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))
  ------------------
  |  Branch (1079:8): [True: 630, False: 742]
  ------------------
 1080|    630|				goto unknown;
 1081|    742|			break;
 1082|    742|		case CDF_SIGNED64:
  ------------------
  |  |  216|    342|#define CDF_SIGNED64		0x00000014
  ------------------
  |  Branch (1082:3): [True: 342, False: 7.27k]
  ------------------
 1083|    584|		case CDF_UNSIGNED64:
  ------------------
  |  |  217|    584|#define CDF_UNSIGNED64		0x00000015
  ------------------
  |  Branch (1083:3): [True: 242, False: 7.37k]
  ------------------
 1084|    984|		case CDF_DOUBLE:
  ------------------
  |  |  202|    984|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (1084:3): [True: 400, False: 7.21k]
  ------------------
 1085|  1.82k|		case CDF_FILETIME:
  ------------------
  |  |  228|  1.82k|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (1085:3): [True: 839, False: 6.77k]
  ------------------
 1086|  1.82k|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))
  ------------------
  |  Branch (1086:8): [True: 566, False: 1.25k]
  ------------------
 1087|    566|				goto unknown;
 1088|  1.25k|			break;
 1089|  1.25k|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|    351|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (1089:3): [True: 351, False: 7.26k]
  ------------------
 1090|    761|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    761|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (1090:3): [True: 410, False: 7.20k]
  ------------------
 1091|    761|			if (nelements > 1) {
  ------------------
  |  Branch (1091:8): [True: 123, False: 638]
  ------------------
 1092|    123|				size_t nelem = inp - *info;
 1093|    123|				inp = cdf_grow_info(info, maxcount, nelements);
 1094|    123|				if (inp == NULL)
  ------------------
  |  Branch (1094:9): [True: 1, False: 122]
  ------------------
 1095|      1|					goto out;
 1096|    122|				inp += nelem;
 1097|    122|			}
 1098|   247k|			for (j = 0; j < nelements && i < sh.sh_properties;
  ------------------
  |  Branch (1098:16): [True: 247k, False: 716]
  |  Branch (1098:33): [True: 247k, False: 4]
  ------------------
 1099|   246k|			    j++, i++)
 1100|   247k|			{
 1101|   247k|				uint32_t l;
 1102|       |
 1103|   247k|				if (o4 + sizeof(uint32_t) > left)
  ------------------
  |  Branch (1103:9): [True: 7, False: 247k]
  ------------------
 1104|      7|					goto out;
 1105|       |
 1106|   247k|				l = CDF_GETUINT32(q, slen);
  ------------------
  |  |   91|   247k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1107|   247k|				o4 += sizeof(uint32_t);
 1108|   247k|				if (o4 + l > left)
  ------------------
  |  Branch (1108:9): [True: 33, False: 246k]
  ------------------
 1109|     33|					goto out;
 1110|       |
 1111|   246k|				inp[i].pi_str.s_len = l;
  ------------------
  |  |  191|   246k|#define pi_str	pi_val._pi_str
  ------------------
 1112|   246k|				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  191|   246k|#define pi_str	pi_val._pi_str
  ------------------
              				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  452|   246k|#define CAST(T, b)	((T)(b))
  ------------------
 1113|   246k|				    CAST(const void *, &q[o4]));
 1114|       |
 1115|   246k|				DPRINTF(("o=%" SIZE_T_FORMAT "u l=%d(%"
 1116|   246k|				    SIZE_T_FORMAT "u), t=%" SIZE_T_FORMAT
 1117|   246k|				    "u s=%.*s\n", o4, l,
 1118|   246k|				    CDF_ROUND(l, sizeof(l)),
 1119|   246k|				    left, (int)l, inp[i].pi_str.s_buf));
 1120|       |
 1121|   246k|				if (l & 1)
  ------------------
  |  Branch (1121:9): [True: 451, False: 246k]
  ------------------
 1122|    451|					l++;
 1123|       |
 1124|   246k|				slen += l >> 1;
 1125|   246k|				o4 = slen * sizeof(uint32_t);
 1126|   246k|			}
 1127|    720|			i--;
 1128|    720|			break;
 1129|    248|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|    248|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (1129:3): [True: 248, False: 7.36k]
  ------------------
 1130|    248|			if (inp[i].pi_type & CDF_VECTOR)
  ------------------
  |  |  237|    248|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1130:8): [True: 23, False: 225]
  ------------------
 1131|     23|				goto unknown;
 1132|    225|			break;
 1133|  1.42k|		default:
  ------------------
  |  Branch (1133:3): [True: 1.42k, False: 6.18k]
  ------------------
 1134|  3.70k|		unknown:
 1135|  3.70k|			memset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));
 1136|  3.70k|			DPRINTF(("Don't know how to deal with %#x\n",
 1137|  3.70k|			    inp[i].pi_type));
 1138|  3.70k|			break;
 1139|  7.61k|		}
 1140|  7.61k|	}
 1141|    236|	return 0;
 1142|    434|out:
 1143|    434|	free(*info);
 1144|    434|	*info = NULL;
 1145|    434|	*count = 0;
 1146|    434|	*maxcount = 0;
 1147|    434|	errno = EFTYPE;
  ------------------
  |  |   58|    434|#define EFTYPE EINVAL
  ------------------
 1148|    434|	return -1;
 1149|    505|}
cdf_unpack_summary_info:
 1154|    694|{
 1155|    694|	size_t maxcount;
 1156|    694|	const cdf_summary_info_header_t *si =
 1157|    694|	    CAST(const cdf_summary_info_header_t *, sst->sst_tab);
  ------------------
  |  |  452|    694|#define CAST(T, b)	((T)(b))
  ------------------
 1158|    694|	const cdf_section_declaration_t *sd =
 1159|    694|	    CAST(const cdf_section_declaration_t *, RCAST(const void *,
  ------------------
  |  |  452|    694|#define CAST(T, b)	((T)(b))
  ------------------
 1160|    694|	    RCAST(const char *, sst->sst_tab)
 1161|    694|	    + CDF_SECTION_DECLARATION_OFFSET));
 1162|       |
 1163|    694|	if (cdf_check_stream_offset(sst, h, si, sizeof(*si), __LINE__) == -1 ||
  ------------------
  |  Branch (1163:6): [True: 21, False: 673]
  ------------------
 1164|    673|	    cdf_check_stream_offset(sst, h, sd, sizeof(*sd), __LINE__) == -1)
  ------------------
  |  Branch (1164:6): [True: 3, False: 670]
  ------------------
 1165|     24|		return -1;
 1166|    670|	ssi->si_byte_order = CDF_TOLE2(si->si_byte_order);
  ------------------
  |  |   85|    670|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1167|    670|	ssi->si_os_version = CDF_TOLE2(si->si_os_version);
  ------------------
  |  |   85|    670|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1168|    670|	ssi->si_os = CDF_TOLE2(si->si_os);
  ------------------
  |  |   85|    670|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1169|    670|	ssi->si_class = si->si_class;
 1170|    670|	cdf_swap_class(&ssi->si_class);
 1171|    670|	ssi->si_count = CDF_TOLE4(si->si_count);
  ------------------
  |  |   83|    670|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1172|    670|	*count = 0;
 1173|    670|	maxcount = 0;
 1174|    670|	*info = NULL;
 1175|    670|	if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
  ------------------
  |  |   83|    670|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1175:6): [True: 434, False: 236]
  ------------------
 1176|    670|	    count, &maxcount) == -1)
 1177|    434|		return -1;
 1178|    236|	return 0;
 1179|    670|}
cdf_print_property_name:
 1298|  1.58k|{
 1299|  1.58k|	size_t i;
 1300|       |
 1301|  26.0k|	for (i = 0; i < __arraycount(vn); i++)
  ------------------
  |  |  130|  26.0k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1301:14): [True: 24.9k, False: 1.05k]
  ------------------
 1302|  24.9k|		if (vn[i].v == p)
  ------------------
  |  Branch (1302:7): [True: 536, False: 24.4k]
  ------------------
 1303|    536|			return snprintf(buf, bufsiz, "%s", vn[i].n);
 1304|  1.05k|	return snprintf(buf, bufsiz, "%#x", p);
 1305|  1.58k|}
cdf_print_elapsed_time:
 1309|    169|{
 1310|    169|	int len = 0;
 1311|    169|	int days, hours, mins, secs;
 1312|       |
 1313|    169|	ts /= CDF_TIME_PREC;
  ------------------
  |  |   90|    169|#define CDF_TIME_PREC	10000000
  ------------------
 1314|    169|	secs = CAST(int, ts % 60);
  ------------------
  |  |  452|    169|#define CAST(T, b)	((T)(b))
  ------------------
 1315|    169|	ts /= 60;
 1316|    169|	mins = CAST(int, ts % 60);
  ------------------
  |  |  452|    169|#define CAST(T, b)	((T)(b))
  ------------------
 1317|    169|	ts /= 60;
 1318|    169|	hours = CAST(int, ts % 24);
  ------------------
  |  |  452|    169|#define CAST(T, b)	((T)(b))
  ------------------
 1319|    169|	ts /= 24;
 1320|    169|	days = CAST(int, ts);
  ------------------
  |  |  452|    169|#define CAST(T, b)	((T)(b))
  ------------------
 1321|       |
 1322|    169|	if (days) {
  ------------------
  |  Branch (1322:6): [True: 111, False: 58]
  ------------------
 1323|    111|		len += snprintf(buf + len, bufsiz - len, "%dd+", days);
 1324|    111|		if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  452|    111|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1324:7): [True: 0, False: 111]
  ------------------
 1325|      0|			return len;
 1326|    111|	}
 1327|       |
 1328|    169|	if (days || hours) {
  ------------------
  |  Branch (1328:6): [True: 111, False: 58]
  |  Branch (1328:14): [True: 28, False: 30]
  ------------------
 1329|    139|		len += snprintf(buf + len, bufsiz - len, "%.2d:", hours);
 1330|    139|		if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  452|    139|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1330:7): [True: 0, False: 139]
  ------------------
 1331|      0|			return len;
 1332|    139|	}
 1333|       |
 1334|    169|	len += snprintf(buf + len, bufsiz - len, "%.2d:", mins);
 1335|    169|	if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  452|    169|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1335:6): [True: 0, False: 169]
  ------------------
 1336|      0|		return len;
 1337|       |
 1338|    169|	len += snprintf(buf + len, bufsiz - len, "%.2d", secs);
 1339|    169|	return len;
 1340|    169|}
cdf.c:cdf_read:
  370|   179k|{
  371|   179k|	size_t siz = CAST(size_t, off + len);
  ------------------
  |  |  452|   179k|#define CAST(T, b)	((T)(b))
  ------------------
  372|       |
  373|   179k|	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  452|   179k|#define CAST(T, b)	((T)(b))
  ------------------
              	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  452|   179k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (373:6): [True: 0, False: 179k]
  ------------------
  374|      0|		goto out;
  375|       |
  376|   179k|	if (info->i_buf != NULL && info->i_len >= siz) {
  ------------------
  |  Branch (376:6): [True: 179k, False: 0]
  |  Branch (376:29): [True: 169k, False: 9.84k]
  ------------------
  377|   169k|		(void)memcpy(buf, &info->i_buf[off], len);
  378|   169k|		return CAST(ssize_t, len);
  ------------------
  |  |  452|   169k|#define CAST(T, b)	((T)(b))
  ------------------
  379|   169k|	}
  380|       |
  381|  9.84k|	if (info->i_fd == -1)
  ------------------
  |  Branch (381:6): [True: 2.97k, False: 6.87k]
  ------------------
  382|  2.97k|		goto out;
  383|       |
  384|  6.87k|	if (pread(info->i_fd, buf, len, off) != CAST(ssize_t, len))
  ------------------
  |  |  452|  6.87k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (384:6): [True: 6.87k, False: 0]
  ------------------
  385|  6.87k|		return -1;
  386|       |
  387|      0|	return CAST(ssize_t, len);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  388|  2.97k|out:
  389|  2.97k|	errno = EINVAL;
  390|  2.97k|	return -1;
  391|  6.87k|}
cdf.c:cdf_calloc:
  124|  5.58k|{
  125|  5.58k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u %"
  126|  5.58k|	    SIZE_T_FORMAT "u\n", file, line, __func__, n, u));
  127|  5.58k|	if (n == 0)
  ------------------
  |  Branch (127:6): [True: 60, False: 5.52k]
  ------------------
  128|     60|	    n++;
  129|  5.58k|	return calloc(n, u);
  130|  5.58k|}
cdf.c:cdf_malloc:
  102|    925|{
  103|    925|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  104|    925|	    file, line, __func__, n));
  105|    925|	if (n == 0)
  ------------------
  |  Branch (105:6): [True: 0, False: 925]
  ------------------
  106|      0|	    n++;
  107|    925|	return malloc(n);
  108|    925|}
cdf.c:cdf_offset:
  905|  9.75k|{
  906|  9.75k|	return CAST(const void *, CAST(const uint8_t *, p) + l);
  ------------------
  |  |  452|  9.75k|#define CAST(T, b)	((T)(b))
  ------------------
  907|  9.75k|}
cdf.c:cdf_check_stream_offset:
  353|  11.3k|{
  354|  11.3k|	const char *b = RCAST(const char *, sst->sst_tab);
  ------------------
  |  |  453|  11.3k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  355|  11.3k|	const char *e = RCAST(const char *, p) + tail;
  ------------------
  |  |  453|  11.3k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  356|  11.3k|	size_t ss = cdf_check_stream(sst, h);
  357|  11.3k|	/*LINTED*/(void)&line;
  358|  11.3k|	if (e >= b && CAST(size_t, e - b) <= ss * sst->sst_len)
  ------------------
  |  |  452|  11.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (358:6): [True: 11.3k, False: 0]
  |  Branch (358:16): [True: 11.2k, False: 131]
  ------------------
  359|  11.2k|		return 0;
  360|    131|	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
  361|    131|	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
  362|    131|	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
  363|    131|	    ss * sst->sst_len, ss, sst->sst_len));
  364|    131|	errno = EFTYPE;
  ------------------
  |  |   58|    131|#define EFTYPE EINVAL
  ------------------
  365|    131|	return -1;
  366|  11.3k|}
cdf.c:cdf_grow_info:
  942|    648|{
  943|    648|	cdf_property_info_t *inp;
  944|    648|	size_t newcount = *maxcount + incr;
  945|       |
  946|    648|	if (newcount > CDF_PROP_LIMIT) {
  ------------------
  |  |  901|    648|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (946:6): [True: 1, False: 647]
  ------------------
  947|      1|		DPRINTF(("exceeded property limit %" SIZE_T_FORMAT "u > %"
  948|      1|		    SIZE_T_FORMAT "u\n", newcount, CDF_PROP_LIMIT));
  949|      1|		goto out;
  950|      1|	}
  951|    647|	inp = CAST(cdf_property_info_t *,
  ------------------
  |  |  452|    647|#define CAST(T, b)	((T)(b))
  ------------------
  952|    647|	    CDF_REALLOC(*info, newcount * sizeof(*inp)));
  953|    647|	if (inp == NULL)
  ------------------
  |  Branch (953:6): [True: 0, False: 647]
  ------------------
  954|      0|		goto out;
  955|       |
  956|    647|	*info = inp;
  957|    647|	*maxcount = newcount;
  958|    647|	return inp;
  959|      1|out:
  960|      1|	free(*info);
  961|      1|	*maxcount = 0;
  962|      1|	*info = NULL;
  963|       |	return NULL;
  964|    647|}
cdf.c:cdf_realloc:
  114|    647|{
  115|    647|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  116|    647|	    file, line, __func__, n));
  117|    647|	return realloc(p, n);
  118|    647|}
cdf.c:cdf_get_property_info_pos:
  912|  8.23k|{
  913|  8.23k|	size_t tail = (i << 1) + 1;
  914|  8.23k|	size_t ofs;
  915|       |
  916|  8.23k|	if (p >= e) {
  ------------------
  |  Branch (916:6): [True: 0, False: 8.23k]
  ------------------
  917|      0|		DPRINTF(("Past end %p < %p\n", e, p));
  918|      0|		return NULL;
  919|      0|	}
  920|       |
  921|  8.23k|	if (cdf_check_stream_offset(sst, h, p, (tail + 1) * sizeof(uint32_t),
  ------------------
  |  Branch (921:6): [True: 7, False: 8.23k]
  ------------------
  922|  8.23k|	    __LINE__) == -1)
  923|      7|		return NULL;
  924|       |
  925|  8.23k|	ofs = CDF_GETUINT32(p, tail);
  ------------------
  |  |   91|  8.23k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
  926|  8.23k|	if (ofs < 2 * sizeof(uint32_t)) {
  ------------------
  |  Branch (926:6): [True: 25, False: 8.20k]
  ------------------
  927|     25|		DPRINTF(("Offset too small %zu\n", ofs));
  928|     25|		return NULL;
  929|     25|	}
  930|       |
  931|  8.20k|	ofs -= 2 * sizeof(uint32_t);
  932|  8.20k|	if (ofs > CAST(size_t, e - p)) {
  ------------------
  |  |  452|  8.20k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (932:6): [True: 166, False: 8.04k]
  ------------------
  933|    166|		DPRINTF(("Offset too big %zu %td\n", ofs, e - p));
  934|    166|		return NULL;
  935|    166|	}
  936|       |
  937|  8.04k|	return CAST(const uint8_t *, cdf_offset(CAST(const void *, p), ofs));
  ------------------
  |  |  452|  8.04k|#define CAST(T, b)	((T)(b))
  ------------------
  938|  8.20k|}
cdf.c:cdf_getuint32:
  198|   272k|{
  199|   272k|	uint32_t rv;
  200|   272k|	(void)memcpy(&rv, p + offs * sizeof(uint32_t), sizeof(rv));
  201|   272k|	return CDF_TOLE4(rv);
  ------------------
  |  |   83|   272k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|   544k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 272k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|   272k|}
cdf.c:cdf_copy_info:
  969|  4.21k|{
  970|  4.21k|	if (inp->pi_type & CDF_VECTOR)
  ------------------
  |  |  237|  4.21k|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (970:6): [True: 577, False: 3.63k]
  ------------------
  971|    577|		return 0;
  972|       |
  973|  3.63k|	if (CAST(size_t, CAST(const char *, e) - CAST(const char *, p)) < len)
  ------------------
  |  |  452|  3.63k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (973:6): [True: 1.27k, False: 2.35k]
  ------------------
  974|  1.27k|		return 0;
  975|       |
  976|  2.35k|	(void)memcpy(&inp->pi_val, p, len);
  977|       |
  978|  2.35k|	switch (len) {
  979|    360|	case 2:
  ------------------
  |  Branch (979:2): [True: 360, False: 1.99k]
  ------------------
  980|    360|		inp->pi_u16 = CDF_TOLE2(inp->pi_u16);
  ------------------
  |  |  186|    360|#define pi_u16	pi_val._pi_u16
  ------------------
              		inp->pi_u16 = CDF_TOLE2(inp->pi_u16);
  ------------------
  |  |   85|    360|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  452|    720|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 360]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  981|    360|		break;
  982|    742|	case 4:
  ------------------
  |  Branch (982:2): [True: 742, False: 1.61k]
  ------------------
  983|    742|		inp->pi_u32 = CDF_TOLE4(inp->pi_u32);
  ------------------
  |  |  184|    742|#define pi_u32	pi_val._pi_u32
  ------------------
              		inp->pi_u32 = CDF_TOLE4(inp->pi_u32);
  ------------------
  |  |   83|    742|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  452|  1.48k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 742]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  984|    742|		break;
  985|  1.25k|	case 8:
  ------------------
  |  Branch (985:2): [True: 1.25k, False: 1.10k]
  ------------------
  986|  1.25k|		inp->pi_u64 = CDF_TOLE8(inp->pi_u64);
  ------------------
  |  |  182|  1.25k|#define pi_u64	pi_val._pi_u64
  ------------------
              		inp->pi_u64 = CDF_TOLE8(inp->pi_u64);
  ------------------
  |  |   81|  1.25k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  452|  2.51k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 1.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  987|  1.25k|		break;
  988|      0|	default:
  ------------------
  |  Branch (988:2): [True: 0, False: 2.35k]
  ------------------
  989|      0|		abort();
  990|  2.35k|	}
  991|  2.35k|	return 1;
  992|  2.35k|}
cdf.c:cdf_check_stream:
  343|  11.3k|{
  344|  11.3k|	size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
  ------------------
  |  Branch (344:14): [True: 1.16k, False: 10.1k]
  ------------------
  345|  11.3k|	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   82|  1.16k|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|  1.16k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  10.1k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  346|  11.3k|	assert(ss == sst->sst_ss);
  ------------------
  |  Branch (346:2): [True: 0, False: 11.3k]
  |  Branch (346:2): [True: 11.3k, False: 0]
  ------------------
  347|  11.3k|	return sst->sst_ss;
  348|  11.3k|}

cdf_timestamp_to_timespec:
  100|  1.21k|{
  101|  1.21k|	struct tm tm;
  102|  1.21k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  103|  1.21k|	file_private char UTC[] = "UTC";
  ------------------
  |  |  108|  1.21k|#define file_private static
  ------------------
  104|  1.21k|#endif
  105|  1.21k|	int rdays;
  106|       |
  107|       |	/* Unit is 100's of nanoseconds */
  108|  1.21k|	ts->tv_nsec = (t % CDF_TIME_PREC) * 100;
  ------------------
  |  |   90|  1.21k|#define CDF_TIME_PREC	10000000
  ------------------
  109|       |
  110|  1.21k|	t /= CDF_TIME_PREC;
  ------------------
  |  |   90|  1.21k|#define CDF_TIME_PREC	10000000
  ------------------
  111|  1.21k|	tm.tm_sec = CAST(int, t % 60);
  ------------------
  |  |  452|  1.21k|#define CAST(T, b)	((T)(b))
  ------------------
  112|  1.21k|	t /= 60;
  113|       |
  114|  1.21k|	tm.tm_min = CAST(int, t % 60);
  ------------------
  |  |  452|  1.21k|#define CAST(T, b)	((T)(b))
  ------------------
  115|  1.21k|	t /= 60;
  116|       |
  117|  1.21k|	tm.tm_hour = CAST(int, t % 24);
  ------------------
  |  |  452|  1.21k|#define CAST(T, b)	((T)(b))
  ------------------
  118|  1.21k|	t /= 24;
  119|       |
  120|       |	/* XXX: Approx */
  121|  1.21k|	tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
  ------------------
  |  |  452|  1.21k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  1.21k|	if (tm.tm_year > 9999)
  ------------------
  |  Branch (123:6): [True: 180, False: 1.03k]
  ------------------
  124|    180|		goto out;
  125|       |
  126|  1.03k|	rdays = cdf_getdays(tm.tm_year);
  127|  1.03k|	t -= rdays - 1;
  128|  1.03k|	tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
  ------------------
  |  |  452|  1.03k|#define CAST(T, b)	((T)(b))
  ------------------
  129|  1.03k|	tm.tm_mon = cdf_getmonth(tm.tm_year, CAST(int, t));
  ------------------
  |  |  452|  1.03k|#define CAST(T, b)	((T)(b))
  ------------------
  130|  1.03k|	tm.tm_wday = 0;
  131|  1.03k|	tm.tm_yday = 0;
  132|  1.03k|	tm.tm_isdst = 0;
  133|  1.03k|#ifdef HAVE_STRUCT_TM_TM_GMTOFF
  134|  1.03k|	tm.tm_gmtoff = 0;
  135|  1.03k|#endif
  136|  1.03k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  137|  1.03k|	tm.tm_zone = UTC;
  138|  1.03k|#endif
  139|  1.03k|	tm.tm_year -= 1900;
  140|  1.03k|	ts->tv_sec = mktime(&tm);
  141|  1.03k|	if (ts->tv_sec == -1)
  ------------------
  |  Branch (141:6): [True: 0, False: 1.03k]
  ------------------
  142|      0|		goto out;
  143|  1.03k|	return 0;
  144|    180|out:
  145|    180|	errno = EINVAL;
  146|    180|	return -1;
  147|  1.03k|}
cdf_ctime:
  174|    257|{
  175|    257|	char *ptr = *sec > MAX_CTIME ? NULL : ctime_r(sec, buf);
  ------------------
  |  |  173|    257|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  452|    514|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 257, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (175:14): [True: 0, False: 257]
  ------------------
  176|    257|	if (ptr != NULL)
  ------------------
  |  Branch (176:6): [True: 257, False: 0]
  ------------------
  177|    257|		return buf;
  178|       |#ifdef WIN32
  179|       |	(void)snprintf(buf, 26, "*Bad* 0x%16.16I64x\n",
  180|       |	    CAST(long long, *sec));
  181|       |#else
  182|      0|	(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
  183|      0|	    CAST(long long, *sec));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  184|      0|#endif
  185|      0|	return buf;
  186|    257|}
cdf_time.c:cdf_getdays:
   53|  1.03k|{
   54|  1.03k|	int days = 0;
   55|  1.03k|	int y;
   56|       |
   57|   832k|	for (y = CDF_BASE_YEAR; y < year; y++)
  ------------------
  |  |   89|  1.03k|#define CDF_BASE_YEAR	1601
  ------------------
  |  Branch (57:26): [True: 831k, False: 1.03k]
  ------------------
   58|   831k|		days += isleap(y) + 365;
  ------------------
  |  |   41|   831k|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 207k, False: 623k]
  |  |  ------------------
  |  |   42|   831k|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 199k, False: 8.00k]
  |  |  |  Branch (42:28): [True: 1.87k, False: 6.12k]
  |  |  ------------------
  ------------------
   59|       |
   60|  1.03k|	return days;
   61|  1.03k|}
cdf_time.c:cdf_getday:
   68|  1.03k|{
   69|  1.03k|	size_t m;
   70|       |
   71|  3.67k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  130|  3.67k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (71:14): [True: 3.63k, False: 41]
  ------------------
   72|  3.63k|		int sub = mdays[m] + (m == 1 && isleap(year));
  ------------------
  |  |   41|    472|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 195, False: 277]
  |  |  ------------------
  |  |   42|    472|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 101, False: 94]
  |  |  |  Branch (42:28): [True: 8, False: 86]
  |  |  ------------------
  ------------------
  |  Branch (72:25): [True: 472, False: 3.16k]
  ------------------
   73|  3.63k|		if (days < sub)
  ------------------
  |  Branch (73:7): [True: 992, False: 2.64k]
  ------------------
   74|    992|			return days;
   75|  2.64k|		days -= sub;
   76|  2.64k|	}
   77|     41|	return days;
   78|  1.03k|}
cdf_time.c:cdf_getmonth:
   85|  1.03k|{
   86|  1.03k|	size_t m;
   87|       |
   88|  3.63k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  130|  3.63k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (88:14): [True: 3.63k, False: 0]
  ------------------
   89|  3.63k|		days -= mdays[m];
   90|  3.63k|		if (m == 1 && isleap(year))
  ------------------
  |  |   41|    472|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 195, False: 277]
  |  |  ------------------
  |  |   42|    472|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 101, False: 94]
  |  |  |  Branch (42:28): [True: 8, False: 86]
  |  |  ------------------
  ------------------
  |  Branch (90:7): [True: 472, False: 3.16k]
  ------------------
   91|    109|			days--;
   92|  3.63k|		if (days <= 0)
  ------------------
  |  Branch (92:7): [True: 1.03k, False: 2.60k]
  ------------------
   93|  1.03k|			return CAST(int, m);
  ------------------
  |  |  452|  1.03k|#define CAST(T, b)	((T)(b))
  ------------------
   94|  3.63k|	}
   95|      0|	return CAST(int, m);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
   96|  1.03k|}

file_zmagic:
  294|  15.1k|{
  295|  15.1k|	unsigned char *newbuf = NULL;
  296|  15.1k|	size_t i, nsz;
  297|  15.1k|	char *rbuf;
  298|  15.1k|	file_pushbuf_t *pb;
  299|  15.1k|	int urv, prv, rv = 0;
  300|  15.1k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  15.1k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  15.1k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  15.1k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  301|  15.1k|	int fd = b->fd;
  302|  15.1k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  15.1k|#define CAST(T, b)	((T)(b))
  ------------------
  303|  15.1k|	size_t nbytes = b->flen;
  304|  15.1k|	int sa_saved = 0;
  305|  15.1k|	struct sigaction sig_act;
  306|       |
  307|  15.1k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  15.1k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (307:6): [True: 4.79k, False: 10.3k]
  ------------------
  308|  4.79k|		return 0;
  309|       |
  310|   165k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (310:14): [True: 155k, False: 10.3k]
  ------------------
  311|   155k|		int zm;
  312|   155k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  452|   155k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (312:7): [True: 6.70k, False: 148k]
  ------------------
  313|  6.70k|			continue;
  314|   148k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (314:7): [True: 18.0k, False: 130k]
  ------------------
  315|  18.0k|			zm = (*compr[i].u.func)(buf);
  316|   130k|		} else {
  317|   130k|			zm = memcmp(buf, compr[i].u.magic,
  318|   130k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  452|   130k|#define CAST(T, b)	((T)(b))
  ------------------
  319|   130k|		}
  320|       |
  321|   148k|		if (!zm)
  ------------------
  |  Branch (321:7): [True: 145k, False: 2.53k]
  ------------------
  322|   145k|			continue;
  323|       |
  324|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  325|  2.53k|		if (!sa_saved) {
  ------------------
  |  Branch (325:7): [True: 2.21k, False: 319]
  ------------------
  326|       |			//We can use sig_act for both new and old, but
  327|  2.21k|			struct sigaction new_act;
  328|  2.21k|			memset(&new_act, 0, sizeof(new_act));
  329|  2.21k|			new_act.sa_handler = SIG_IGN;
  330|  2.21k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  331|  2.21k|		}
  332|       |
  333|  2.53k|		nsz = nbytes;
  334|  2.53k|		free(newbuf);
  335|  2.53k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  336|  2.53k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  2.53k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  337|  2.53k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  338|  2.53k|		    (char *)newbuf, nsz);
  339|  2.53k|		switch (urv) {
  340|  2.34k|		case OKDATA:
  ------------------
  |  |  230|  2.34k|#define OKDATA 	0
  ------------------
  |  Branch (340:3): [True: 2.34k, False: 194]
  ------------------
  341|  2.53k|		case ERRDATA:
  ------------------
  |  |  232|  2.53k|#define ERRDATA	2
  ------------------
  |  Branch (341:3): [True: 194, False: 2.34k]
  ------------------
  342|  2.53k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  2.53k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  343|  2.53k|			if (urv == ERRDATA)
  ------------------
  |  |  232|  2.53k|#define ERRDATA	2
  ------------------
  |  Branch (343:8): [True: 194, False: 2.34k]
  ------------------
  344|    194|				prv = format_decompression_error(ms, i, newbuf);
  345|  2.34k|			else
  346|  2.34k|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  347|  2.34k|				    nsz);
  348|  2.53k|			if (prv == -1)
  ------------------
  |  Branch (348:8): [True: 0, False: 2.53k]
  ------------------
  349|      0|				goto error;
  350|  2.53k|			rv = 1;
  351|  2.53k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  2.53k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (351:8): [True: 0, False: 2.53k]
  ------------------
  352|      0|				goto out;
  353|  2.53k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  5.07k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.53k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.53k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (353:8): [True: 2.53k, False: 0]
  |  Branch (353:30): [True: 0, False: 2.53k]
  ------------------
  354|      0|				goto out;
  355|  2.53k|			if ((file_printf(ms,
  ------------------
  |  Branch (355:8): [True: 0, False: 2.53k]
  ------------------
  356|  2.53k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (356:8): [True: 0, False: 2.53k]
  ------------------
  357|      0|				goto error;
  358|  2.53k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (358:8): [True: 61, False: 2.47k]
  ------------------
  359|     61|				goto error;
  360|       |			/*
  361|       |			 * XXX: If file_buffer fails here, we overwrite
  362|       |			 * the compressed text. FIXME.
  363|       |			 */
  364|  2.47k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (364:8): [True: 0, False: 2.47k]
  ------------------
  365|      0|			{
  366|      0|				if (file_pop_buffer(ms, pb) != NULL)
  ------------------
  |  Branch (366:9): [True: 0, False: 0]
  ------------------
  367|      0|					abort();
  368|      0|				goto error;
  369|      0|			}
  370|  2.47k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (370:8): [True: 2.47k, False: 0]
  ------------------
  371|  2.47k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (371:9): [True: 4, False: 2.47k]
  ------------------
  372|      4|					free(rbuf);
  373|      4|					goto error;
  374|      4|				}
  375|  2.47k|				free(rbuf);
  376|  2.47k|			}
  377|  2.47k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (377:8): [True: 2.47k, False: 0]
  |  Branch (377:17): [True: 0, False: 2.47k]
  ------------------
  378|      0|				goto error;
  379|       |			/*FALLTHROUGH*/
  380|  2.47k|		case NODATA:
  ------------------
  |  |  231|  2.47k|#define NODATA	1
  ------------------
  |  Branch (380:3): [True: 0, False: 2.53k]
  ------------------
  381|  2.47k|			break;
  382|      0|		default:
  ------------------
  |  Branch (382:3): [True: 0, False: 2.53k]
  ------------------
  383|      0|			abort();
  384|       |			/*NOTREACHED*/
  385|     65|		error:
  386|     65|			rv = -1;
  387|     65|			break;
  388|  2.53k|		}
  389|  2.53k|	}
  390|  10.3k|out:
  391|  10.3k|	DPRINTF("rv = %d\n", rv);
  392|       |
  393|  10.3k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (393:6): [True: 2.21k, False: 8.11k]
  |  Branch (393:18): [True: 2.21k, False: 0]
  ------------------
  394|  2.21k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  395|       |
  396|  10.3k|	free(newbuf);
  397|  10.3k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  10.3k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  398|  10.3k|	DPRINTF("Zmagic returns %d\n", rv);
  399|  10.3k|	return rv;
  400|  10.3k|}
sread:
  432|  4.80k|{
  433|  4.80k|	ssize_t rv;
  434|  4.80k|#if defined(FIONREAD) && !defined(__MINGW32__)
  435|  4.80k|	int t = 0;
  436|  4.80k|#endif
  437|  4.80k|	size_t rn = n;
  438|       |
  439|  4.80k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (439:6): [True: 0, False: 4.80k]
  ------------------
  440|      0|		goto nocheck;
  441|       |
  442|  4.80k|#if defined(FIONREAD) && !defined(__MINGW32__)
  443|  4.80k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (443:6): [True: 0, False: 4.80k]
  |  Branch (443:20): [True: 0, False: 0]
  |  Branch (443:53): [True: 0, False: 0]
  ------------------
  444|      0|#ifdef FD_ZERO
  445|      0|		ssize_t cnt;
  446|      0|		for (cnt = 0;; cnt++) {
  447|      0|			fd_set check;
  448|      0|			struct timeval tout = {0, 100 * 1000};
  449|      0|			int selrv;
  450|       |
  451|      0|			FD_ZERO(&check);
  ------------------
  |  Branch (451:4): [Folded, False: 0]
  ------------------
  452|      0|			FD_SET(fd, &check);
  453|       |
  454|       |			/*
  455|       |			 * Avoid soft deadlock: do not read if there
  456|       |			 * is nothing to read from sockets and pipes.
  457|       |			 */
  458|      0|			selrv = select(fd + 1, &check, NULL, NULL, &tout);
  459|      0|			if (selrv == -1) {
  ------------------
  |  Branch (459:8): [True: 0, False: 0]
  ------------------
  460|      0|				if (errno == EINTR || errno == EAGAIN)
  ------------------
  |  Branch (460:9): [True: 0, False: 0]
  |  Branch (460:27): [True: 0, False: 0]
  ------------------
  461|      0|					continue;
  462|      0|			} else if (selrv == 0 && cnt >= 5) {
  ------------------
  |  Branch (462:15): [True: 0, False: 0]
  |  Branch (462:29): [True: 0, False: 0]
  ------------------
  463|      0|				return 0;
  464|      0|			} else
  465|      0|				break;
  466|      0|		}
  467|      0|#endif
  468|      0|		(void)ioctl(fd, FIONREAD, &t);
  469|      0|	}
  470|       |
  471|  4.80k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (471:6): [True: 0, False: 4.80k]
  |  Branch (471:15): [True: 0, False: 0]
  ------------------
  472|      0|		n = t;
  473|      0|		rn = n;
  474|      0|	}
  475|  4.80k|#endif
  476|       |
  477|  4.80k|nocheck:
  478|  4.80k|	do
  479|   139k|		switch ((rv = read(fd, buf, n))) {
  480|      0|		case -1:
  ------------------
  |  Branch (480:3): [True: 0, False: 139k]
  ------------------
  481|      0|			if (errno == EINTR)
  ------------------
  |  Branch (481:8): [True: 0, False: 0]
  ------------------
  482|      0|				continue;
  483|      0|			return -1;
  484|  4.71k|		case 0:
  ------------------
  |  Branch (484:3): [True: 4.71k, False: 135k]
  ------------------
  485|  4.71k|			return rn - n;
  486|   135k|		default:
  ------------------
  |  Branch (486:3): [True: 135k, False: 4.71k]
  ------------------
  487|   135k|			n -= rv;
  488|   135k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  452|   135k|#define CAST(T, b)	((T)(b))
  ------------------
  489|   135k|			break;
  490|   139k|		}
  491|   135k|	while (n > 0);
  ------------------
  |  Branch (491:9): [True: 135k, False: 94]
  ------------------
  492|     94|	return rn;
  493|  4.80k|}
compress.c:lzmacmp:
  150|  7.72k|{
  151|  7.72k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (151:6): [True: 7.70k, False: 19]
  |  Branch (151:24): [True: 4, False: 15]
  |  Branch (151:34): [True: 8, False: 7]
  ------------------
  152|  7.71k|		return 0;
  153|      7|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (153:6): [True: 5, False: 2]
  |  Branch (153:17): [True: 3, False: 2]
  ------------------
  154|      3|		return 0;
  155|      4|	return 1;
  156|      7|}
compress.c:zlibcmp:
  133|  10.3k|{
  134|  10.3k|	unsigned short x;
  135|       |
  136|  10.3k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (136:6): [True: 10.2k, False: 117]
  |  Branch (136:29): [True: 22, False: 95]
  ------------------
  137|  10.2k|		return 0;
  138|     95|	if (file_bigendian())	/* endianness test */
  ------------------
  |  Branch (138:6): [True: 0, False: 95]
  ------------------
  139|      0|		x = buf[0] | (buf[1] << 8);
  140|     95|	else
  141|     95|		x = buf[1] | (buf[0] << 8);
  142|     95|	if (x % 31)
  ------------------
  |  Branch (142:6): [True: 71, False: 24]
  ------------------
  143|     71|		return 0;
  144|     24|	return 1;
  145|     95|}
compress.c:format_decompression_error:
  277|    194|{
  278|    194|	unsigned char *p;
  279|    194|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    194|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    194|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    194|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  280|       |
  281|    194|	if (!mime)
  ------------------
  |  Branch (281:6): [True: 194, False: 0]
  ------------------
  282|    194|		return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
  283|       |
  284|      0|	for (p = buf; *p; p++)
  ------------------
  |  Branch (284:16): [True: 0, False: 0]
  ------------------
  285|      0|		if (!isalnum(*p))
  ------------------
  |  Branch (285:7): [True: 0, False: 0]
  ------------------
  286|      0|			*p = '-';
  287|       |
  288|      0|	return file_printf(ms, "application/x-decompression-error-%s-%s",
  289|      0|	    methodname(i), buf);
  290|    194|}
compress.c:methodname:
 1097|    194|{
 1098|    194|	switch (method) {
 1099|      0|#ifdef BUILTIN_DECOMPRESS
 1100|     30|	case METH_FROZEN:
  ------------------
  |  |  198|     30|#define METH_FROZEN	2
  ------------------
  |  Branch (1100:2): [True: 30, False: 164]
  ------------------
 1101|     54|	case METH_ZLIB:
  ------------------
  |  |  206|     54|#define METH_ZLIB	14
  ------------------
  |  Branch (1101:2): [True: 24, False: 170]
  ------------------
 1102|     54|		return "zlib";
 1103|      0|#endif
 1104|      0|#ifdef BUILTIN_BZLIB
 1105|      6|	case METH_BZIP:
  ------------------
  |  |  199|      6|#define METH_BZIP	7
  ------------------
  |  Branch (1105:2): [True: 6, False: 188]
  ------------------
 1106|      6|		return "bzlib";
 1107|      0|#endif
 1108|      0|#ifdef BUILTIN_XZLIB
 1109|      1|	case METH_XZ:
  ------------------
  |  |  200|      1|#define METH_XZ		9
  ------------------
  |  Branch (1109:2): [True: 1, False: 193]
  ------------------
 1110|      5|	case METH_LZMA:
  ------------------
  |  |  205|      5|#define METH_LZMA	13
  ------------------
  |  Branch (1110:2): [True: 4, False: 190]
  ------------------
 1111|      5|		return "xzlib";
 1112|      0|#endif
 1113|      0|#ifdef BUILTIN_ZSTDLIB
 1114|      5|	case METH_ZSTD:
  ------------------
  |  |  204|      5|#define METH_ZSTD	12
  ------------------
  |  Branch (1114:2): [True: 5, False: 189]
  ------------------
 1115|      5|		return "zstd";
 1116|      0|#endif
 1117|       |#ifdef BUILTIN_LZLIB
 1118|       |	case METH_LZIP:
 1119|       |		return "lzlib";
 1120|       |#endif
 1121|       |#ifdef BUILTIN_LRZIP
 1122|       |	case METH_LRZIP:
 1123|       |		return "lrzip";
 1124|       |#endif
 1125|    124|	default:
  ------------------
  |  Branch (1125:2): [True: 124, False: 70]
  ------------------
 1126|    124|		return compr[method].argv[0];
 1127|    194|	}
 1128|    194|}
compress.c:uncompressbuf:
 1174|  2.53k|{
 1175|  2.53k|	int fdp[3][2];
 1176|  2.53k|	int status, rv, w;
 1177|  2.53k|	pid_t pid;
 1178|  2.53k|	pid_t writepid = -1;
 1179|  2.53k|	size_t i;
 1180|  2.53k|	ssize_t r, re;
 1181|  2.53k|	char *const *args;
 1182|  2.53k|#ifdef HAVE_POSIX_SPAWNP
 1183|  2.53k|	posix_spawn_file_actions_t fa;
 1184|  2.53k|#endif
 1185|  2.53k|	int (*decompress)(const unsigned char *, unsigned char **,
 1186|  2.53k|	    size_t, size_t *, int) = getdecompressor(method);
 1187|       |
 1188|  2.53k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  452|  2.53k|#define CAST(T, b)	((T)(b))
  ------------------
 1189|  2.53k|	if (*newch == NULL)
  ------------------
  |  Branch (1189:6): [True: 0, False: 2.53k]
  ------------------
 1190|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1191|       |
 1192|  2.53k|	if (decompress) {
  ------------------
  |  Branch (1192:6): [True: 71, False: 2.46k]
  ------------------
 1193|     71|		if (nofork) {
  ------------------
  |  Branch (1193:7): [True: 71, False: 0]
  ------------------
 1194|     71|			return makeerror(newch, n,
 1195|     71|			    "Fork is required to uncompress, but disabled");
 1196|     71|		}
 1197|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1198|     71|	}
 1199|       |
 1200|  2.46k|	(void)fflush(stdout);
 1201|  2.46k|	(void)fflush(stderr);
 1202|       |
 1203|  9.86k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  9.86k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1203:14): [True: 7.39k, False: 2.46k]
  ------------------
 1204|  7.39k|		fdp[i][0] = fdp[i][1] = -1;
 1205|       |
 1206|       |	/*
 1207|       |	 * There are multithreaded users who run magic_file()
 1208|       |	 * from dozens of threads. If two parallel magic_file() calls
 1209|       |	 * analyze two large compressed files, both will spawn
 1210|       |	 * an uncompressing child here, which writes out uncompressed data.
 1211|       |	 * We read some portion, then close the pipe, then waitpid() the child.
 1212|       |	 * If uncompressed data is larger, child should get EPIPE and exit.
 1213|       |	 * However, with *parallel* calls OTHER child may unintentionally
 1214|       |	 * inherit pipe fds, thus keeping pipe open and making writes in
 1215|       |	 * our child block instead of failing with EPIPE!
 1216|       |	 * (For the bug to occur, two threads must mutually inherit their pipes,
 1217|       |	 * and both must have large outputs. Thus it happens not that often).
 1218|       |	 * To avoid this, be sure to create pipes with O_CLOEXEC.
 1219|       |	 */
 1220|  2.46k|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1220:7): [True: 0, False: 2.46k]
  |  Branch (1220:19): [True: 0, False: 0]
  ------------------
 1221|  2.46k|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1221:6): [True: 0, False: 2.46k]
  ------------------
 1222|  2.46k|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1222:6): [True: 0, False: 2.46k]
  ------------------
 1223|      0|		closep(fdp[STDIN_FILENO]);
 1224|      0|		closep(fdp[STDOUT_FILENO]);
 1225|      0|		return makeerror(newch, n, "Cannot create pipe, %s",
 1226|      0|		    strerror(errno));
 1227|      0|	}
 1228|       |
 1229|  2.46k|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  453|  2.46k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1230|  2.46k|#ifdef HAVE_POSIX_SPAWNP
 1231|  2.46k|	posix_spawn_file_actions_init(&fa);
 1232|       |
 1233|  2.46k|	handledesc(&fa, fd, fdp);
 1234|       |
 1235|  2.46k|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1236|  2.46k|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1237|  2.46k|	    args, NULL);
 1238|       |
 1239|  2.46k|	posix_spawn_file_actions_destroy(&fa);
 1240|       |
 1241|  2.46k|	if (status != 0) {
  ------------------
  |  Branch (1241:6): [True: 15, False: 2.45k]
  ------------------
 1242|     15|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1243|     15|		    compr[method].argv[0], strerror(status));
 1244|     15|	}
 1245|       |#else
 1246|       |	/* For processes with large mapped virtual sizes, vfork
 1247|       |	 * may be _much_ faster (10-100 times) than fork.
 1248|       |	 */
 1249|       |	pid = vfork();
 1250|       |	if (pid == -1) {
 1251|       |		return makeerror(newch, n, "Cannot vfork, %s",
 1252|       |		    strerror(errno));
 1253|       |	}
 1254|       |	if (pid == 0) {
 1255|       |		/* child */
 1256|       |		/* Note: we are after vfork, do not modify memory
 1257|       |		 * in a way which confuses parent. In particular,
 1258|       |		 * do not modify fdp[i][j].
 1259|       |		 */
 1260|       |		handledesc(NULL, fd, fdp);
 1261|       |		DPRINTF("Executing %s\n", compr[method].argv[0]);
 1262|       |
 1263|       |		(void)execvp(compr[method].argv[0], args);
 1264|       |		dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 1265|       |		    compr[method].argv[0], strerror(errno));
 1266|       |		_exit(EXIT_FAILURE); /* _exit(), not exit(), because of vfork */
 1267|       |	}
 1268|       |#endif
 1269|       |	/* parent */
 1270|       |	/* Close write sides of child stdout/err pipes */
 1271|  7.35k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  7.35k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1271:14): [True: 4.90k, False: 2.45k]
  ------------------
 1272|  4.90k|		closefd(fdp[i], 1);
 1273|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1274|  2.45k|	if (fd == -1) {
  ------------------
  |  Branch (1274:6): [True: 0, False: 2.45k]
  ------------------
 1275|      0|		closefd(fdp[STDIN_FILENO], 0);
 1276|      0|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1277|      0|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1277:7): [True: 0, False: 0]
  ------------------
 1278|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1279|      0|			    strerror(errno));
 1280|      0|			DPRINTF("Write to child failed\n");
 1281|      0|			goto err;
 1282|      0|		}
 1283|      0|		closefd(fdp[STDIN_FILENO], 1);
 1284|      0|	}
 1285|       |
 1286|  2.45k|	rv = OKDATA;
  ------------------
  |  |  230|  2.45k|#define OKDATA 	0
  ------------------
 1287|  2.45k|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1288|  2.45k|	DPRINTF("read got %zd\n", r);
 1289|  2.45k|	if (r < 0) {
  ------------------
  |  Branch (1289:6): [True: 0, False: 2.45k]
  ------------------
 1290|      0|		rv = ERRDATA;
  ------------------
  |  |  232|      0|#define ERRDATA	2
  ------------------
 1291|      0|		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
 1292|      0|		        strerror(errno));
 1293|      0|		goto err;
 1294|      0|	} 
 1295|  2.45k|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  452|  2.45k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1295:6): [True: 94, False: 2.35k]
  ------------------
 1296|       |		/*
 1297|       |		 * close fd so that the child exits with sigpipe and ignore
 1298|       |		 * errors, otherwise we risk the child blocking and never
 1299|       |		 * exiting.
 1300|       |		 */
 1301|     94|		DPRINTF("Closing stdout for bytes_max\n");
 1302|     94|		closefd(fdp[STDOUT_FILENO], 0);
 1303|     94|		goto ok;
 1304|     94|	}
 1305|  2.35k|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1305:6): [True: 108, False: 2.24k]
  ------------------
 1306|    108|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1307|    108|		rv = ERRDATA;
  ------------------
  |  |  232|    108|#define ERRDATA	2
  ------------------
 1308|    108|		r = filter_error(*newch, r);
 1309|    108|		goto ok;
 1310|    108|	}
 1311|  2.24k|	if  (re == 0)
  ------------------
  |  Branch (1311:7): [True: 2.24k, False: 0]
  ------------------
 1312|  2.24k|		goto ok;
 1313|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1314|      0|	    strerror(errno));
 1315|      0|	goto err;
 1316|  2.45k|ok:
 1317|  2.45k|	*n = r;
 1318|       |	/* NUL terminate, as every buffer is handled here. */
 1319|  2.45k|	(*newch)[*n] = '\0';
 1320|  2.45k|err:
 1321|  2.45k|	closefd(fdp[STDIN_FILENO], 1);
 1322|  2.45k|	closefd(fdp[STDOUT_FILENO], 0);
 1323|  2.45k|	closefd(fdp[STDERR_FILENO], 0);
 1324|       |
 1325|  2.45k|	w = waitpid(pid, &status, 0);
 1326|  2.45k|wait_err:
 1327|  2.45k|	if (w == -1) {
  ------------------
  |  Branch (1327:6): [True: 0, False: 2.45k]
  ------------------
 1328|      0|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1329|      0|		DPRINTF("Child wait return %#x\n", status);
 1330|  2.45k|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1330:13): [True: 0, False: 2.45k]
  ------------------
 1331|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1332|  2.45k|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1332:13): [True: 202, False: 2.24k]
  ------------------
 1333|    202|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1334|    202|	}
 1335|  2.45k|	if (writepid > 0) {
  ------------------
  |  Branch (1335:6): [True: 0, False: 2.45k]
  ------------------
 1336|       |		/* _After_ we know decompressor has exited, our input writer
 1337|       |		 * definitely will exit now (at worst, writing fails in it,
 1338|       |		 * since output fd is closed now on the reading size).
 1339|       |		 */
 1340|      0|		w = waitpid(writepid, &status, 0);
 1341|      0|		writepid = -1;
 1342|      0|		goto wait_err;
 1343|      0|	}
 1344|       |
 1345|  2.45k|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1346|  2.45k|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1347|       |
 1348|  2.45k|	return rv;
 1349|  2.45k|}
compress.c:getdecompressor:
 1133|  2.53k|{
 1134|  2.53k|	switch (method) {
 1135|      0|#ifdef BUILTIN_DECOMPRESS
 1136|     30|	case METH_FROZEN:
  ------------------
  |  |  198|     30|#define METH_FROZEN	2
  ------------------
  |  Branch (1136:2): [True: 30, False: 2.50k]
  ------------------
 1137|     30|		return uncompressgzipped;
 1138|     24|	case METH_ZLIB:
  ------------------
  |  |  206|     24|#define METH_ZLIB	14
  ------------------
  |  Branch (1138:2): [True: 24, False: 2.51k]
  ------------------
 1139|     24|		return uncompresszlib;
 1140|      0|#endif
 1141|      0|#ifdef BUILTIN_BZLIB
 1142|      6|	case METH_BZIP:
  ------------------
  |  |  199|      6|#define METH_BZIP	7
  ------------------
  |  Branch (1142:2): [True: 6, False: 2.53k]
  ------------------
 1143|      6|		return uncompressbzlib;
 1144|      0|#endif
 1145|      0|#ifdef BUILTIN_XZLIB
 1146|      1|	case METH_XZ:
  ------------------
  |  |  200|      1|#define METH_XZ		9
  ------------------
  |  Branch (1146:2): [True: 1, False: 2.53k]
  ------------------
 1147|      5|	case METH_LZMA:
  ------------------
  |  |  205|      5|#define METH_LZMA	13
  ------------------
  |  Branch (1147:2): [True: 4, False: 2.53k]
  ------------------
 1148|      5|		return uncompressxzlib;
 1149|      0|#endif
 1150|      0|#ifdef BUILTIN_ZSTDLIB
 1151|      5|	case METH_ZSTD:
  ------------------
  |  |  204|      5|#define METH_ZSTD	12
  ------------------
  |  Branch (1151:2): [True: 5, False: 2.53k]
  ------------------
 1152|      5|		return uncompresszstd;
 1153|      0|#endif
 1154|       |#ifdef BUILTIN_LZLIB
 1155|       |	case METH_LZIP:
 1156|       |		return uncompresslzlib;
 1157|       |#endif
 1158|       |#ifdef BUILTIN_LRZIP
 1159|       |	case METH_LRZIP:
 1160|       |		return uncompresslrzip;
 1161|       |#endif
 1162|      0|#ifdef BUILTIN_LZ4LIB
 1163|      1|	case METH_LZ4:
  ------------------
  |  |  203|      1|#define	METH_LZ4	11
  ------------------
  |  Branch (1163:2): [True: 1, False: 2.53k]
  ------------------
 1164|      1|		return uncompresslz4;
 1165|      0|#endif
 1166|  2.46k|	default:
  ------------------
  |  Branch (1166:2): [True: 2.46k, False: 71]
  ------------------
 1167|       |		return NULL;
 1168|  2.53k|	}
 1169|  2.53k|}
compress.c:makeerror:
  946|     86|{
  947|     86|	char *msg;
  948|     86|	va_list ap;
  949|     86|	int rv;
  950|       |
  951|     86|	DPRINTF("Makeerror %s\n", fmt);
  952|     86|	free(*buf);
  953|     86|	va_start(ap, fmt);
  954|     86|	rv = vasprintf(&msg, fmt, ap);
  955|     86|	va_end(ap);
  956|     86|	if (rv < 0) {
  ------------------
  |  Branch (956:6): [True: 0, False: 86]
  ------------------
  957|      0|		DPRINTF("Makeerror failed");
  958|      0|		*buf = NULL;
  959|      0|		*len = 0;
  960|      0|		return NODATA;
  ------------------
  |  |  231|      0|#define NODATA	1
  ------------------
  961|      0|	}
  962|     86|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  453|     86|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  963|     86|	*len = strlen(msg);
  964|     86|	return ERRDATA;
  ------------------
  |  |  232|     86|#define ERRDATA	2
  ------------------
  965|     86|}
compress.c:handledesc:
 1015|  2.46k|{
 1016|  2.46k|	if (fd != -1) {
  ------------------
  |  Branch (1016:6): [True: 2.46k, False: 0]
  ------------------
 1017|  2.46k|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  452|  2.46k|#define CAST(T, b)	((T)(b))
  ------------------
 1018|  2.46k|		movedesc(v, STDIN_FILENO, fd);
 1019|  2.46k|	} else {
 1020|      0|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
 1021|      0|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (1021:7): [True: 0, False: 0]
  ------------------
 1022|      0|		    closedesc(v, fdp[STDIN_FILENO][1]);
 1023|      0|	}
 1024|       |
 1025|  2.46k|	file_clear_closexec(STDIN_FILENO);
 1026|       |
 1027|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
 1028|  2.46k|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
 1029|  2.46k|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (1029:6): [True: 2.46k, False: 0]
  ------------------
 1030|  2.46k|		closedesc(v, fdp[STDOUT_FILENO][0]);
 1031|       |
 1032|  2.46k|	file_clear_closexec(STDOUT_FILENO);
 1033|       |
 1034|  2.46k|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
 1035|  2.46k|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (1035:6): [True: 2.46k, False: 0]
  ------------------
 1036|  2.46k|		closedesc(v, fdp[STDERR_FILENO][0]);
 1037|       |
 1038|       |	file_clear_closexec(STDERR_FILENO);
 1039|  2.46k|}
compress.c:movedesc:
  986|  7.39k|{
  987|  7.39k|	if (fd == i)
  ------------------
  |  Branch (987:6): [True: 0, False: 7.39k]
  ------------------
  988|      0|		return; /* "no dup was necessary" */
  989|  7.39k|#ifdef HAVE_POSIX_SPAWNP
  990|  7.39k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  453|  7.39k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  991|  7.39k|	posix_spawn_file_actions_adddup2(fa, fd, i);
  992|  7.39k|	posix_spawn_file_actions_addclose(fa, fd);
  993|       |#else
  994|       |	if (dup2(fd, i) == -1) {
  995|       |		DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
  996|       |		exit(EXIT_FAILURE);
  997|       |	}
  998|       |	close(v ? fd : fd);
  999|       |#endif
 1000|  7.39k|}
compress.c:closedesc:
 1004|  4.93k|{
 1005|  4.93k|#ifdef HAVE_POSIX_SPAWNP
 1006|  4.93k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  453|  4.93k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1007|  4.93k|	posix_spawn_file_actions_addclose(fa, fd);
 1008|       |#else
 1009|       |	close(v ? fd : fd);
 1010|       |#endif
 1011|  4.93k|}
compress.c:closefd:
  969|  14.7k|{
  970|  14.7k|	if (fd[i] == -1)
  ------------------
  |  Branch (970:6): [True: 4.99k, False: 9.80k]
  ------------------
  971|  4.99k|		return;
  972|  9.80k|	(void) close(fd[i]);
  973|  9.80k|	fd[i] = -1;
  974|  9.80k|}
compress.c:filter_error:
 1069|    108|{
 1070|    108|	char *p;
 1071|    108|	char *buf;
 1072|       |
 1073|    108|	ubuf[n] = '\0';
 1074|    108|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  453|    108|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1075|    108|	while (isspace(CAST(unsigned char, *buf)))
  ------------------
  |  Branch (1075:9): [True: 25, False: 108]
  ------------------
 1076|     25|		buf++;
 1077|    108|	DPRINTF("Filter error[[[%s]]]\n", buf);
 1078|    108|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  452|    108|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1078:6): [True: 6, False: 102]
  ------------------
 1079|      6|		*p = '\0';
 1080|    108|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  452|    108|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1080:6): [True: 0, False: 108]
  ------------------
 1081|      0|		*p = '\0';
 1082|    108|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  452|    108|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1082:6): [True: 9, False: 99]
  ------------------
 1083|      9|		++p;
 1084|      9|		while (isspace(CAST(unsigned char, *p)))
  ------------------
  |  Branch (1084:10): [True: 9, False: 9]
  ------------------
 1085|      9|			p++;
 1086|      9|		n = strlen(p);
 1087|      9|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  452|      9|#define CAST(T, b)	((T)(b))
  ------------------
 1088|      9|	}
 1089|    108|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
 1090|    108|	if (islower(*ubuf))
  ------------------
  |  Branch (1090:6): [True: 8, False: 100]
  ------------------
 1091|      8|		*ubuf = toupper(*ubuf);
  ------------------
  |  Branch (1091:11): [True: 0, False: 0]
  |  Branch (1091:11): [True: 0, False: 0]
  |  Branch (1091:11): [Folded, False: 8]
  ------------------
 1092|    108|	return n;
 1093|    108|}

der_offs:
  265|  28.8k|{
  266|  28.8k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  453|  28.8k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  28.8k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 28.8k, False: 0]
  ------------------
  268|       |
  269|  28.8k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  28.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  28.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 28.8k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  28.8k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  28.8k|	    offs, m->offset));
  275|       |
  276|  28.8k|	uint32_t tlen = getlength(b, &offs, len);
  277|  28.8k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  28.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  28.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 28.8k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  28.8k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  28.8k|	    offs, tlen));
  283|       |
  284|  28.8k|	offs += ms->offset + m->offset;
  285|  28.8k|	DPRINTF(("cont_level = %d\n", m->cont_level));
  286|       |#ifdef DEBUG_DER
  287|       |	size_t i;
  288|       |	for (i = 0; i < m->cont_level; i++)
  289|       |		printf("cont_level[%" SIZE_T_FORMAT "u] = %d\n", i,
  290|       |		    ms->c.li[i].off);
  291|       |#endif
  292|  28.8k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 3.00k, False: 25.8k]
  ------------------
  293|  3.00k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 3.00k]
  ------------------
  294|      0|			return -1;
  295|  3.00k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  452|  3.00k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  3.00k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  3.00k|		    ms->c.li[m->cont_level - 1].off));
  298|  3.00k|	}
  299|  28.8k|	return CAST(int32_t, offs);
  ------------------
  |  |  452|  28.8k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  28.8k|}
der_cmp:
  304|   371k|{
  305|   371k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  453|   371k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   371k|	const char *s = m->value.s;
  307|   371k|	size_t offs = 0, len = ms->search.s_len;
  308|   371k|	uint32_t tag, tlen;
  309|   371k|	char buf[128];
  310|       |
  311|   371k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   371k|	tag = gettag(b, &offs, len);
  314|   371k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   371k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|   371k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 10.8k, False: 360k]
  ------------------
  315|  10.8k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  10.8k|		return -1;
  317|  10.8k|	}
  318|       |
  319|   360k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   360k|	    offs, m->offset));
  321|       |
  322|   360k|	tlen = getlength(b, &offs, len);
  323|   360k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   360k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|   360k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 120k, False: 240k]
  ------------------
  324|   120k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   120k|		return -1;
  326|   120k|	}
  327|       |
  328|   240k|	der_tag(buf, sizeof(buf), tag);
  329|   240k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   240k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 240k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   240k|	size_t slen = strlen(buf);
  333|       |
  334|   240k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 208k, False: 31.8k]
  ------------------
  335|   208k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   208k|		return 0;
  337|   208k|	}
  338|       |
  339|  31.8k|	s += slen;
  340|       |
  341|  33.0k|again:
  342|  33.0k|	switch (*s) {
  343|  28.4k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 28.4k, False: 4.66k]
  ------------------
  344|  28.4k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  28.4k|		return 1;
  346|  1.27k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.27k, False: 31.7k]
  ------------------
  347|  1.27k|		s++;
  348|  1.27k|		goto val;
  349|  3.39k|	default:
  ------------------
  |  Branch (349:2): [True: 3.39k, False: 29.6k]
  ------------------
  350|  3.39k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 3.39k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  3.39k|		slen = 0;
  356|  3.39k|		do
  357|  5.37k|			slen = slen * 10 + *s - '0';
  358|  3.39k|		while (isdigit(CAST(unsigned char, *++s)));
  ------------------
  |  Branch (358:10): [True: 1.98k, False: 3.39k]
  ------------------
  359|  3.39k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  3.39k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 3.39k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  3.39k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 2.21k, False: 1.17k]
  ------------------
  363|  2.21k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  2.21k|			return 0;
  365|  2.21k|		}
  366|  1.17k|		goto again;
  367|  33.0k|	}
  368|  1.27k|val:
  369|  1.27k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.27k|	    tlen));
  371|  1.27k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.27k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.27k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.27k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.27k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 941, False: 336]
  |  Branch (374:29): [True: 791, False: 150]
  ------------------
  375|    791|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    791|		return 0;
  377|    791|	}
  378|    486|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    486|	DPRINTF(("%s: complete match\n", __func__));
  380|    486|	return 1;
  381|  1.27k|}
der.c:gettag:
  150|   400k|{
  151|   400k|	uint32_t tag;
  152|       |
  153|   400k|	if (c == NULL || *p >= l)
  ------------------
  |  Branch (153:6): [True: 0, False: 400k]
  |  Branch (153:19): [True: 2.00k, False: 398k]
  ------------------
  154|  2.00k|		return DER_BAD;
  ------------------
  |  |   62|  2.00k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  2.00k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   398k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   398k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 248k, False: 149k]
  ------------------
  159|   248k|		return tag;
  160|       |
  161|   149k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 547, False: 148k]
  ------------------
  162|    547|		return DER_BAD;
  ------------------
  |  |   62|    547|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|    547|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|   673M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 672M, False: 145k]
  ------------------
  165|   672M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|   672M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 2.87k, False: 672M]
  ------------------
  167|  2.87k|			return DER_BAD;
  ------------------
  |  |   62|  2.87k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  2.87k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|   672M|	}
  169|   145k|	return tag;
  170|   148k|}
der.c:getlength:
  183|   389k|{
  184|   389k|	uint8_t digits, i;
  185|   389k|	size_t len;
  186|   389k|	int is_onebyte_result;
  187|       |
  188|   389k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 3.27k, False: 386k]
  ------------------
  189|  3.27k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  3.27k|		return DER_BAD;
  ------------------
  |  |   62|  3.27k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  3.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  3.27k|	}
  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|   386k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   386k|	digits = c[(*p)++] & 0x7f;
  200|   386k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 98.6k, False: 287k]
  ------------------
  201|  98.6k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|  98.6k|		return DER_BAD;
  ------------------
  |  |   62|  98.6k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  98.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|  98.6k|	}
  204|       |
  205|   287k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 230k, False: 57.0k]
  ------------------
  206|   230k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  57.0k|	len = 0;
  213|  4.25M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 4.19M, False: 57.0k]
  ------------------
  214|  4.19M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  57.0k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 16.0k, False: 40.9k]
  |  Branch (216:31): [True: 2.06k, False: 38.8k]
  ------------------
  217|  18.1k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  18.1k|		    __func__, *p, len, l));
  219|  18.1k|		return DER_BAD;
  ------------------
  |  |   62|  18.1k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  18.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  18.1k|	}
  221|  38.8k|	return CAST(uint32_t, len);
  ------------------
  |  |  452|  38.8k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  57.0k|}
der.c:der_tag:
  226|   240k|{
  227|   240k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   240k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 165k, False: 74.9k]
  ------------------
  228|   165k|		strlcpy(buf, der__tag[tag], len);
  229|  74.9k|	else
  230|  74.9k|		snprintf(buf, len, "%#x", tag);
  231|   240k|	return buf;
  232|   240k|}
der.c:der_data:
  237|  1.27k|{
  238|  1.27k|	uint32_t i;
  239|  1.27k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  452|  1.27k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.27k|	switch (tag) {
  241|     36|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     36|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 36, False: 1.24k]
  ------------------
  242|    105|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    105|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 69, False: 1.20k]
  ------------------
  243|    105|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    105|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 0, False: 1.27k]
  ------------------
  244|    105|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  453|    105|#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.27k]
  ------------------
  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.17k|	default:
  ------------------
  |  Branch (251:2): [True: 1.17k, False: 105]
  ------------------
  252|  1.17k|		break;
  253|  1.27k|	}
  254|       |
  255|  5.05k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 3.87k, False: 1.17k]
  ------------------
  256|  3.87k|		uint32_t z = i << 1;
  257|  3.87k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 3.63k, False: 244]
  ------------------
  258|  3.63k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  3.87k|	}
  260|  1.17k|	return len * 2;
  261|  1.27k|}

file_encoding:
   78|  28.0k|{
   79|  28.0k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  28.0k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  28.0k|	size_t nbytes = b->flen;
   81|  28.0k|	size_t mlen;
   82|  28.0k|	int rv = 1, ucs_type;
   83|  28.0k|	file_unichar_t *udefbuf;
   84|  28.0k|	size_t udeflen;
   85|       |
   86|  28.0k|	if (buf == NULL)
  ------------------
  |  Branch (86:6): [True: 0, False: 28.0k]
  ------------------
   87|      0|		return 0;
   88|  28.0k|	if (ubuf == NULL)
  ------------------
  |  Branch (88:6): [True: 15.1k, False: 12.8k]
  ------------------
   89|  15.1k|		ubuf = &udefbuf;
   90|  28.0k|	if (ulen == NULL)
  ------------------
  |  Branch (90:6): [True: 15.1k, False: 12.8k]
  ------------------
   91|  15.1k|		ulen = &udeflen;
   92|       |
   93|  28.0k|	*type = "text";
   94|  28.0k|	*ulen = 0;
   95|  28.0k|	*code = "unknown";
   96|  28.0k|	*code_mime = "binary";
   97|       |
   98|  28.0k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (98:6): [True: 769, False: 27.2k]
  ------------------
   99|    769|		nbytes = ms->encoding_max;
  100|       |
  101|  28.0k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  102|  28.0k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  452|  28.0k|#define CAST(T, b)	((T)(b))
  ------------------
  103|  28.0k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (103:6): [True: 0, False: 28.0k]
  ------------------
  104|      0|		file_oomem(ms, mlen);
  105|      0|		goto done;
  106|      0|	}
  107|  28.0k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (107:6): [True: 1.68k, False: 26.3k]
  ------------------
  108|  1.68k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (108:7): [True: 13, False: 1.67k]
  ------------------
  109|     13|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  110|     13|			*code = "Unicode text, UTF-7";
  111|     13|			*code_mime = "utf-7";
  112|  1.67k|		} else {
  113|  1.67k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  114|  1.67k|			*code = "ASCII";
  115|  1.67k|			*code_mime = "us-ascii";
  116|  1.67k|		}
  117|  26.3k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (117:13): [True: 7, False: 26.3k]
  ------------------
  118|      7|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  119|      7|		*code = "Unicode text, UTF-8 (with BOM)";
  120|      7|		*code_mime = "utf-8";
  121|  26.3k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (121:13): [True: 131, False: 26.1k]
  ------------------
  122|    131|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  123|    131|		*code = "Unicode text, UTF-8";
  124|    131|		*code_mime = "utf-8";
  125|  26.1k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (125:13): [True: 422, False: 25.7k]
  ------------------
  126|    422|		if (ucs_type == 1) {
  ------------------
  |  Branch (126:7): [True: 196, False: 226]
  ------------------
  127|    196|			*code = "Unicode text, UTF-32, little-endian";
  128|    196|			*code_mime = "utf-32le";
  129|    226|		} else {
  130|    226|			*code = "Unicode text, UTF-32, big-endian";
  131|    226|			*code_mime = "utf-32be";
  132|    226|		}
  133|    422|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  134|  25.7k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (134:13): [True: 368, False: 25.3k]
  ------------------
  135|    368|		if (ucs_type == 1) {
  ------------------
  |  Branch (135:7): [True: 200, False: 168]
  ------------------
  136|    200|			*code = "Unicode text, UTF-16, little-endian";
  137|    200|			*code_mime = "utf-16le";
  138|    200|		} else {
  139|    168|			*code = "Unicode text, UTF-16, big-endian";
  140|    168|			*code_mime = "utf-16be";
  141|    168|		}
  142|    368|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  143|  25.3k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (143:13): [True: 806, False: 24.5k]
  ------------------
  144|    806|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  145|    806|		*code = "ISO-8859";
  146|    806|		*code_mime = "iso-8859-1";
  147|  24.5k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (147:13): [True: 392, False: 24.1k]
  ------------------
  148|    392|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  149|    392|		*code = "Non-ISO extended-ASCII";
  150|    392|		*code_mime = "unknown-8bit";
  151|  24.1k|	} else {
  152|  24.1k|		unsigned char *nbuf;
  153|       |
  154|  24.1k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  155|  24.1k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  452|  24.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (155:7): [True: 0, False: 24.1k]
  ------------------
  156|      0|			file_oomem(ms, mlen);
  157|      0|			goto done;
  158|      0|		}
  159|  24.1k|		from_ebcdic(buf, nbytes, nbuf);
  160|       |
  161|  24.1k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (161:7): [True: 72, False: 24.1k]
  ------------------
  162|     72|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  163|     72|			*code = "EBCDIC";
  164|     72|			*code_mime = "ebcdic";
  165|  24.1k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (165:14): [True: 96, False: 24.0k]
  ------------------
  166|     96|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  167|     96|			    *ulen));
  168|     96|			*code = "International EBCDIC";
  169|     96|			*code_mime = "ebcdic";
  170|  24.0k|		} else { /* Doesn't look like text at all */
  171|  24.0k|			DPRINTF(("binary\n"));
  172|  24.0k|			rv = 0;
  173|  24.0k|			*type = "binary";
  174|  24.0k|		}
  175|  24.1k|		free(nbuf);
  176|  24.1k|	}
  177|       |
  178|  28.0k| done:
  179|  28.0k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (179:6): [True: 15.1k, False: 12.8k]
  ------------------
  180|  15.1k|		free(udefbuf);
  181|       |
  182|  28.0k|	return rv;
  183|  28.0k|}
file_looks_utf8:
  358|  26.3k|{
  359|  26.3k|	size_t i;
  360|  26.3k|	int n;
  361|  26.3k|	file_unichar_t c;
  362|  26.3k|	int gotone = 0, ctrl = 0;
  363|       |
  364|  26.3k|	if (ubuf)
  ------------------
  |  Branch (364:6): [True: 26.3k, False: 0]
  ------------------
  365|  26.3k|		*ulen = 0;
  366|       |
  367|  16.6M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (367:14): [True: 16.6M, False: 1.50k]
  ------------------
  368|  16.6M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (368:7): [True: 16.5M, False: 107k]
  ------------------
  369|       |			/*
  370|       |			 * Even if the whole file is valid UTF-8 sequences,
  371|       |			 * still reject it if it uses weird control characters.
  372|       |			 */
  373|       |
  374|  16.5M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  238|  16.5M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (374:8): [True: 13.8M, False: 2.71M]
  ------------------
  375|  13.8M|				ctrl = 1;
  376|       |
  377|  16.5M|			if (ubuf)
  ------------------
  |  Branch (377:8): [True: 16.5M, False: 0]
  ------------------
  378|  16.5M|				ubuf[(*ulen)++] = buf[i];
  379|  16.5M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (379:14): [True: 10.3k, False: 96.8k]
  ------------------
  380|  10.3k|			return -1;
  381|  96.8k|		} else {			   /* 11xxxxxx begins UTF-8 */
  382|  96.8k|			int following;
  383|  96.8k|			uint8_t x = first[buf[i]];
  384|  96.8k|			const struct accept_range *ar =
  385|  96.8k|			    &accept_ranges[(unsigned int)x >> 4];
  386|  96.8k|			if (x == XX)
  ------------------
  |  |  306|  96.8k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (386:8): [True: 5.71k, False: 91.0k]
  ------------------
  387|  5.71k|				return -1;
  388|       |
  389|  91.0k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (389:8): [True: 71.6k, False: 19.4k]
  ------------------
  390|  71.6k|				c = buf[i] & 0x1f;
  391|  71.6k|				following = 1;
  392|  71.6k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (392:15): [True: 17.9k, False: 1.40k]
  ------------------
  393|  17.9k|				c = buf[i] & 0x0f;
  394|  17.9k|				following = 2;
  395|  17.9k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (395:15): [True: 1.40k, False: 0]
  ------------------
  396|  1.40k|				c = buf[i] & 0x07;
  397|  1.40k|				following = 3;
  398|  1.40k|			} else if ((buf[i] & 0x04) == 0) {	/* 111110xx */
  ------------------
  |  Branch (398:15): [True: 0, False: 0]
  ------------------
  399|      0|				c = buf[i] & 0x03;
  400|      0|				following = 4;
  401|      0|			} else if ((buf[i] & 0x02) == 0) {	/* 1111110x */
  ------------------
  |  Branch (401:15): [True: 0, False: 0]
  ------------------
  402|      0|				c = buf[i] & 0x01;
  403|      0|				following = 5;
  404|      0|			} else
  405|      0|				return -1;
  406|       |
  407|   189k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (407:16): [True: 107k, False: 82.3k]
  ------------------
  408|   107k|				i++;
  409|   107k|				if (i >= nbytes)
  ------------------
  |  Branch (409:9): [True: 172, False: 107k]
  ------------------
  410|    172|					goto done;
  411|       |
  412|   107k|				if (n == 0 &&
  ------------------
  |  Branch (412:9): [True: 90.9k, False: 16.2k]
  ------------------
  413|  90.9k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (413:11): [True: 3.77k, False: 87.1k]
  |  Branch (413:30): [True: 4.42k, False: 82.7k]
  ------------------
  414|  8.20k|					return -1;
  415|       |
  416|  98.9k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (416:9): [True: 117, False: 98.8k]
  |  Branch (416:33): [True: 265, False: 98.5k]
  ------------------
  417|    382|					return -1;
  418|       |
  419|  98.5k|				c = (c << 6) + (buf[i] & 0x3f);
  420|  98.5k|			}
  421|       |
  422|  82.3k|			if (ubuf)
  ------------------
  |  Branch (422:8): [True: 82.3k, False: 0]
  ------------------
  423|  82.3k|				ubuf[(*ulen)++] = c;
  424|  82.3k|			gotone = 1;
  425|  82.3k|		}
  426|  16.6M|	}
  427|  1.67k|done:
  428|  1.67k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (428:9): [True: 1.43k, False: 240]
  |  Branch (428:21): [True: 131, False: 109]
  ------------------
  429|  26.3k|}
encoding.c:looks_ascii:
  271|  52.1k|    size_t *ulen) \
  272|  52.1k|{ \
  273|  52.1k|	size_t i; \
  274|  52.1k|\
  275|  52.1k|	*ulen = 0; \
  276|  52.1k|\
  277|  12.6M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 12.6M, False: 1.75k]
  ------------------
  278|  12.6M|		int t = text_chars[buf[i]]; \
  279|  12.6M|\
  280|  12.6M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 50.4k, False: 12.5M]
  ------------------
  281|  12.6M|			return 0; \
  282|  12.6M|\
  283|  12.6M|		ubuf[(*ulen)++] = buf[i]; \
  284|  12.5M|	} \
  285|  52.1k|	return 1; \
  286|  52.1k|}
encoding.c:looks_latin1:
  271|  49.5k|    size_t *ulen) \
  272|  49.5k|{ \
  273|  49.5k|	size_t i; \
  274|  49.5k|\
  275|  49.5k|	*ulen = 0; \
  276|  49.5k|\
  277|  4.58M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 4.58M, False: 902]
  ------------------
  278|  4.58M|		int t = text_chars[buf[i]]; \
  279|  4.58M|\
  280|  13.0M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 3.89M, False: 686k]
  |  Branch (280:7): [True: 48.6k, False: 3.84M]
  ------------------
  281|  4.58M|			return 0; \
  282|  4.58M|\
  283|  4.58M|		ubuf[(*ulen)++] = buf[i]; \
  284|  4.53M|	} \
  285|  49.5k|	return 1; \
  286|  49.5k|}
encoding.c:looks_extended:
  271|  24.5k|    size_t *ulen) \
  272|  24.5k|{ \
  273|  24.5k|	size_t i; \
  274|  24.5k|\
  275|  24.5k|	*ulen = 0; \
  276|  24.5k|\
  277|  1.75M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 1.75M, False: 392]
  ------------------
  278|  1.75M|		int t = text_chars[buf[i]]; \
  279|  1.75M|\
  280|  7.30M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 1.22M, False: 527k]
  |  Branch (280:7): [True: 825k, False: 397k]
  |  Branch (280:7): [True: 24.1k, False: 801k]
  ------------------
  281|  1.75M|			return 0; \
  282|  1.75M|\
  283|  1.75M|		ubuf[(*ulen)++] = buf[i]; \
  284|  1.72M|	} \
  285|  24.5k|	return 1; \
  286|  24.5k|}
encoding.c:looks_utf8_with_BOM:
  439|  26.3k|{
  440|  26.3k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (440:6): [True: 25.1k, False: 1.13k]
  |  Branch (440:20): [True: 102, False: 25.0k]
  |  Branch (440:38): [True: 86, False: 16]
  |  Branch (440:56): [True: 69, False: 17]
  ------------------
  441|     69|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  442|  26.2k|	else
  443|  26.2k|		return -1;
  444|  26.3k|}
encoding.c:looks_utf7:
  449|  1.68k|{
  450|  1.68k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (450:6): [True: 944, False: 743]
  |  Branch (450:20): [True: 45, False: 899]
  |  Branch (450:37): [True: 31, False: 14]
  |  Branch (450:54): [True: 16, False: 15]
  ------------------
  451|     16|		switch (buf[3]) {
  452|      3|		case '8':
  ------------------
  |  Branch (452:3): [True: 3, False: 13]
  ------------------
  453|      6|		case '9':
  ------------------
  |  Branch (453:3): [True: 3, False: 13]
  ------------------
  454|      9|		case '+':
  ------------------
  |  Branch (454:3): [True: 3, False: 13]
  ------------------
  455|     13|		case '/':
  ------------------
  |  Branch (455:3): [True: 4, False: 12]
  ------------------
  456|     13|			if (ubuf)
  ------------------
  |  Branch (456:8): [True: 13, False: 0]
  ------------------
  457|     13|				*ulen = 0;
  458|     13|			return 1;
  459|      3|		default:
  ------------------
  |  Branch (459:3): [True: 3, False: 13]
  ------------------
  460|      3|			return -1;
  461|     16|		}
  462|  1.67k|	else
  463|  1.67k|		return -1;
  464|  1.68k|}
encoding.c:looks_ucs16:
  475|  25.7k|{
  476|  25.7k|	int bigend;
  477|  25.7k|	uint32_t hi;
  478|  25.7k|	size_t i;
  479|       |
  480|  25.7k|	if (nbytes < 2)
  ------------------
  |  Branch (480:6): [True: 68, False: 25.6k]
  ------------------
  481|     68|		return 0;
  482|       |
  483|  25.6k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (483:6): [True: 1.86k, False: 23.8k]
  |  Branch (483:23): [True: 294, False: 1.57k]
  ------------------
  484|    294|		bigend = 0;
  485|  25.3k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (485:11): [True: 255, False: 25.1k]
  |  Branch (485:28): [True: 218, False: 37]
  ------------------
  486|    218|		bigend = 1;
  487|  25.1k|	else
  488|  25.1k|		return 0;
  489|       |
  490|    512|	*ulen = 0;
  491|    512|	hi = 0;
  492|       |
  493|   577k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (493:14): [True: 576k, False: 368]
  ------------------
  494|   576k|		uint32_t uc;
  495|       |
  496|   576k|		if (bigend)
  ------------------
  |  Branch (496:7): [True: 146k, False: 430k]
  ------------------
  497|   146k|			uc = CAST(uint32_t,
  ------------------
  |  |  452|   146k|#define CAST(T, b)	((T)(b))
  ------------------
  498|   576k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  499|   430k|		else
  500|   430k|			uc = CAST(uint32_t,
  ------------------
  |  |  452|   430k|#define CAST(T, b)	((T)(b))
  ------------------
  501|   576k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  502|       |
  503|   576k|		uc &= 0xffff;
  504|       |
  505|   576k|		switch (uc) {
  506|      7|		case 0xfffe:
  ------------------
  |  Branch (506:3): [True: 7, False: 576k]
  ------------------
  507|     23|		case 0xffff:
  ------------------
  |  Branch (507:3): [True: 16, False: 576k]
  ------------------
  508|     23|			return 0;
  509|   576k|		default:
  ------------------
  |  Branch (509:3): [True: 576k, False: 23]
  ------------------
  510|   576k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  466|   576k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (466:26): [True: 111k, False: 465k]
  |  |  |  Branch (466:43): [True: 12, False: 111k]
  |  |  ------------------
  ------------------
  511|     12|				return 0;
  512|   576k|			break;
  513|   576k|		}
  514|   576k|		if (hi) {
  ------------------
  |  Branch (514:7): [True: 7.60k, False: 569k]
  ------------------
  515|  7.60k|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  468|  7.60k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (468:26): [True: 7.58k, False: 17]
  |  |  |  Branch (468:43): [True: 7.57k, False: 15]
  |  |  ------------------
  ------------------
  516|     32|				return 0;
  517|  7.57k|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  518|  7.57k|			hi = 0;
  519|  7.57k|		}
  520|   576k|		if (NOTTEXT(uc))
  ------------------
  |  |  470|   576k|    ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  452|   180k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |                   ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  238|   756k|#define T 1   /* character appears in plain ASCII text */
  |  |  ------------------
  |  |  |  Branch (470:6): [True: 180k, False: 396k]
  |  |  |  Branch (470:19): [True: 151k, False: 28.4k]
  |  |  |  Branch (470:57): [True: 46, False: 151k]
  |  |  ------------------
  ------------------
  521|     46|			return 0;
  522|   576k|		ubf[(*ulen)++] = uc;
  523|   576k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  467|   576k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (467:26): [True: 134k, False: 441k]
  |  |  |  Branch (467:43): [True: 7.63k, False: 127k]
  |  |  ------------------
  ------------------
  524|  7.63k|			hi = uc - 0xd800 + 1;
  525|   576k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  468|   576k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (468:26): [True: 127k, False: 449k]
  |  |  |  Branch (468:43): [True: 31, False: 127k]
  |  |  ------------------
  ------------------
  526|     31|			return 0;
  527|   576k|	}
  528|       |
  529|    368|	return 1 + bigend;
  530|    512|}
encoding.c:looks_ucs32:
  536|  26.1k|{
  537|  26.1k|	int bigend;
  538|  26.1k|	file_unichar_t uc;
  539|  26.1k|	size_t i;
  540|       |
  541|  26.1k|	if (nbytes < 4)
  ------------------
  |  Branch (541:6): [True: 1.06k, False: 25.1k]
  ------------------
  542|  1.06k|		return 0;
  543|       |
  544|  25.1k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (544:6): [True: 1.96k, False: 23.1k]
  |  Branch (544:23): [True: 462, False: 1.50k]
  |  Branch (544:40): [True: 302, False: 160]
  |  Branch (544:54): [True: 216, False: 86]
  ------------------
  545|    216|		bigend = 0;
  546|  24.8k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (546:11): [True: 1.26k, False: 23.6k]
  |  Branch (546:25): [True: 662, False: 599]
  |  Branch (546:39): [True: 261, False: 401]
  |  Branch (546:56): [True: 230, False: 31]
  ------------------
  547|    230|		bigend = 1;
  548|  24.6k|	else
  549|  24.6k|		return 0;
  550|       |
  551|    446|	*ulen = 0;
  552|       |
  553|   622k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (553:14): [True: 622k, False: 422]
  ------------------
  554|       |		/* XXX fix to properly handle chars > 65536 */
  555|       |
  556|   622k|		if (bigend)
  ------------------
  |  Branch (556:7): [True: 295k, False: 326k]
  ------------------
  557|   295k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  452|   295k|#define CAST(T, b)	((T)(b))
  ------------------
  558|   295k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  452|   295k|#define CAST(T, b)	((T)(b))
  ------------------
  559|   295k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  452|   295k|#define CAST(T, b)	((T)(b))
  ------------------
  560|   295k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  452|   295k|#define CAST(T, b)	((T)(b))
  ------------------
  561|   326k|		else
  562|   326k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  452|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  563|   326k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  452|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  564|   326k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  452|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  565|   326k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  452|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  566|       |
  567|   622k|		uc = ubf[*ulen - 1];
  568|   622k|		if (uc == 0xfffe || NOTTEXT(uc))
  ------------------
  |  |  470|   622k|    ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  452|  92.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |                   ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  238|   714k|#define T 1   /* character appears in plain ASCII text */
  |  |  ------------------
  |  |  |  Branch (470:6): [True: 92.4k, False: 529k]
  |  |  |  Branch (470:19): [True: 89.3k, False: 3.14k]
  |  |  |  Branch (470:57): [True: 15, False: 89.2k]
  |  |  ------------------
  ------------------
  |  Branch (568:7): [True: 9, False: 622k]
  ------------------
  569|     24|			return 0;
  570|   622k|	}
  571|       |
  572|    422|	return 1 + bigend;
  573|    446|}
encoding.c:from_ebcdic:
  660|  24.1k|{
  661|  24.1k|	size_t i;
  662|       |
  663|  92.5M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (663:14): [True: 92.5M, False: 24.1k]
  ------------------
  664|  92.5M|		out[i] = ebcdic_to_ascii[buf[i]];
  665|  92.5M|	}
  666|  24.1k|}

fmtcheck:
  236|  40.5k|{
  237|  40.5k|	const char	*f1p, *f2p;
  238|  40.5k|	EFT		f1t, f2t;
  239|       |
  240|  40.5k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 40.5k]
  ------------------
  241|       |
  242|  40.5k|	f1p = f1;
  243|  40.5k|	f1t = FMTCHECK_START;
  244|  40.5k|	f2p = f2;
  245|  40.5k|	f2t = FMTCHECK_START;
  246|  81.0k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 40.5k, False: 40.5k]
  ------------------
  247|  40.5k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 40.5k]
  ------------------
  248|      0|			return f2;
  249|  40.5k|		f2t = get_next_format(&f2p, f2t);
  250|  40.5k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 40.5k]
  ------------------
  251|      0|			return f2;
  252|  40.5k|	}
  253|  40.5k|	return f1;
  254|  40.5k|}
fmtcheck.c:get_next_format:
  190|   121k|{
  191|   121k|	int		infmt;
  192|   121k|	const char	*f;
  193|       |
  194|   121k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 121k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|   121k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 121k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|   121k|	f = *pf;
  203|   121k|	infmt = 0;
  204|   202k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 121k, False: 81.0k]
  ------------------
  205|   121k|		f = strchr(f, '%');
  206|   121k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 40.5k, False: 81.0k]
  ------------------
  207|  40.5k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  40.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  40.5k|			*(pf) = (f); \
  |  |   62|  40.5k|			return r; \
  |  |   63|  40.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  208|  81.0k|		f++;
  209|  81.0k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 81.0k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  211|  81.0k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 81.0k, False: 0]
  ------------------
  212|  81.0k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|  81.0k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|  89.3k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 89.3k, False: 0]
  |  Branch (218:15): [True: 8.22k, False: 81.0k]
  ------------------
  219|  8.22k|		f++;
  220|       |
  221|  81.0k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 81.0k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  223|      0|	}
  224|       |	/* eat any width */
  225|  81.0k|	while (isdigit((unsigned char)*f)) f++;
  ------------------
  |  Branch (225:9): [True: 3.46k, False: 81.0k]
  ------------------
  226|  81.0k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 81.0k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  228|      0|	}
  229|       |
  230|  81.0k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|  81.0k|#define RETURN(pf,f,r) do { \
  |  |   61|  81.0k|			*(pf) = (f); \
  |  |   62|  81.0k|			return r; \
  |  |   63|  81.0k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|  81.0k|}
fmtcheck.c:get_next_format_from_width:
  171|  81.0k|{
  172|  81.0k|	const char	*f;
  173|       |
  174|  81.0k|	f = *pf;
  175|  81.0k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 3.38k, False: 77.7k]
  ------------------
  176|  3.38k|		f++;
  177|  3.38k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 3.38k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  179|      0|		}
  180|       |		/* eat any precision (empty is allowed) */
  181|  4.25k|		while (isdigit((unsigned char)*f)) f++;
  ------------------
  |  Branch (181:10): [True: 4.25k, False: 3.38k]
  ------------------
  182|  3.38k|		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, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (182:7): [True: 0, False: 3.38k]
  ------------------
  183|  3.38k|	}
  184|  81.0k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|  81.0k|#define RETURN(pf,f,r) do { \
  |  |   61|  81.0k|			*(pf) = (f); \
  |  |   62|  81.0k|			return r; \
  |  |   63|  81.0k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|  81.0k|}
fmtcheck.c:get_next_format_from_precision:
   67|  81.0k|{
   68|  81.0k|	int		sh, lg, quad, longdouble;
   69|  81.0k|	const char	*f;
   70|       |
   71|  81.0k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|  81.0k|	f = *pf;
   74|  81.0k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 81.0k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|  1.67k|	case 'l':
  ------------------
  |  Branch (79:2): [True: 1.67k, False: 79.4k]
  ------------------
   80|  1.67k|		f++;
   81|  1.67k|		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, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (81:7): [True: 0, False: 1.67k]
  ------------------
   82|  1.67k|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 1.67k, False: 0]
  ------------------
   83|  1.67k|			f++;
   84|  1.67k|			quad = 1;
   85|  1.67k|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|  1.67k|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 81.0k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 81.0k]
  ------------------
   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|  79.4k|	default:
  ------------------
  |  Branch (114:2): [True: 79.4k, False: 1.67k]
  ------------------
  115|  79.4k|		break;
  116|  81.0k|	}
  117|  81.0k|	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, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (117:6): [True: 0, False: 81.0k]
  ------------------
  118|  81.0k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 56.2k, False: 24.8k]
  ------------------
  119|  56.2k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 56.2k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  121|  56.2k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 56.2k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  123|  56.2k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 1.67k, False: 54.5k]
  ------------------
  124|  1.67k|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|  1.67k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.67k|			*(pf) = (f); \
  |  |   62|  1.67k|			return r; \
  |  |   63|  1.67k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  125|  54.5k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  54.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  54.5k|			*(pf) = (f); \
  |  |   62|  54.5k|			return r; \
  |  |   63|  54.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  126|  54.5k|	}
  127|  24.8k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 24.8k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  137|      0|	}
  138|  24.8k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 24.8k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  142|      0|	}
  143|  24.8k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 1.54k, False: 23.2k]
  ------------------
  144|  1.54k|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 1.54k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  146|  1.54k|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 1.54k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  148|  1.54k|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|  1.54k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.54k|			*(pf) = (f); \
  |  |   62|  1.54k|			return r; \
  |  |   63|  1.54k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  149|  1.54k|	}
  150|  23.2k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 644, False: 22.6k]
  ------------------
  151|    644|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 644]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  153|    644|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    644|#define RETURN(pf,f,r) do { \
  |  |   61|    644|			*(pf) = (f); \
  |  |   62|    644|			return r; \
  |  |   63|    644|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  154|    644|	}
  155|  22.6k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 22.6k, False: 0]
  ------------------
  156|  22.6k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 22.6k]
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  158|  22.6k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  22.6k|#define RETURN(pf,f,r) do { \
  |  |   61|  22.6k|			*(pf) = (f); \
  |  |   62|  22.6k|			return r; \
  |  |   63|  22.6k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  159|  22.6k|	}
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  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, False: 0]
  |  |  ------------------
  ------------------
  166|       |	/*NOTREACHED*/
  167|      0|}

file_fsmagic:
  178|  10.3k|{
  179|  10.3k|	int ret, didv = 0, *did;
  180|  10.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   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 */
  |  |  ------------------
  ------------------
  181|  10.3k|	int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION);
  ------------------
  |  |   45|  10.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION);
  ------------------
  |  |   46|  10.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  182|  10.3k|#ifdef	S_IFLNK
  183|  10.3k|	char buf[BUFSIZ+4];
  184|  10.3k|	ssize_t nch;
  185|  10.3k|	struct stat tstatbuf;
  186|  10.3k|#endif
  187|  10.3k|	did = &didv;
  188|       |
  189|  10.3k|	if (fn == NULL)
  ------------------
  |  Branch (189:6): [True: 10.3k, False: 0]
  ------------------
  190|  10.3k|		return 0;
  191|       |
  192|       |	/*
  193|       |	 * Fstat is cheaper but fails for files you don't have read perms on.
  194|       |	 * On 4.2BSD and similar systems, use lstat() to identify symlinks.
  195|       |	 */
  196|      0|#ifdef	S_IFLNK
  197|      0|	if ((ms->flags & MAGIC_SYMLINK) == 0)
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  |  Branch (197:6): [True: 0, False: 0]
  ------------------
  198|      0|		ret = lstat(fn, sb);
  199|      0|	else
  200|      0|#endif
  201|      0|	ret = stat(fn, sb);	/* don't merge into if; see "ret =" above */
  202|       |
  203|       |#ifdef WIN32
  204|       |	{
  205|       |		HANDLE hFile = CreateFile((LPCSTR)fn, 0, FILE_SHARE_DELETE |
  206|       |		    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0,
  207|       |		    NULL);
  208|       |		if (hFile != INVALID_HANDLE_VALUE) {
  209|       |			/*
  210|       |			 * Stat failed, but we can still open it - assume it's
  211|       |			 * a block device, if nothing else.
  212|       |			 */
  213|       |			if (ret) {
  214|       |				sb->st_mode = S_IFBLK;
  215|       |				ret = 0;
  216|       |			}
  217|       |			switch (GetFileType(hFile)) {
  218|       |			case FILE_TYPE_CHAR:
  219|       |				sb->st_mode |= S_IFCHR;
  220|       |				sb->st_mode &= ~S_IFREG;
  221|       |				break;
  222|       |			case FILE_TYPE_PIPE:
  223|       |				sb->st_mode |= S_IFIFO;
  224|       |				sb->st_mode &= ~S_IFREG;
  225|       |				break;
  226|       |			}
  227|       |			CloseHandle(hFile);
  228|       |		}
  229|       |	}
  230|       |#endif
  231|       |
  232|      0|	if (ret) {
  ------------------
  |  Branch (232:6): [True: 0, False: 0]
  ------------------
  233|      0|		if (ms->flags & MAGIC_ERROR) {
  ------------------
  |  |   42|      0|#define	MAGIC_ERROR		0x0000200 /* Handle ENOENT etc as real errors */
  ------------------
  |  Branch (233:7): [True: 0, False: 0]
  ------------------
  234|      0|			file_error(ms, errno, "cannot stat `%s'", fn);
  235|      0|			return -1;
  236|      0|		}
  237|      0|		if (file_printf(ms, "cannot open `%s' (%s)",
  ------------------
  |  Branch (237:7): [True: 0, False: 0]
  ------------------
  238|      0|		    fn, strerror(errno)) == -1)
  239|      0|			return -1;
  240|      0|		return 0;
  241|      0|	}
  242|       |
  243|      0|	ret = 1;
  244|      0|	if (!mime && !silent) {
  ------------------
  |  Branch (244:6): [True: 0, False: 0]
  |  Branch (244:15): [True: 0, False: 0]
  ------------------
  245|      0|		if (pr_flags(ms, sb->st_mode, sugid, __arraycount(sugid),
  ------------------
  |  |  130|      0|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (245:7): [True: 0, False: 0]
  ------------------
  246|      0|		    did) == -1)
  247|      0|			return -1;
  248|       |#if HAVE_STRUCT_STAT_ST_FLAGS
  249|       |		if (pr_flags(ms, sb->st_flags, sflags, __arraycount(sflags),
  250|       |		    did) == -1)
  251|       |			return -1;
  252|       |#endif
  253|      0|	}
  254|       |
  255|      0|	switch (sb->st_mode & S_IFMT) {
  256|      0|	case S_IFDIR:
  ------------------
  |  Branch (256:2): [True: 0, False: 0]
  ------------------
  257|      0|		if (mime) {
  ------------------
  |  Branch (257:7): [True: 0, False: 0]
  ------------------
  258|      0|			if (handle_mime(ms, mime, "directory") == -1)
  ------------------
  |  Branch (258:8): [True: 0, False: 0]
  ------------------
  259|      0|				return -1;
  260|      0|		} else if (silent) {
  ------------------
  |  Branch (260:14): [True: 0, False: 0]
  ------------------
  261|      0|		} else if (file_printf(ms, "%sdirectory", COMMA) == -1)
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (261:14): [True: 0, False: 0]
  ------------------
  262|      0|			return -1;
  263|      0|		break;
  264|      0|#ifdef S_IFCHR
  265|      0|	case S_IFCHR:
  ------------------
  |  Branch (265:2): [True: 0, False: 0]
  ------------------
  266|       |		/*
  267|       |		 * If -s has been specified, treat character special files
  268|       |		 * like ordinary files.  Otherwise, just report that they
  269|       |		 * are block special files and go on to the next file.
  270|       |		 */
  271|      0|		if ((ms->flags & MAGIC_DEVICES) != 0) {
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (271:7): [True: 0, False: 0]
  ------------------
  272|      0|			ret = 0;
  273|      0|			break;
  274|      0|		}
  275|      0|		if (mime) {
  ------------------
  |  Branch (275:7): [True: 0, False: 0]
  ------------------
  276|      0|			if (handle_mime(ms, mime, "chardevice") == -1)
  ------------------
  |  Branch (276:8): [True: 0, False: 0]
  ------------------
  277|      0|				return -1;
  278|      0|		} else if (silent) {
  ------------------
  |  Branch (278:14): [True: 0, False: 0]
  ------------------
  279|      0|		} else {
  280|      0|#ifdef HAVE_STRUCT_STAT_ST_RDEV
  281|       |# ifdef dv_unit
  282|       |			if (file_printf(ms, "%scharacter special (%d/%d/%d)",
  283|       |			    COMMA, major(sb->st_rdev), dv_unit(sb->st_rdev),
  284|       |					dv_subunit(sb->st_rdev)) == -1)
  285|       |				return -1;
  286|       |# else
  287|      0|			if (file_printf(ms, "%scharacter special (%ld/%ld)",
  ------------------
  |  Branch (287:8): [True: 0, False: 0]
  ------------------
  288|      0|			    COMMA, (long)major(sb->st_rdev),
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  289|      0|			    (long)minor(sb->st_rdev)) == -1)
  290|      0|				return -1;
  291|      0|# endif
  292|       |#else
  293|       |			if (file_printf(ms, "%scharacter special", COMMA) == -1)
  294|       |				return -1;
  295|       |#endif
  296|      0|		}
  297|      0|		break;
  298|      0|#endif
  299|      0|#ifdef S_IFBLK
  300|      0|	case S_IFBLK:
  ------------------
  |  Branch (300:2): [True: 0, False: 0]
  ------------------
  301|       |		/*
  302|       |		 * If -s has been specified, treat block special files
  303|       |		 * like ordinary files.  Otherwise, just report that they
  304|       |		 * are block special files and go on to the next file.
  305|       |		 */
  306|      0|		if ((ms->flags & MAGIC_DEVICES) != 0) {
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (306:7): [True: 0, False: 0]
  ------------------
  307|      0|			ret = 0;
  308|      0|			break;
  309|      0|		}
  310|      0|		if (mime) {
  ------------------
  |  Branch (310:7): [True: 0, False: 0]
  ------------------
  311|      0|			if (handle_mime(ms, mime, "blockdevice") == -1)
  ------------------
  |  Branch (311:8): [True: 0, False: 0]
  ------------------
  312|      0|				return -1;
  313|      0|		} else if (silent) {
  ------------------
  |  Branch (313:14): [True: 0, False: 0]
  ------------------
  314|      0|		} else {
  315|      0|#ifdef HAVE_STRUCT_STAT_ST_RDEV
  316|       |# ifdef dv_unit
  317|       |			if (file_printf(ms, "%sblock special (%d/%d/%d)",
  318|       |			    COMMA, major(sb->st_rdev), dv_unit(sb->st_rdev),
  319|       |			    dv_subunit(sb->st_rdev)) == -1)
  320|       |				return -1;
  321|       |# else
  322|      0|			if (file_printf(ms, "%sblock special (%ld/%ld)",
  ------------------
  |  Branch (322:8): [True: 0, False: 0]
  ------------------
  323|      0|			    COMMA, (long)major(sb->st_rdev),
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  324|      0|			    (long)minor(sb->st_rdev)) == -1)
  325|      0|				return -1;
  326|      0|# endif
  327|       |#else
  328|       |			if (file_printf(ms, "%sblock special", COMMA) == -1)
  329|       |				return -1;
  330|       |#endif
  331|      0|		}
  332|      0|		break;
  333|      0|#endif
  334|       |	/* TODO add code to handle V7 MUX and Blit MUX files */
  335|      0|#ifdef	S_IFIFO
  336|      0|	case S_IFIFO:
  ------------------
  |  Branch (336:2): [True: 0, False: 0]
  ------------------
  337|      0|		if((ms->flags & MAGIC_DEVICES) != 0)
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (337:6): [True: 0, False: 0]
  ------------------
  338|      0|			break;
  339|      0|		if (mime) {
  ------------------
  |  Branch (339:7): [True: 0, False: 0]
  ------------------
  340|      0|			if (handle_mime(ms, mime, "fifo") == -1)
  ------------------
  |  Branch (340:8): [True: 0, False: 0]
  ------------------
  341|      0|				return -1;
  342|      0|		} else if (silent) {
  ------------------
  |  Branch (342:14): [True: 0, False: 0]
  ------------------
  343|      0|		} else if (file_printf(ms, "%sfifo (named pipe)", COMMA) == -1)
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (343:14): [True: 0, False: 0]
  ------------------
  344|      0|			return -1;
  345|      0|		break;
  346|      0|#endif
  347|       |#ifdef	S_IFDOOR
  348|       |	case S_IFDOOR:
  349|       |		if (mime) {
  350|       |			if (handle_mime(ms, mime, "door") == -1)
  351|       |				return -1;
  352|       |		} else if (silent) {
  353|       |		} else if (file_printf(ms, "%sdoor", COMMA) == -1)
  354|       |			return -1;
  355|       |		break;
  356|       |#endif
  357|      0|#ifdef	S_IFLNK
  358|      0|	case S_IFLNK:
  ------------------
  |  Branch (358:2): [True: 0, False: 0]
  ------------------
  359|      0|		if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
  ------------------
  |  Branch (359:7): [True: 0, False: 0]
  ------------------
  360|      0|			if (ms->flags & MAGIC_ERROR) {
  ------------------
  |  |   42|      0|#define	MAGIC_ERROR		0x0000200 /* Handle ENOENT etc as real errors */
  ------------------
  |  Branch (360:8): [True: 0, False: 0]
  ------------------
  361|      0|			    file_error(ms, errno, "unreadable symlink `%s'",
  362|      0|				fn);
  363|      0|			    return -1;
  364|      0|			}
  365|      0|			if (mime) {
  ------------------
  |  Branch (365:8): [True: 0, False: 0]
  ------------------
  366|      0|				if (handle_mime(ms, mime, "symlink") == -1)
  ------------------
  |  Branch (366:9): [True: 0, False: 0]
  ------------------
  367|      0|					return -1;
  368|      0|			} else if (silent) {
  ------------------
  |  Branch (368:15): [True: 0, False: 0]
  ------------------
  369|      0|			} else if (file_printf(ms,
  ------------------
  |  Branch (369:15): [True: 0, False: 0]
  ------------------
  370|      0|			    "%sunreadable symlink `%s' (%s)", COMMA, fn,
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  371|      0|			    strerror(errno)) == -1)
  372|      0|				return -1;
  373|      0|			break;
  374|      0|		}
  375|      0|		buf[nch] = '\0';	/* readlink(2) does not do this */
  376|       |
  377|       |		/* If broken symlink, say so and quit early. */
  378|      0|#ifdef __linux__
  379|       |		/*
  380|       |		 * linux procfs/devfs makes symlinks like pipe:[3515864880]
  381|       |		 * that we can't stat their readlink output, so stat the
  382|       |		 * original filename instead.
  383|       |		 */
  384|      0|		if (stat(fn, &tstatbuf) < 0)
  ------------------
  |  Branch (384:7): [True: 0, False: 0]
  ------------------
  385|      0|			return bad_link(ms, errno, buf);
  386|       |#else
  387|       |		if (*buf == '/') {
  388|       |			if (stat(buf, &tstatbuf) < 0)
  389|       |				return bad_link(ms, errno, buf);
  390|       |		} else {
  391|       |			char *tmp;
  392|       |			char buf2[BUFSIZ+BUFSIZ+4];
  393|       |
  394|       |			if ((tmp = CCAST(char *, strrchr(fn,  '/'))) == NULL) {
  395|       |				tmp = buf; /* in current directory anyway */
  396|       |			} else {
  397|       |				if (tmp - fn + 1 > BUFSIZ) {
  398|       |					if (ms->flags & MAGIC_ERROR) {
  399|       |						file_error(ms, 0,
  400|       |						    "path too long: `%s'", buf);
  401|       |						return -1;
  402|       |					}
  403|       |					if (mime) {
  404|       |						if (handle_mime(ms, mime,
  405|       |						    "x-path-too-long") == -1)
  406|       |							return -1;
  407|       |					} else if (silent) {
  408|       |					} else if (file_printf(ms,
  409|       |					    "%spath too long: `%s'", COMMA,
  410|       |					    fn) == -1)
  411|       |						return -1;
  412|       |					break;
  413|       |				}
  414|       |				/* take dir part */
  415|       |				(void)strlcpy(buf2, fn, sizeof buf2);
  416|       |				buf2[tmp - fn + 1] = '\0';
  417|       |				/* plus (rel) link */
  418|       |				(void)strlcat(buf2, buf, sizeof buf2);
  419|       |				tmp = buf2;
  420|       |			}
  421|       |			if (stat(tmp, &tstatbuf) < 0)
  422|       |				return bad_link(ms, errno, buf);
  423|       |		}
  424|       |#endif
  425|       |
  426|       |		/* Otherwise, handle it. */
  427|      0|		if ((ms->flags & MAGIC_SYMLINK) != 0) {
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  |  Branch (427:7): [True: 0, False: 0]
  ------------------
  428|      0|			const char *p;
  429|      0|			ms->flags &= MAGIC_SYMLINK;
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  430|      0|			p = magic_file(ms, buf);
  431|      0|			ms->flags |= MAGIC_SYMLINK;
  ------------------
  |  |   34|      0|#define	MAGIC_SYMLINK		0x0000002 /* Follow symlinks */
  ------------------
  432|      0|			if (p == NULL)
  ------------------
  |  Branch (432:8): [True: 0, False: 0]
  ------------------
  433|      0|				return -1;
  434|      0|		} else { /* just print what it points to */
  435|      0|			if (mime) {
  ------------------
  |  Branch (435:8): [True: 0, False: 0]
  ------------------
  436|      0|				if (handle_mime(ms, mime, "symlink") == -1)
  ------------------
  |  Branch (436:9): [True: 0, False: 0]
  ------------------
  437|      0|					return -1;
  438|      0|			} else if (silent) {
  ------------------
  |  Branch (438:15): [True: 0, False: 0]
  ------------------
  439|      0|			} else if (file_printf(ms, "%ssymbolic link to %s",
  ------------------
  |  Branch (439:15): [True: 0, False: 0]
  ------------------
  440|      0|			    COMMA, buf) == -1)
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  441|      0|				return -1;
  442|      0|		}
  443|      0|		break;
  444|      0|#endif
  445|      0|#ifdef	S_IFSOCK
  446|      0|#ifndef __COHERENT__
  447|      0|	case S_IFSOCK:
  ------------------
  |  Branch (447:2): [True: 0, False: 0]
  ------------------
  448|      0|		if (mime) {
  ------------------
  |  Branch (448:7): [True: 0, False: 0]
  ------------------
  449|      0|			if (handle_mime(ms, mime, "socket") == -1)
  ------------------
  |  Branch (449:8): [True: 0, False: 0]
  ------------------
  450|      0|				return -1;
  451|      0|		} else if (silent) {
  ------------------
  |  Branch (451:14): [True: 0, False: 0]
  ------------------
  452|      0|		} else if (file_printf(ms, "%ssocket", COMMA) == -1)
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (452:14): [True: 0, False: 0]
  ------------------
  453|      0|			return -1;
  454|      0|		break;
  455|      0|#endif
  456|      0|#endif
  457|      0|	case S_IFREG:
  ------------------
  |  Branch (457:2): [True: 0, False: 0]
  ------------------
  458|       |		/*
  459|       |		 * regular file, check next possibility
  460|       |		 *
  461|       |		 * If stat() tells us the file has zero length, report here that
  462|       |		 * the file is empty, so we can skip all the work of opening and
  463|       |		 * reading the file.
  464|       |		 * But if the -s option has been given, we skip this
  465|       |		 * optimization, since on some systems, stat() reports zero
  466|       |		 * size for raw disk partitions. (If the block special device
  467|       |		 * really has zero length, the fact that it is empty will be
  468|       |		 * detected and reported correctly when we read the file.)
  469|       |		 */
  470|      0|		if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
  ------------------
  |  |   36|      0|#define	MAGIC_DEVICES		0x0000008 /* Look at the contents of devices */
  ------------------
  |  Branch (470:7): [True: 0, False: 0]
  |  Branch (470:43): [True: 0, False: 0]
  ------------------
  471|      0|			if (mime) {
  ------------------
  |  Branch (471:8): [True: 0, False: 0]
  ------------------
  472|      0|				if (handle_mime(ms, mime, "x-empty") == -1)
  ------------------
  |  Branch (472:9): [True: 0, False: 0]
  ------------------
  473|      0|					return -1;
  474|      0|			} else if (silent) {
  ------------------
  |  Branch (474:15): [True: 0, False: 0]
  ------------------
  475|      0|			} else if (file_printf(ms, "%sempty", COMMA) == -1)
  ------------------
  |  |  163|      0|#define COMMA	((*did)++ ? ", " : "")
  |  |  ------------------
  |  |  |  Branch (163:16): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (475:15): [True: 0, False: 0]
  ------------------
  476|      0|				return -1;
  477|      0|			break;
  478|      0|		}
  479|      0|		ret = 0;
  480|      0|		break;
  481|       |
  482|      0|	default:
  ------------------
  |  Branch (482:2): [True: 0, False: 0]
  ------------------
  483|      0|		file_error(ms, 0, "invalid mode 0%o", sb->st_mode);
  484|      0|		return -1;
  485|       |		/*NOTREACHED*/
  486|      0|	}
  487|       |
  488|      0|	if (!silent && !mime && did && ret == 0) {
  ------------------
  |  Branch (488:6): [True: 0, False: 0]
  |  Branch (488:17): [True: 0, False: 0]
  |  Branch (488:26): [True: 0, False: 0]
  |  Branch (488:33): [True: 0, False: 0]
  ------------------
  489|      0|	    if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (489:10): [True: 0, False: 0]
  ------------------
  490|      0|		    return -1;
  491|      0|	}
  492|       |	/*
  493|       |	 * If we were looking for extensions or apple (silent) it is not our
  494|       |	 * job to print here, so don't count this as a match.
  495|       |	 */
  496|      0|	if (ret == 1 && silent)
  ------------------
  |  Branch (496:6): [True: 0, False: 0]
  |  Branch (496:18): [True: 0, False: 0]
  ------------------
  497|      0|		return 0;
  498|      0|	return ret;
  499|      0|}

file_bigendian:
   57|     95|{
   58|     95|	union {
   59|     95|		unsigned short x;
   60|     95|		unsigned char s[sizeof(unsigned short)];
   61|     95|	} u;
   62|       |
   63|     95|	u.x = 1;
   64|     95|	return u.s[0] != 1;
   65|     95|}
file_copystr:
   69|    459|{
   70|    459|	if (blen == 0)
  ------------------
  |  Branch (70:6): [True: 0, False: 459]
  ------------------
   71|      0|		return buf;
   72|    459|	if (width >= blen)
  ------------------
  |  Branch (72:6): [True: 11, False: 448]
  ------------------
   73|     11|		width = blen - 1;
   74|    459|	memcpy(buf, str, width);
   75|    459|	buf[width] = '\0';
   76|    459|	return buf;
   77|    459|}
file_checkfmt:
  111|   348k|{
  112|   348k|	const char *p;
  113|  2.49M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (113:16): [True: 2.14M, False: 348k]
  ------------------
  114|  2.14M|		if (*p != '%')
  ------------------
  |  Branch (114:7): [True: 1.98M, False: 155k]
  ------------------
  115|  1.98M|			continue;
  116|   155k|		if (*++p == '%')
  ------------------
  |  Branch (116:7): [True: 0, False: 155k]
  ------------------
  117|      0|			continue;
  118|   155k|		if (*p == '\0') {
  ------------------
  |  Branch (118:7): [True: 0, False: 155k]
  ------------------
  119|      0|			if (msg)
  ------------------
  |  Branch (119:8): [True: 0, False: 0]
  ------------------
  120|      0|				snprintf(msg, mlen, "incomplete %% format");
  121|      0|			return -1;
  122|      0|		}
  123|       |		// Skip uninteresting.
  124|   170k|		while (*p != '\0' && strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (124:10): [True: 170k, False: 0]
  |  Branch (124:24): [True: 14.8k, False: 155k]
  ------------------
  125|  14.8k|			p++;
  126|   155k|		if (*p == '*') {
  ------------------
  |  Branch (126:7): [True: 0, False: 155k]
  ------------------
  127|      0|			if (msg)
  ------------------
  |  Branch (127:8): [True: 0, False: 0]
  ------------------
  128|      0|				snprintf(msg, mlen, "* not allowed in format");
  129|      0|			return -1;
  130|      0|		}
  131|       |
  132|   155k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (132:7): [True: 0, False: 155k]
  ------------------
  133|      0|			return -1;
  134|       |
  135|   155k|		if (*p == '.') {
  ------------------
  |  Branch (135:7): [True: 2.39k, False: 153k]
  ------------------
  136|  2.39k|			p++;
  137|  2.39k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (137:8): [True: 0, False: 2.39k]
  ------------------
  138|      0|				return -1;
  139|  2.39k|		}
  140|       |
  141|   155k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (141:7): [True: 0, False: 155k]
  ------------------
  142|      0|			if (msg)
  ------------------
  |  Branch (142:8): [True: 0, False: 0]
  ------------------
  143|      0|				snprintf(msg, mlen, "bad format char: %c", *p);
  144|      0|			return -1;
  145|      0|		}
  146|   155k|	}
  147|   348k|	return 0;
  148|   348k|}
file_vprintf:
  155|   350k|{
  156|   350k|	int len;
  157|   350k|	char *buf, *newstr;
  158|   350k|	char tbuf[1024];
  159|       |
  160|   350k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|   350k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (160:6): [True: 1.88k, False: 348k]
  ------------------
  161|  1.88k|		return 0;
  162|       |
  163|   348k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (163:6): [True: 0, False: 348k]
  ------------------
  164|      0|		file_clearbuf(ms);
  165|      0|		file_error(ms, 0, "Bad magic format `%s' (%s)", fmt, tbuf);
  166|      0|		return -1;
  167|      0|	}
  168|       |
  169|   348k|	len = vasprintf(&buf, fmt, ap);
  170|   348k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (170:6): [True: 0, False: 348k]
  |  Branch (170:17): [True: 128, False: 348k]
  |  Branch (170:39): [True: 0, False: 348k]
  ------------------
  171|    128|		size_t blen = ms->o.blen;
  172|    128|		free(buf);
  173|    128|		file_clearbuf(ms);
  174|    128|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  175|    128|		    SIZE_T_FORMAT "u", len, blen);
  176|    128|		return -1;
  177|    128|	}
  178|       |
  179|   348k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (179:6): [True: 317k, False: 30.4k]
  ------------------
  180|   317k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  181|   317k|		free(buf);
  182|   317k|		if (len < 0)
  ------------------
  |  Branch (182:7): [True: 0, False: 317k]
  ------------------
  183|      0|			goto out;
  184|   317k|		free(ms->o.buf);
  185|   317k|		buf = newstr;
  186|   317k|	}
  187|   348k|	ms->o.buf = buf;
  188|   348k|	ms->o.blen = len;
  189|   348k|	return 0;
  190|      0|out:
  191|      0|	file_clearbuf(ms);
  192|       |	file_error(ms, errno, "vasprintf failed");
  193|      0|	return -1;
  194|   348k|}
file_printf:
  198|   335k|{
  199|   335k|	int rv;
  200|   335k|	va_list ap;
  201|       |
  202|   335k|	va_start(ap, fmt);
  203|   335k|	rv = file_vprintf(ms, fmt, ap);
  204|       |	va_end(ap);
  205|   335k|	return rv;
  206|   335k|}
file_error:
  236|    291|{
  237|    291|	va_list va;
  238|    291|	va_start(va, f);
  239|    291|	file_error_core(ms, error, f, va, 0);
  240|       |	va_end(va);
  241|    291|}
file_magerror:
  249|     52|{
  250|     52|	va_list va;
  251|     52|	va_start(va, f);
  252|     52|	file_error_core(ms, 0, f, va, ms->line);
  253|       |	va_end(va);
  254|     52|}
file_badseek:
  265|      5|{
  266|       |	file_error(ms, errno, "error seeking");
  267|      5|}
file_badread:
  271|     72|{
  272|       |	file_error(ms, errno, "error reading");
  273|     72|}
file_separator:
  280|  49.4k|{
  281|  49.4k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  276|  49.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  282|  49.4k|}
file_default:
  315|  10.9k|{
  316|  10.9k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  10.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (316:6): [True: 0, False: 10.9k]
  ------------------
  317|      0|		if ((ms->flags & MAGIC_MIME_TYPE) &&
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (317:7): [True: 0, False: 0]
  ------------------
  318|      0|		    file_printf(ms, "application/%s",
  ------------------
  |  Branch (318:7): [True: 0, False: 0]
  ------------------
  319|      0|			nb ? "octet-stream" : "x-empty") == -1)
  ------------------
  |  Branch (319:4): [True: 0, False: 0]
  ------------------
  320|      0|			return -1;
  321|      0|		return 1;
  322|      0|	}
  323|  10.9k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  10.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (323:6): [True: 0, False: 10.9k]
  ------------------
  324|       |		// This is not a typo: Type: UNKN Creator: UNKN
  325|      0|		if (file_printf(ms, "UNKNUNKN") == -1)
  ------------------
  |  Branch (325:7): [True: 0, False: 0]
  ------------------
  326|      0|			return -1;
  327|      0|		return 1;
  328|      0|	}
  329|  10.9k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  10.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (329:6): [True: 0, False: 10.9k]
  ------------------
  330|      0|		if (file_printf(ms, "???") == -1)
  ------------------
  |  Branch (330:7): [True: 0, False: 0]
  ------------------
  331|      0|			return -1;
  332|      0|		return 1;
  333|      0|	}
  334|  10.9k|	return 0;
  335|  10.9k|}
file_buffer:
  348|  15.1k|{
  349|  15.1k|	int m = 0, rv = 0, looks_text = 0;
  350|  15.1k|	const char *code = NULL;
  351|  15.1k|	const char *code_mime = "binary";
  352|  15.1k|	const char *def = "data";
  353|  15.1k|	const char *ftype = NULL;
  354|  15.1k|	char *rbuf = NULL;
  355|  15.1k|	struct buffer b;
  356|       |
  357|  15.1k|	buffer_init(&b, fd, st, buf, nb);
  358|  15.1k|	ms->mode = b.st.st_mode;
  359|       |
  360|  15.1k|	if (nb == 0) {
  ------------------
  |  Branch (360:6): [True: 19, False: 15.1k]
  ------------------
  361|     19|		def = "empty";
  362|     19|		goto simple;
  363|  15.1k|	} else if (nb == 1) {
  ------------------
  |  Branch (363:13): [True: 10, False: 15.1k]
  ------------------
  364|     10|		def = "very short file (no magic)";
  365|     10|		goto simple;
  366|     10|	}
  367|       |
  368|  15.1k|	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
  ------------------
  |  |   63|  15.1k|#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
  ------------------
  |  Branch (368:6): [True: 15.1k, False: 0]
  ------------------
  369|  15.1k|		looks_text = file_encoding(ms, &b, NULL, 0,
  370|  15.1k|		    &code, &code_mime, &ftype);
  371|  15.1k|	}
  372|       |
  373|       |#ifdef __EMX__
  374|       |	if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
  375|       |		m = file_os2_apptype(ms, inname, &b);
  376|       |		if ((ms->flags & MAGIC_DEBUG) != 0)
  377|       |			(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
  378|       |		switch (m) {
  379|       |		case -1:
  380|       |			return -1;
  381|       |		case 0:
  382|       |			break;
  383|       |		default:
  384|       |			return 1;
  385|       |		}
  386|       |	}
  387|       |#endif
  388|  15.1k|#if HAVE_FORK
  389|       |	/* try compression stuff */
  390|  15.1k|	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
  ------------------
  |  |   54|  15.1k|#define	MAGIC_NO_CHECK_COMPRESS	0x0001000 /* Don't check for compressed files */
  ------------------
  |  Branch (390:6): [True: 15.1k, False: 0]
  ------------------
  391|  15.1k|		m = file_zmagic(ms, &b, inname);
  392|  15.1k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  15.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (392:7): [True: 0, False: 15.1k]
  ------------------
  393|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  394|  15.1k|		if (m) {
  ------------------
  |  Branch (394:7): [True: 2.21k, False: 12.9k]
  ------------------
  395|  2.21k|			goto done_encoding;
  396|  2.21k|		}
  397|  15.1k|	}
  398|  12.9k|#endif
  399|       |	/* Check if we have a tar file */
  400|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  12.9k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (400:6): [True: 12.9k, False: 0]
  ------------------
  401|  12.9k|		m = file_is_tar(ms, &b);
  402|  12.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (402:7): [True: 0, False: 12.9k]
  ------------------
  403|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  404|  12.9k|		if (m) {
  ------------------
  |  Branch (404:7): [True: 10, False: 12.8k]
  ------------------
  405|     10|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (405:8): [True: 0, False: 10]
  ------------------
  406|      0|				goto done;
  407|     10|		}
  408|  12.9k|	}
  409|       |
  410|       |	/* Check if we have a JSON file */
  411|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  12.9k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (411:6): [True: 12.9k, False: 0]
  ------------------
  412|  12.9k|		m = file_is_json(ms, &b);
  413|  12.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (413:7): [True: 0, False: 12.9k]
  ------------------
  414|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  415|  12.9k|		if (m) {
  ------------------
  |  Branch (415:7): [True: 30, False: 12.8k]
  ------------------
  416|     30|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 30]
  ------------------
  417|      0|				goto done;
  418|     30|		}
  419|  12.9k|	}
  420|       |
  421|       |	/* Check if we have a CSV file */
  422|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  12.9k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (422:6): [True: 12.9k, False: 0]
  ------------------
  423|  12.9k|		m = file_is_csv(ms, &b, looks_text, code);
  424|  12.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (424:7): [True: 0, False: 12.9k]
  ------------------
  425|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  426|  12.9k|		if (m) {
  ------------------
  |  Branch (426:7): [True: 10, False: 12.8k]
  ------------------
  427|     10|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (427:8): [True: 0, False: 10]
  ------------------
  428|      0|				goto done;
  429|     10|		}
  430|  12.9k|	}
  431|       |
  432|       |	/* Check if we have a SIMH tape file */
  433|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_SIMH) == 0) {
  ------------------
  |  |   65|  12.9k|#define MAGIC_NO_CHECK_SIMH	0x0800000 /* Don't check for SIMH tape files */
  ------------------
  |  Branch (433:6): [True: 12.9k, False: 0]
  ------------------
  434|  12.9k|		m = file_is_simh(ms, &b);
  435|  12.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (435:7): [True: 0, False: 12.9k]
  ------------------
  436|      0|			(void)fprintf(stderr, "[try simh %d]\n", m);
  437|  12.9k|		if (m) {
  ------------------
  |  Branch (437:7): [True: 25, False: 12.8k]
  ------------------
  438|     25|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (438:8): [True: 0, False: 25]
  ------------------
  439|      0|				goto done;
  440|     25|		}
  441|  12.9k|	}
  442|       |
  443|       |	/* Check if we have a CDF file */
  444|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  12.9k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (444:6): [True: 12.9k, False: 0]
  ------------------
  445|  12.9k|		m = file_trycdf(ms, &b);
  446|  12.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (446:7): [True: 0, False: 12.9k]
  ------------------
  447|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  448|  12.9k|		if (m) {
  ------------------
  |  Branch (448:7): [True: 1.40k, False: 11.5k]
  ------------------
  449|  1.40k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (449:8): [True: 0, False: 1.40k]
  ------------------
  450|      0|				goto done;
  451|  1.40k|		}
  452|  12.9k|	}
  453|  12.9k|#ifdef BUILTIN_ELF
  454|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  12.9k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (454:6): [True: 12.9k, False: 0]
  |  Branch (454:47): [True: 11.4k, False: 1.50k]
  |  Branch (454:57): [True: 7.10k, False: 4.30k]
  ------------------
  455|  7.10k|		file_pushbuf_t *pb;
  456|       |		/*
  457|       |		 * We matched something in the file, so this
  458|       |		 * *might* be an ELF file, and the file is at
  459|       |		 * least 5 bytes long, so if it's an ELF file
  460|       |		 * it has at least one byte past the ELF magic
  461|       |		 * number - try extracting information from the
  462|       |		 * ELF headers that cannot easily be  extracted
  463|       |		 * with rules in the magic file. We we don't
  464|       |		 * print the information yet.
  465|       |		 */
  466|  7.10k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (466:7): [True: 4, False: 7.09k]
  ------------------
  467|      4|			return -1;
  468|       |
  469|  7.09k|		rv = file_tryelf(ms, &b);
  470|  7.09k|		rbuf = file_pop_buffer(ms, pb);
  471|  7.09k|		if (rv == -1) {
  ------------------
  |  Branch (471:7): [True: 96, False: 7.00k]
  ------------------
  472|     96|			free(rbuf);
  473|     96|			rbuf = NULL;
  474|     96|		}
  475|  7.09k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  7.09k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (475:7): [True: 0, False: 7.09k]
  ------------------
  476|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  477|  7.09k|	}
  478|  12.9k|#endif
  479|       |
  480|       |	/* try soft magic tests */
  481|  12.9k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  12.9k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (481:6): [True: 12.9k, False: 0]
  ------------------
  482|  12.9k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  231|  12.9k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  483|  12.9k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (483:7): [True: 0, False: 12.9k]
  ------------------
  484|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  485|  12.9k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (485:7): [True: 10.0k, False: 2.87k]
  |  Branch (485:17): [True: 3.52k, False: 6.50k]
  ------------------
  486|  3.52k|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (486:8): [True: 28, False: 3.49k]
  ------------------
  487|     28|				goto done;
  488|  3.52k|		}
  489|  12.8k|		if (m) {
  ------------------
  |  Branch (489:7): [True: 10.1k, False: 2.72k]
  ------------------
  490|  10.1k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (490:8): [True: 0, False: 10.1k]
  ------------------
  491|      0|				goto done;
  492|  10.1k|		}
  493|  12.8k|	}
  494|       |
  495|       |	/* try text properties */
  496|  12.8k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  12.8k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (496:6): [True: 12.8k, False: 0]
  ------------------
  497|       |
  498|  12.8k|		m = file_ascmagic(ms, &b, looks_text);
  499|  12.8k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (499:7): [True: 0, False: 12.8k]
  ------------------
  500|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  501|  12.8k|		if (m) {
  ------------------
  |  Branch (501:7): [True: 1.99k, False: 10.8k]
  ------------------
  502|  1.99k|			goto done;
  503|  1.99k|		}
  504|  12.8k|	}
  505|       |
  506|  10.9k|simple:
  507|       |	/* give up */
  508|  10.9k|	if (m == 0) {
  ------------------
  |  Branch (508:6): [True: 10.9k, False: 0]
  ------------------
  509|  10.9k|		m = 1;
  510|  10.9k|		rv = file_default(ms, nb);
  511|  10.9k|		if (rv == 0)
  ------------------
  |  Branch (511:7): [True: 10.9k, False: 0]
  ------------------
  512|  10.9k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (512:8): [True: 0, False: 10.9k]
  ------------------
  513|      0|				rv = -1;
  514|  10.9k|	}
  515|  12.9k| done:
  516|  12.9k|	trim_separator(ms);
  517|  12.9k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  12.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (517:6): [True: 0, False: 12.9k]
  ------------------
  518|      0|		if (ms->flags & MAGIC_MIME_TYPE)
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (518:7): [True: 0, False: 0]
  ------------------
  519|      0|			if (file_printf(ms, "; charset=") == -1)
  ------------------
  |  Branch (519:8): [True: 0, False: 0]
  ------------------
  520|      0|				rv = -1;
  521|      0|		if (file_printf(ms, "%s", code_mime) == -1)
  ------------------
  |  Branch (521:7): [True: 0, False: 0]
  ------------------
  522|      0|			rv = -1;
  523|      0|	}
  524|  12.9k|#if HAVE_FORK
  525|  15.1k| done_encoding:
  526|  15.1k|#endif
  527|  15.1k|	free(rbuf);
  528|  15.1k|	buffer_fini(&b);
  529|  15.1k|	if (rv)
  ------------------
  |  Branch (529:6): [True: 28, False: 15.1k]
  ------------------
  530|     28|		return rv;
  531|       |
  532|  15.1k|	return m;
  533|  15.1k|}
file_reset:
  538|  10.3k|{
  539|  10.3k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (539:6): [True: 10.3k, False: 2]
  |  Branch (539:21): [True: 0, False: 10.3k]
  ------------------
  540|      0|		file_error(ms, 0, "no magic files loaded");
  541|      0|		return -1;
  542|      0|	}
  543|  10.3k|	file_clearbuf(ms);
  544|  10.3k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (544:6): [True: 9.99k, False: 341]
  ------------------
  545|  9.99k|		free(ms->o.pbuf);
  546|  9.99k|		ms->o.pbuf = NULL;
  547|  9.99k|	}
  548|  10.3k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  487|  10.3k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  549|  10.3k|	ms->error = -1;
  550|  10.3k|	return 0;
  551|  10.3k|}
file_getbuffer:
  563|  10.2k|{
  564|  10.2k|	char *pbuf, *op, *np;
  565|  10.2k|	size_t psize, len;
  566|       |
  567|  10.2k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|  10.2k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (567:6): [True: 274, False: 9.99k]
  ------------------
  568|    274|		return NULL;
  569|       |
  570|  9.99k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  9.99k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (570:6): [True: 0, False: 9.99k]
  ------------------
  571|      0|		return ms->o.buf;
  572|       |
  573|  9.99k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (573:6): [True: 0, False: 9.99k]
  ------------------
  574|      0|		return NULL;
  575|       |
  576|       |	/* * 4 is for octal representation, + 1 is for NUL */
  577|  9.99k|	len = strlen(ms->o.buf);
  578|  9.99k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (578:6): [True: 0, False: 9.99k]
  ------------------
  579|      0|		file_oomem(ms, len);
  580|      0|		return NULL;
  581|      0|	}
  582|  9.99k|	psize = len * 4 + 1;
  583|  9.99k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  452|  9.99k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (583:6): [True: 0, False: 9.99k]
  ------------------
  584|      0|		file_oomem(ms, psize);
  585|      0|		return NULL;
  586|      0|	}
  587|  9.99k|	ms->o.pbuf = pbuf;
  588|       |
  589|  9.99k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  590|  9.99k|	{
  591|  9.99k|		mbstate_t state;
  592|  9.99k|		wchar_t nextchar;
  593|  9.99k|		int mb_conv = 1;
  594|  9.99k|		size_t bytesconsumed;
  595|  9.99k|		char *eop;
  596|  9.99k|		(void)memset(&state, 0, sizeof(mbstate_t));
  597|       |
  598|  9.99k|		np = ms->o.pbuf;
  599|  9.99k|		op = ms->o.buf;
  600|  9.99k|		eop = op + len;
  601|       |
  602|  2.27M|		while (op < eop) {
  ------------------
  |  Branch (602:10): [True: 2.26M, False: 9.93k]
  ------------------
  603|  2.26M|			bytesconsumed = mbrtowc(&nextchar, op,
  604|  2.26M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  452|  2.26M|#define CAST(T, b)	((T)(b))
  ------------------
  605|  2.26M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  452|  4.52M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (605:8): [True: 68, False: 2.26M]
  ------------------
  606|  2.26M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  452|  2.26M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (606:8): [True: 0, False: 2.26M]
  ------------------
  607|     68|				mb_conv = 0;
  608|     68|				break;
  609|     68|			}
  610|       |
  611|  2.26M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (611:8): [True: 2.22M, False: 38.7k]
  ------------------
  612|  2.22M|				(void)memcpy(np, op, bytesconsumed);
  613|  2.22M|				op += bytesconsumed;
  614|  2.22M|				np += bytesconsumed;
  615|  2.22M|			} else {
  616|  77.4k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (616:12): [True: 38.7k, False: 38.7k]
  ------------------
  617|  38.7k|					OCTALIFY(np, op);
  ------------------
  |  |  555|  38.7k|	(void)(*(n)++ = '\\', \
  |  |  556|  38.7k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  452|  38.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  557|  38.7k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  38.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  558|  38.7k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  38.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  559|  38.7k|	(o)++)
  ------------------
  618|  38.7k|			}
  619|  2.26M|		}
  620|  9.99k|		*np = '\0';
  621|       |
  622|       |		/* Parsing succeeded as a multi-byte sequence */
  623|  9.99k|		if (mb_conv != 0)
  ------------------
  |  Branch (623:7): [True: 9.93k, False: 68]
  ------------------
  624|  9.93k|			return ms->o.pbuf;
  625|  9.99k|	}
  626|     68|#endif
  627|       |
  628|  20.6k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (628:40): [True: 20.5k, False: 68]
  ------------------
  629|  20.5k|		if (isprint(CAST(unsigned char, *op))) {
  ------------------
  |  Branch (629:7): [True: 19.4k, False: 1.14k]
  ------------------
  630|  19.4k|			*np++ = *op++;
  631|  19.4k|		} else {
  632|  1.14k|			OCTALIFY(np, op);
  ------------------
  |  |  555|  1.14k|	(void)(*(n)++ = '\\', \
  |  |  556|  1.14k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  452|  1.14k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  557|  1.14k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  1.14k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  558|  1.14k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  1.14k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  559|  1.14k|	(o)++)
  ------------------
  633|  1.14k|		}
  634|  20.5k|	}
  635|     68|	*np = '\0';
  636|     68|	return ms->o.pbuf;
  637|  9.99k|}
file_check_mem:
  641|   812k|{
  642|   812k|	size_t len;
  643|       |
  644|   812k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (644:6): [True: 1, False: 812k]
  ------------------
  645|      1|		len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
  646|      1|		ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
  ------------------
  |  |  452|      2|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  647|      1|		    malloc(len) :
  648|      1|		    realloc(ms->c.li, len));
  649|      1|		if (ms->c.li == NULL) {
  ------------------
  |  Branch (649:7): [True: 0, False: 1]
  ------------------
  650|      0|			file_oomem(ms, len);
  651|      0|			return -1;
  652|      0|		}
  653|      1|	}
  654|   812k|	ms->c.li[level].got_match = 0;
  655|   812k|#ifdef ENABLE_CONDITIONALS
  656|   812k|	ms->c.li[level].last_match = 0;
  657|   812k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  360|   812k|#define				COND_NONE	0
  ------------------
  658|   812k|#endif /* ENABLE_CONDITIONALS */
  659|   812k|	return 0;
  660|   812k|}
file_printedlen:
  664|  1.99k|{
  665|  1.99k|	return ms->o.blen;
  666|  1.99k|}
file_replace:
  670|  1.26k|{
  671|  1.26k|	file_regex_t rx;
  672|  1.26k|	int nm;
  673|  1.26k|	regmatch_t rm;
  674|       |
  675|  1.26k|	nm = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  676|  1.26k|	if (nm != 0)
  ------------------
  |  Branch (676:6): [True: 0, False: 1.26k]
  ------------------
  677|      0|		return -1;
  678|       |
  679|  1.36k|	while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (679:9): [True: 95, False: 1.26k]
  ------------------
  680|     95|		ms->o.buf[rm.rm_so] = '\0';
  681|     95|		if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (681:7): [True: 0, False: 95]
  ------------------
  682|     95|		    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (682:7): [True: 95, False: 0]
  ------------------
  683|      0|			goto out;
  684|     95|		nm++;
  685|     95|	}
  686|  1.26k|out:
  687|  1.26k|	file_regfree(&rx);
  688|  1.26k|	return nm;
  689|  1.26k|}
file_regcomp:
  748|  30.6k|{
  749|  30.6k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (749:6): [True: 0, False: 30.6k]
  ------------------
  750|      0|		return -1;
  751|       |
  752|  30.6k|#ifdef USE_C_LOCALE
  753|  30.6k|	locale_t old = uselocale(ms->c_lc_ctype);
  754|  30.6k|	assert(old != NULL);
  ------------------
  |  Branch (754:2): [True: 0, False: 30.6k]
  |  Branch (754:2): [True: 30.6k, False: 0]
  ------------------
  755|       |#else
  756|       |	char old[1024];
  757|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  758|       |	(void)setlocale(LC_CTYPE, "C");
  759|       |#endif
  760|  30.6k|	int rc;
  761|  30.6k|	rc = regcomp(rx, pat, flags);
  762|       |
  763|  30.6k|#ifdef USE_C_LOCALE
  764|  30.6k|	uselocale(old);
  765|       |#else
  766|       |	(void)setlocale(LC_CTYPE, old);
  767|       |#endif
  768|  30.6k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (768:6): [True: 0, False: 30.6k]
  |  Branch (768:16): [True: 0, False: 0]
  ------------------
  769|      0|		char errmsg[512], buf[512];
  770|       |
  771|      0|		(void)regerror(rc, rx, errmsg, sizeof(errmsg));
  772|      0|		file_magerror(ms, "regex error %d for `%s', (%s)", rc, 
  773|      0|		    file_printable(ms, buf, sizeof(buf), pat, strlen(pat)),
  774|      0|		    errmsg);
  775|      0|	}
  776|  30.6k|	return rc;
  777|  30.6k|}
file_regexec:
  783|   290k|{
  784|   290k|#ifdef USE_C_LOCALE
  785|   290k|	locale_t old = uselocale(ms->c_lc_ctype);
  786|   290k|	assert(old != NULL);
  ------------------
  |  Branch (786:2): [True: 0, False: 290k]
  |  Branch (786:2): [True: 290k, False: 0]
  ------------------
  787|       |#else
  788|       |	char old[1024];
  789|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  790|       |	(void)setlocale(LC_CTYPE, "C");
  791|       |#endif
  792|   290k|	int rc;
  793|       |	/* XXX: force initialization because glibc does not always do this */
  794|   290k|	if (nmatch != 0)
  ------------------
  |  Branch (794:6): [True: 261k, False: 29.2k]
  ------------------
  795|   261k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  796|   290k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  797|   290k|#ifdef USE_C_LOCALE
  798|   290k|	uselocale(old);
  799|       |#else
  800|       |	(void)setlocale(LC_CTYPE, old);
  801|       |#endif
  802|   290k|	return rc;
  803|   290k|}
file_regfree:
  807|  30.4k|{
  808|  30.4k|	regfree(rx);
  809|  30.4k|}
file_push_buffer:
  813|  25.2k|{
  814|  25.2k|	file_pushbuf_t *pb;
  815|       |
  816|  25.2k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|  25.2k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (816:6): [True: 65, False: 25.2k]
  ------------------
  817|     65|		return NULL;
  818|       |
  819|  25.2k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  452|  25.2k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (819:6): [True: 0, False: 25.2k]
  ------------------
  820|      0|		return NULL;
  821|       |
  822|  25.2k|	pb->buf = ms->o.buf;
  823|  25.2k|	pb->blen = ms->o.blen;
  824|  25.2k|	pb->offset = ms->offset;
  825|       |
  826|  25.2k|	ms->o.buf = NULL;
  827|  25.2k|	ms->o.blen = 0;
  828|  25.2k|	ms->offset = 0;
  829|       |
  830|  25.2k|	return pb;
  831|  25.2k|}
file_pop_buffer:
  835|  25.2k|{
  836|  25.2k|	char *rbuf;
  837|       |
  838|  25.2k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  487|  25.2k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (838:6): [True: 1.04k, False: 24.1k]
  ------------------
  839|  1.04k|		free(pb->buf);
  840|  1.04k|		free(pb);
  841|  1.04k|		return NULL;
  842|  1.04k|	}
  843|       |
  844|  24.1k|	rbuf = ms->o.buf;
  845|       |
  846|  24.1k|	ms->o.buf = pb->buf;
  847|  24.1k|	ms->o.blen = pb->blen;
  848|  24.1k|	ms->offset = pb->offset;
  849|       |
  850|  24.1k|	free(pb);
  851|  24.1k|	return rbuf;
  852|  25.2k|}
file_printable:
  860|  38.5k|{
  861|  38.5k|	char *ptr, *eptr = buf + bufsiz - 1;
  862|  38.5k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  453|  38.5k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  863|  38.5k|	const unsigned char *es = s + slen;
  864|       |
  865|   293k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (865:19): [True: 293k, False: 58]
  |  Branch (865:33): [True: 292k, False: 464]
  |  Branch (865:43): [True: 255k, False: 37.9k]
  ------------------
  866|   255k|		if ((ms->flags & MAGIC_RAW) != 0 || isprint(*s)) {
  ------------------
  |  |   41|   255k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (866:7): [True: 0, False: 255k]
  |  Branch (866:39): [True: 115k, False: 139k]
  ------------------
  867|   115k|			*ptr++ = *s;
  868|   115k|			continue;
  869|   115k|		}
  870|   139k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (870:7): [True: 67, False: 139k]
  ------------------
  871|     67|			break;
  872|   139k|		*ptr++ = '\\';
  873|   139k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  452|   139k|#define CAST(T, b)	((T)(b))
  ------------------
  874|   139k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  452|   139k|#define CAST(T, b)	((T)(b))
  ------------------
  875|   139k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  452|   139k|#define CAST(T, b)	((T)(b))
  ------------------
  876|   139k|	}
  877|  38.5k|	*ptr = '\0';
  878|  38.5k|	return buf;
  879|  38.5k|}
file_print_leguid:
  979|    337|{
  980|    337|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  452|    337|#define CAST(T, b)	((T)(b))
  ------------------
  981|    337|	    CAST(const void *, guid));
  982|    337|	return file_print_guid(str, len, g);
  983|    337|}
file_print_beguid:
  987|     18|{
  988|     18|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  452|     18|#define CAST(T, b)	((T)(b))
  ------------------
  989|     18|	    CAST(const void *, guid));
  990|     18|	struct guid gg = *g;
  991|     18|	gg.data1 = file_swap4(gg.data1);
  ------------------
  |  |   38|     18|#define file_swap4(x)	bswap_32(x)
  ------------------
  992|     18|	gg.data2 = file_swap2(gg.data2);
  ------------------
  |  |   37|     18|#define file_swap2(x)	bswap_16(x)
  ------------------
  993|       |	gg.data3 = file_swap2(gg.data3);
  ------------------
  |  |   37|     18|#define file_swap2(x)	bswap_16(x)
  ------------------
  994|     18|	return file_print_guid(str, len, &gg);
  995|     18|}
file_pipe_closexec:
  999|  4.93k|{
 1000|       |#ifdef __MINGW32__
 1001|       |	return 0;
 1002|       |#elif defined(HAVE_PIPE2)
 1003|  4.93k|	return pipe2(fds, O_CLOEXEC);
 1004|       |#else
 1005|       |	if (pipe(fds) == -1)
 1006|       |		return -1;
 1007|       |# ifdef F_SETFD
 1008|       |	(void)fcntl(fds[0], F_SETFD, FD_CLOEXEC);
 1009|       |	(void)fcntl(fds[1], F_SETFD, FD_CLOEXEC);
 1010|       |# endif
 1011|       |	return 0;
 1012|       |#endif
 1013|  4.93k|}
file_clear_closexec:
 1016|  7.39k|file_clear_closexec(int fd) {
 1017|  7.39k|#ifdef F_SETFD
 1018|  7.39k|	return fcntl(fd, F_SETFD, 0);
 1019|       |#else
 1020|       |	return 0;
 1021|       |#endif
 1022|  7.39k|}
file_strtrim:
 1026|    390|{
 1027|    390|	char *last;
 1028|       |
 1029|    390|	while (isspace(CAST(unsigned char, *str)))
  ------------------
  |  Branch (1029:9): [True: 298, False: 390]
  ------------------
 1030|    298|		str++;
 1031|    390|	last = str;
 1032|  2.50k|	while (*last)
  ------------------
  |  Branch (1032:9): [True: 2.11k, False: 390]
  ------------------
 1033|  2.11k|		last++;
 1034|    390|	if (last == str)
  ------------------
  |  Branch (1034:6): [True: 121, False: 269]
  ------------------
 1035|    121|		return str;
 1036|    269|	--last;
 1037|    269|	while (isspace(CAST(unsigned char, *last)))
  ------------------
  |  Branch (1037:9): [True: 267, False: 269]
  ------------------
 1038|    267|		last--;
 1039|    269|	*++last = '\0';
 1040|    269|	return str;
 1041|    390|}
funcs.c:file_checkfield:
   89|   158k|{
   90|   158k|	const char *p = *pp;
   91|   158k|	int fw = 0;
   92|       |
   93|   166k|	while (*p && isdigit((unsigned char)*p)) {
  ------------------
  |  Branch (93:9): [True: 166k, False: 0]
  |  Branch (93:15): [True: 7.88k, False: 158k]
  ------------------
   94|  7.88k|		fw = fw * 10 + (*p++ - '0');
   95|  7.88k|		if (fw > 1024)
  ------------------
  |  Branch (95:7): [True: 0, False: 7.88k]
  ------------------
   96|      0|			break;
   97|  7.88k|	}
   98|       |
   99|   158k|	*pp = p;
  100|       |
  101|   158k|	if (fw < 1024)
  ------------------
  |  Branch (101:6): [True: 158k, False: 0]
  ------------------
  102|   158k|		return 1;
  103|      0|	if (msg)
  ------------------
  |  Branch (103:6): [True: 0, False: 0]
  ------------------
  104|      0|		snprintf(msg, mlen, "field %s too large: %d", what, fw);
  105|       |
  106|      0|	return 0;
  107|   158k|}
funcs.c:file_clearbuf:
   81|  10.5k|{
   82|  10.5k|	free(ms->o.buf);
   83|       |	ms->o.buf = NULL;
   84|  10.5k|	ms->o.blen = 0;
   85|  10.5k|}
funcs.c:file_error_core:
  216|    343|{
  217|       |	/* Only the first error is ok */
  218|    343|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|    343|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (218:6): [True: 4, False: 339]
  ------------------
  219|      4|		return;
  220|    339|	if (lineno != 0) {
  ------------------
  |  Branch (220:6): [True: 48, False: 291]
  ------------------
  221|     48|		file_clearbuf(ms);
  222|     48|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  223|     48|	}
  224|    339|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (224:6): [True: 150, False: 189]
  |  Branch (224:19): [True: 150, False: 0]
  ------------------
  225|    150|		(void)file_printf(ms, " ");
  226|    339|	(void)file_vprintf(ms, f, va);
  227|    339|	if (error > 0)
  ------------------
  |  Branch (227:6): [True: 94, False: 245]
  ------------------
  228|     94|		(void)file_printf(ms, " (%s)", strerror(error));
  229|    339|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  487|    339|#define 		EVENT_HAD_ERR		0x01
  ------------------
  230|    339|	ms->error = error;
  231|    339|}
funcs.c:checkdone:
  305|  11.6k|{
  306|  11.6k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  11.6k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (306:6): [True: 0, False: 11.6k]
  ------------------
  307|      0|		return 1;
  308|  11.6k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (308:6): [True: 0, False: 11.6k]
  ------------------
  309|      0|		*rv = -1;
  310|  11.6k|	return 0;
  311|  11.6k|}
funcs.c:trim_separator:
  286|  12.9k|{
  287|  12.9k|	size_t l;
  288|       |
  289|  12.9k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (289:6): [True: 0, False: 12.9k]
  ------------------
  290|      0|		return;
  291|       |
  292|  12.9k|	l = strlen(ms->o.buf);
  293|  12.9k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  276|  12.9k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (293:6): [True: 0, False: 12.9k]
  ------------------
  294|      0|		return;
  295|       |
  296|  12.9k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  276|  12.9k|#define FILE_SEPARATOR "\n- "
  ------------------
  297|  12.9k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  276|  12.9k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (297:6): [True: 12.9k, False: 0]
  ------------------
  298|  12.9k|		return;
  299|       |
  300|      0|	ms->o.buf[l] = '\0';
  301|      0|}
funcs.c:check_regex:
  693|  30.6k|{
  694|  30.6k|	char sbuf[512];
  695|  30.6k|	unsigned char oc = '\0';
  696|  30.6k|	const char *p;
  697|  30.6k|	unsigned long l;
  698|  30.6k|	static const char wild[] = "?*+{";
  699|       |
  700|   370k|	for (p = pat; *p; p++) {
  ------------------
  |  Branch (700:16): [True: 339k, False: 30.6k]
  ------------------
  701|   339k|		unsigned char c = *p;
  702|       |		// Avoid repetition of wild characters
  703|   339k|		if (strchr(wild, oc) != NULL && strchr(wild, c) != NULL) {
  ------------------
  |  Branch (703:7): [True: 60.0k, False: 279k]
  |  Branch (703:35): [True: 0, False: 60.0k]
  ------------------
  704|      0|			size_t len = strlen(pat);
  705|      0|			file_magwarn(ms,
  706|      0|			    "repetition-operator operand `%c%c' "
  707|      0|			    "invalid in regex `%s'", oc, c,
  708|      0|			    file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  709|      0|			return -1;
  710|      0|		}
  711|   339k|		if (c == '{') {
  ------------------
  |  Branch (711:7): [True: 66, False: 339k]
  ------------------
  712|     66|			char *ep, *eep;
  713|       |
  714|     66|			if (oc == '}') {
  ------------------
  |  Branch (714:8): [True: 0, False: 66]
  ------------------
  715|      0|				file_magwarn(ms, "cascading repetition "
  716|      0|				    "operators in regex `%s'", pat);
  717|      0|				return -1;
  718|      0|			}
  719|     66|			errno = 0;
  720|     66|			l = strtoul(p + 1, &ep, 10);
  721|     66|			if (ep != p + 1 && l > 1000)
  ------------------
  |  Branch (721:8): [True: 42, False: 24]
  |  Branch (721:23): [True: 0, False: 42]
  ------------------
  722|      0|				goto bounds;
  723|     66|			if (*ep == ',') {
  ------------------
  |  Branch (723:8): [True: 26, False: 40]
  ------------------
  724|     26|				l = strtoul(ep + 1, &eep, 10);
  725|     26|				if (eep != ep + 1 && l > 1000)
  ------------------
  |  Branch (725:9): [True: 26, False: 0]
  |  Branch (725:26): [True: 0, False: 26]
  ------------------
  726|      0|					goto bounds;
  727|     26|			}
  728|     66|		}
  729|   339k|		oc = c;
  730|   339k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (730:7): [True: 339k, False: 145]
  |  Branch (730:21): [True: 141, False: 4]
  |  Branch (730:35): [True: 3, False: 1]
  ------------------
  731|      1|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (731:10): [True: 1, False: 0]
  ------------------
  732|   339k|			continue;
  733|      0|		size_t len = strlen(pat);
  734|      0|		file_magwarn(ms,
  735|      0|		    "non-ascii characters in regex \\%#o `%s'",
  736|      0|		    c, file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  737|      0|		return -1;
  738|   339k|	}
  739|  30.6k|	return 0;
  740|      0|bounds:
  741|      0|	file_magwarn(ms, "bounds too large %ld in regex `%s'", l, pat);
  742|      0|	return -1;
  743|  30.6k|}
funcs.c:file_print_guid:
  961|    355|{
  962|    355|#ifndef WIN32
  963|    355|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  964|    355|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  965|    355|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  966|    355|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  967|    355|	    g->data4[6], g->data4[7]);
  968|       |#else
  969|       |	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hX%.2hX-"
  970|       |	    "%.2hX%.2hX%.2hX%.2hX%.2hX%.2hX",
  971|       |	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  972|       |	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  973|       |	    g->data4[6], g->data4[7]);
  974|       |#endif
  975|    355|}

file_is_csv:
  137|  12.9k|{
  138|  12.9k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
  139|  12.9k|	const unsigned char *ue = uc + b->flen;
  140|  12.9k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  141|       |
  142|  12.9k|	if (!looks_text)
  ------------------
  |  Branch (142:6): [True: 11.0k, False: 1.87k]
  ------------------
  143|  11.0k|		return 0;
  144|       |
  145|  1.87k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  1.87k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  1.87k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (145:6): [True: 0, False: 1.87k]
  ------------------
  146|      0|		return 0;
  147|       |
  148|  1.87k|	if (!csv_parse(uc, ue))
  ------------------
  |  Branch (148:6): [True: 1.86k, False: 10]
  ------------------
  149|  1.86k|		return 0;
  150|       |
  151|     10|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     10|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (151:6): [True: 0, False: 10]
  ------------------
  152|      0|		return 1;
  153|       |
  154|     10|	if (mime) {
  ------------------
  |  Branch (154:6): [True: 0, False: 10]
  ------------------
  155|      0|		if (file_printf(ms, "text/csv") == -1)
  ------------------
  |  Branch (155:7): [True: 0, False: 0]
  ------------------
  156|      0|			return -1;
  157|      0|		return 1;
  158|      0|	}
  159|       |
  160|     10|	if (file_printf(ms, "CSV %s%stext", code ? code : "",
  ------------------
  |  Branch (160:6): [True: 0, False: 10]
  |  Branch (160:38): [True: 10, False: 0]
  ------------------
  161|     10|	    code ? " " : "") == -1)
  ------------------
  |  Branch (161:6): [True: 10, False: 0]
  ------------------
  162|      0|		return -1;
  163|       |
  164|     10|	return 1;
  165|     10|}
is_csv.c:csv_parse:
   94|  1.87k|{
   95|  1.87k|	size_t nf = 0, tf = 0, nl = 0;
   96|       |
   97|   170M|	while (uc < ue) {
  ------------------
  |  Branch (97:9): [True: 170M, False: 1.72k]
  ------------------
   98|   170M|		switch (*uc++) {
   99|   784k|		case '"':
  ------------------
  |  Branch (99:3): [True: 784k, False: 169M]
  ------------------
  100|       |			// Eat until the matching quote
  101|   784k|			uc = eatquote(uc, ue);
  102|   784k|			break;
  103|  2.82M|		case ',':
  ------------------
  |  Branch (103:3): [True: 2.82M, False: 167M]
  ------------------
  104|  2.82M|			nf++;
  105|  2.82M|			break;
  106|    292|		case '\n':
  ------------------
  |  Branch (106:3): [True: 292, False: 170M]
  ------------------
  107|    292|			DPRINTF("nl=%zu nf=%zu tf=%zu\n", nl, nf, tf);
  108|    292|			nl++;
  109|    292|#if CSV_LINES
  110|    292|			if (nl == CSV_LINES)
  ------------------
  |  |   62|    292|#define CSV_LINES 10
  ------------------
  |  Branch (110:8): [True: 6, False: 286]
  ------------------
  111|      6|				return tf > 1 && tf == nf;
  ------------------
  |  Branch (111:12): [True: 3, False: 3]
  |  Branch (111:22): [True: 3, False: 0]
  ------------------
  112|    286|#endif
  113|    286|			if (tf == 0) {
  ------------------
  |  Branch (113:8): [True: 178, False: 108]
  ------------------
  114|       |				// First time and no fields, give up
  115|    178|				if (nf == 0) 
  ------------------
  |  Branch (115:9): [True: 122, False: 56]
  ------------------
  116|    122|					return 0;
  117|       |				// First time, set the number of fields
  118|     56|				tf = nf;
  119|    108|			} else if (tf != nf) {
  ------------------
  |  Branch (119:15): [True: 25, False: 83]
  ------------------
  120|       |				// Field number mismatch, we are done.
  121|     25|				return 0;
  122|     25|			}
  123|    139|			nf = 0;
  124|    139|			break;
  125|   166M|		default:
  ------------------
  |  Branch (125:3): [True: 166M, False: 3.60M]
  ------------------
  126|   166M|			break;
  127|   170M|		}
  128|   170M|	}
  129|  1.72k|	DPRINTF("tf=%zu>1 nl=%zu>=2\n", tf, nl);
  130|  1.72k|	return tf >= 1 && nl >= 2;
  ------------------
  |  Branch (130:9): [True: 25, False: 1.69k]
  |  Branch (130:20): [True: 7, False: 18]
  ------------------
  131|  1.87k|}
is_csv.c:eatquote:
   69|   784k|{
   70|   784k|	int quote = 0;
   71|       |
   72|  6.73M|	while (uc < ue) {
  ------------------
  |  Branch (72:9): [True: 6.73M, False: 178]
  ------------------
   73|  6.73M|		unsigned char c = *uc++;
   74|  6.73M|		if (c != '"') {
  ------------------
  |  Branch (74:7): [True: 5.81M, False: 924k]
  ------------------
   75|       |			// We already got one, done.
   76|  5.81M|			if (quote) {
  ------------------
  |  Branch (76:8): [True: 784k, False: 5.02M]
  ------------------
   77|   784k|				return --uc;
   78|   784k|			}
   79|  5.02M|			continue;
   80|  5.81M|		}
   81|   924k|		if (quote) {
  ------------------
  |  Branch (81:7): [True: 70.3k, False: 854k]
  ------------------
   82|       |			// quote-quote escapes
   83|  70.3k|			quote = 0;
   84|  70.3k|			continue;
   85|  70.3k|		}
   86|       |		// first quote
   87|   854k|		quote = 1;
   88|   854k|	}
   89|    178|	return ue;
   90|   784k|}

file_is_json:
  423|  12.9k|{
  424|  12.9k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  12.9k|	const unsigned char *ue = uc + b->flen;
  426|  12.9k|	size_t st[JSON_MAX];
  427|  12.9k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  12.9k|	int jt;
  429|       |
  430|       |
  431|  12.9k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  12.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  12.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 12.9k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  12.9k|	memset(st, 0, sizeof(st));
  435|       |
  436|  12.9k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 12.8k, False: 30]
  ------------------
  437|  12.8k|		return 0;
  438|       |
  439|     30|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     30|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 30]
  ------------------
  440|      0|		return 1;
  441|     30|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 30]
  ------------------
  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|     30|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 30]
  ------------------
  448|     30|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 18, False: 12]
  ------------------
  449|      0|		return -1;
  450|       |#if JSON_COUNT
  451|       |#define P(n) st[n], st[n] > 1 ? "s" : ""
  452|       |	if (file_printf(ms, " (%" SIZE_T_FORMAT "u object%s, %" SIZE_T_FORMAT
  453|       |	    "u array%s, %" SIZE_T_FORMAT "u string%s, %" SIZE_T_FORMAT
  454|       |	    "u constant%s, %" SIZE_T_FORMAT "u number%s, %" SIZE_T_FORMAT
  455|       |	    "u >1array%s)",
  456|       |	    P(JSON_OBJECT), P(JSON_ARRAY), P(JSON_STRING), P(JSON_CONSTANT),
  457|       |	    P(JSON_NUMBER), P(JSON_ARRAYN))
  458|       |	    == -1)
  459|       |		return -1;
  460|       |#endif
  461|     30|	return 1;
  462|     30|}
is_json.c:json_parse:
  348|  46.8k|{
  349|  46.8k|	const unsigned char *uc, *ouc;
  350|  46.8k|	int rv = 0;
  351|  46.8k|	int t;
  352|       |
  353|  46.8k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  46.8k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 95, False: 46.7k]
  ------------------
  355|     95|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  46.7k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 1, False: 46.7k]
  ------------------
  359|      1|		DPRINTF("Too many levels", uc, *ucp);
  ------------------
  |  |   52|      1|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1]
  |  |  ------------------
  ------------------
  360|      1|		return 0;
  361|      1|	}
  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|  46.7k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  46.7k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 46.7k]
  |  |  ------------------
  ------------------
  369|  46.7k|	switch (*uc++) {
  370|  18.4k|	case '"':
  ------------------
  |  Branch (370:2): [True: 18.4k, False: 28.3k]
  ------------------
  371|  18.4k|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|  18.4k|		t = JSON_STRING;
  ------------------
  |  |   60|  18.4k|#define JSON_STRING	4
  ------------------
  373|  18.4k|		break;
  374|  7.53k|	case '[':
  ------------------
  |  Branch (374:2): [True: 7.53k, False: 39.2k]
  ------------------
  375|  7.53k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  7.53k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  7.53k|#define JSON_ARRAY	0
  ------------------
  377|  7.53k|		break;
  378|  5.90k|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 5.90k, False: 40.8k]
  ------------------
  379|  5.90k|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|  5.90k|		t = JSON_OBJECT;
  ------------------
  |  |   59|  5.90k|#define JSON_OBJECT	3
  ------------------
  381|  5.90k|		break;
  382|    310|	case 't':
  ------------------
  |  Branch (382:2): [True: 310, False: 46.4k]
  ------------------
  383|    310|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    310|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    310|#define JSON_CONSTANT	1
  ------------------
  385|    310|		break;
  386|    390|	case 'f':
  ------------------
  |  Branch (386:2): [True: 390, False: 46.3k]
  ------------------
  387|    390|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    390|		    lvl + 1);
  389|    390|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    390|#define JSON_CONSTANT	1
  ------------------
  390|    390|		break;
  391|    144|	case 'n':
  ------------------
  |  Branch (391:2): [True: 144, False: 46.6k]
  ------------------
  392|    144|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    144|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    144|#define JSON_CONSTANT	1
  ------------------
  394|    144|		break;
  395|  14.0k|	default:
  ------------------
  |  Branch (395:2): [True: 14.0k, False: 32.7k]
  ------------------
  396|  14.0k|		--uc;
  397|  14.0k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  14.0k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  14.0k|#define JSON_NUMBER	2
  ------------------
  399|  14.0k|		break;
  400|  46.7k|	}
  401|  46.7k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 31.4k, False: 15.2k]
  ------------------
  402|  31.4k|		st[t]++;
  403|  46.7k|	uc = json_skip_space(uc, ue);
  404|  46.8k|out:
  405|  46.8k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  46.8k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 46.8k]
  |  |  ------------------
  ------------------
  406|  46.8k|	*ucp = uc;
  407|  46.8k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 12.9k, False: 33.9k]
  ------------------
  408|  12.9k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 12.5k, False: 364]
  ------------------
  409|  12.5k|			return 0;
  410|    364|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 88, False: 276]
  ------------------
  411|     88|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|     88|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     75|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 13, False: 75]
  |  Branch (411:31): [True: 5, False: 70]
  ------------------
  412|    276|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 52, False: 224]
  |  Branch (412:22): [True: 41, False: 11]
  ------------------
  413|     41|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     41|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     30|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 11, False: 30]
  |  Branch (413:31): [True: 1, False: 29]
  ------------------
  414|    235|		else
  415|    235|			return 0;
  416|    276|	}
  417|  33.9k|	return rv;
  418|  46.8k|}
is_json.c:json_skip_space:
  119|   156k|{
  120|  38.9M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 38.9M, False: 2.62k]
  |  Branch (120:20): [True: 38.7M, False: 154k]
  ------------------
  121|  38.7M|		uc++;
  122|   156k|	return uc;
  123|   156k|}
is_json.c:json_isspace:
   79|  38.9M|{
   80|  38.9M|	switch (uc) {
   81|  7.75M|	case ' ':
  ------------------
  |  Branch (81:2): [True: 7.75M, False: 31.1M]
  ------------------
   82|  32.3M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 24.6M, False: 14.3M]
  ------------------
   83|  37.8M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 5.48M, False: 33.4M]
  ------------------
   84|  38.7M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 916k, False: 38.0M]
  ------------------
   85|  38.7M|		return 1;
   86|   154k|	default:
  ------------------
  |  Branch (86:2): [True: 154k, False: 38.7M]
  ------------------
   87|   154k|		return 0;
   88|  38.9M|	}
   89|  38.9M|}
is_json.c:json_parse_string:
  129|  41.6k|{
  130|  41.6k|	const unsigned char *uc = *ucp;
  131|  41.6k|	size_t i;
  132|       |
  133|  41.6k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  41.6k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 41.6k]
  |  |  ------------------
  ------------------
  134|  11.3M|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 11.3M, False: 98]
  ------------------
  135|  11.3M|		switch (*uc++) {
  136|     10|		case '\0':
  ------------------
  |  Branch (136:3): [True: 10, False: 11.3M]
  ------------------
  137|     10|			goto out;
  138|  3.48M|		case '\\':
  ------------------
  |  Branch (138:3): [True: 3.48M, False: 7.82M]
  ------------------
  139|  3.48M|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 18, False: 3.48M]
  ------------------
  140|     18|				goto out;
  141|  3.48M|			switch (*uc++) {
  142|      5|			case '\0':
  ------------------
  |  Branch (142:4): [True: 5, False: 3.48M]
  ------------------
  143|      5|				goto out;
  144|  1.53M|			case '"':
  ------------------
  |  Branch (144:4): [True: 1.53M, False: 1.95M]
  ------------------
  145|  3.48M|			case '\\':
  ------------------
  |  Branch (145:4): [True: 1.95M, False: 1.53M]
  ------------------
  146|  3.48M|			case '/':
  ------------------
  |  Branch (146:4): [True: 223, False: 3.48M]
  ------------------
  147|  3.48M|			case 'b':
  ------------------
  |  Branch (147:4): [True: 680, False: 3.48M]
  ------------------
  148|  3.48M|			case 'f':
  ------------------
  |  Branch (148:4): [True: 203, False: 3.48M]
  ------------------
  149|  3.48M|			case 'n':
  ------------------
  |  Branch (149:4): [True: 534, False: 3.48M]
  ------------------
  150|  3.48M|			case 'r':
  ------------------
  |  Branch (150:4): [True: 223, False: 3.48M]
  ------------------
  151|  3.48M|			case 't':
  ------------------
  |  Branch (151:4): [True: 196, False: 3.48M]
  ------------------
  152|  3.48M|				continue;
  153|    586|			case 'u':
  ------------------
  |  Branch (153:4): [True: 586, False: 3.48M]
  ------------------
  154|    586|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 8, False: 578]
  ------------------
  155|      8|					uc = ue;
  156|      8|					goto out;
  157|      8|				}
  158|  2.81k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 2.26k, False: 552]
  ------------------
  159|  2.26k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 26, False: 2.23k]
  ------------------
  160|     26|						goto out;
  161|    552|				continue;
  162|    552|			default:
  ------------------
  |  Branch (162:4): [True: 20, False: 3.48M]
  ------------------
  163|     20|				goto out;
  164|  3.48M|			}
  165|  41.4k|		case '"':
  ------------------
  |  Branch (165:3): [True: 41.4k, False: 11.2M]
  ------------------
  166|  41.4k|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|  41.4k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 41.4k]
  |  |  ------------------
  ------------------
  167|  41.4k|			*ucp = uc;
  168|  41.4k|			return 1;
  169|  7.78M|		default:
  ------------------
  |  Branch (169:3): [True: 7.78M, False: 3.52M]
  ------------------
  170|  7.78M|			continue;
  171|  11.3M|		}
  172|  11.3M|	}
  173|    185|out:
  174|    185|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    185|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 185]
  |  |  ------------------
  ------------------
  175|    185|	*ucp = uc;
  176|    185|	return 0;
  177|  41.6k|}
is_json.c:json_isxdigit:
  105|  2.26k|{
  106|  2.26k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 262, False: 1.99k]
  ------------------
  107|    262|		return 1;
  108|  1.99k|	switch (uc) {
  109|  1.00k|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 249, False: 1.74k]
  |  Branch (109:12): [True: 421, False: 1.57k]
  |  Branch (109:22): [True: 109, False: 1.88k]
  |  Branch (109:32): [True: 36, False: 1.96k]
  |  Branch (109:42): [True: 89, False: 1.90k]
  |  Branch (109:52): [True: 96, False: 1.90k]
  ------------------
  110|  1.97k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 264, False: 1.73k]
  |  Branch (110:12): [True: 203, False: 1.79k]
  |  Branch (110:22): [True: 25, False: 1.97k]
  |  Branch (110:32): [True: 399, False: 1.59k]
  |  Branch (110:42): [True: 55, False: 1.94k]
  |  Branch (110:52): [True: 26, False: 1.97k]
  ------------------
  111|  1.97k|		return 1;
  112|     26|	default:
  ------------------
  |  Branch (112:2): [True: 26, False: 1.97k]
  ------------------
  113|     26|		return 0;
  114|  1.99k|	}
  115|  1.99k|}
is_json.c:json_isdigit:
   93|  39.9M|{
   94|  39.9M|	switch (uc) {
   95|  34.7M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 29.3M, False: 10.6M]
  |  Branch (95:12): [True: 5.38M, False: 34.5M]
  |  Branch (95:22): [True: 53.4k, False: 39.8M]
  |  Branch (95:32): [True: 32.6k, False: 39.9M]
  |  Branch (95:42): [True: 120, False: 39.9M]
  ------------------
   96|  39.9M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 5.12M, False: 34.8M]
  |  Branch (96:12): [True: 797, False: 39.9M]
  |  Branch (96:22): [True: 45, False: 39.9M]
  |  Branch (96:32): [True: 131, False: 39.9M]
  |  Branch (96:42): [True: 642, False: 39.9M]
  ------------------
   97|  39.9M|		return 1;
   98|  30.6k|	default:
  ------------------
  |  Branch (98:2): [True: 30.6k, False: 39.9M]
  ------------------
   99|  30.6k|		return 0;
  100|  39.9M|	}
  101|  39.9M|}
is_json.c:json_parse_array:
  182|  7.53k|{
  183|  7.53k|	const unsigned char *uc = *ucp;
  184|       |
  185|  7.53k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  7.53k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 7.53k]
  |  |  ------------------
  ------------------
  186|  11.6k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 11.6k, False: 44]
  ------------------
  187|  11.6k|		uc = json_skip_space(uc, ue);
  188|  11.6k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 11, False: 11.5k]
  ------------------
  189|     11|			goto out;
  190|  11.5k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 857, False: 10.7k]
  ------------------
  191|    857|			goto done;
  192|  10.7k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 2.60k, False: 8.12k]
  ------------------
  193|  2.60k|			goto out;
  194|  8.12k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 42, False: 8.08k]
  ------------------
  195|     42|			goto out;
  196|  8.08k|		switch (*uc) {
  197|  4.10k|		case ',':
  ------------------
  |  Branch (197:3): [True: 4.10k, False: 3.97k]
  ------------------
  198|  4.10k|			uc++;
  199|  4.10k|			continue;
  200|  3.96k|		case ']':
  ------------------
  |  Branch (200:3): [True: 3.96k, False: 4.11k]
  ------------------
  201|  4.82k|		done:
  202|  4.82k|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|  4.82k|#define JSON_ARRAYN	5
  ------------------
  203|  4.82k|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|  4.82k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 4.82k]
  |  |  ------------------
  ------------------
  204|  4.82k|			*ucp = uc + 1;
  205|  4.82k|			return 1;
  206|     12|		default:
  ------------------
  |  Branch (206:3): [True: 12, False: 8.07k]
  ------------------
  207|     12|			goto out;
  208|  8.08k|		}
  209|  8.08k|	}
  210|  2.71k|out:
  211|  2.71k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  2.71k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 2.71k]
  |  |  ------------------
  ------------------
  212|  2.71k|	*ucp = uc;
  213|  2.71k|	return 0;
  214|  7.53k|}
is_json.c:json_parse_object:
  219|  5.90k|{
  220|  5.90k|	const unsigned char *uc = *ucp;
  221|  5.90k|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|  5.90k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 5.90k]
  |  |  ------------------
  ------------------
  222|  28.2k|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 28.2k, False: 6]
  ------------------
  223|  28.2k|		uc = json_skip_space(uc, ue);
  224|  28.2k|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 12, False: 28.2k]
  ------------------
  225|     12|			goto out;
  226|  28.2k|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 4.99k, False: 23.2k]
  ------------------
  227|  4.99k|			uc++;
  228|  4.99k|			goto done;
  229|  4.99k|		}
  230|  23.2k|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 34, False: 23.2k]
  ------------------
  231|     34|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     34|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 34]
  |  |  ------------------
  ------------------
  232|     34|			goto out;
  233|     34|		}
  234|  23.2k|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|  23.2k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 23.2k]
  |  |  ------------------
  ------------------
  235|  23.2k|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 8, False: 23.2k]
  ------------------
  236|      8|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      8|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 8]
  |  |  ------------------
  ------------------
  237|      8|			goto out;
  238|      8|		}
  239|  23.2k|		uc = json_skip_space(uc, ue);
  240|  23.2k|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 9, False: 23.2k]
  ------------------
  241|      9|			goto out;
  242|  23.2k|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 23, False: 23.1k]
  ------------------
  243|     23|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|     23|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 23]
  |  |  ------------------
  ------------------
  244|     23|			goto out;
  245|     23|		}
  246|  23.1k|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 213, False: 22.9k]
  ------------------
  247|    213|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    213|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 213]
  |  |  ------------------
  ------------------
  248|    213|			goto out;
  249|    213|		}
  250|  22.9k|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 3, False: 22.9k]
  ------------------
  251|      3|			goto out;
  252|  22.9k|		switch (*uc++) {
  253|  22.3k|		case ',':
  ------------------
  |  Branch (253:3): [True: 22.3k, False: 610]
  ------------------
  254|  22.3k|			continue;
  255|    609|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 609, False: 22.3k]
  ------------------
  256|  5.59k|		done:
  257|  5.59k|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|  5.59k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 5.59k]
  |  |  ------------------
  ------------------
  258|  5.59k|			*ucp = uc;
  259|  5.59k|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 22.9k]
  ------------------
  261|      1|			DPRINTF("not more", uc, *ucp);
  ------------------
  |  |   52|      1|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1]
  |  |  ------------------
  ------------------
  262|      1|			*ucp = uc - 1;
  263|      1|			goto out;
  264|  22.9k|		}
  265|  22.9k|	}
  266|    309|out:
  267|    309|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    309|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 309]
  |  |  ------------------
  ------------------
  268|    309|	*ucp = uc;
  269|    309|	return 0;
  270|  5.90k|}
is_json.c:json_parse_const:
  328|    844|{
  329|    844|	const unsigned char *uc = *ucp;
  330|       |
  331|    844|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|    844|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 844]
  |  |  ------------------
  ------------------
  332|    844|	*ucp += --len - 1;
  333|    844|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 52, False: 792]
  ------------------
  334|     52|		*ucp = ue;
  335|  3.39k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 3.34k, False: 48]
  |  Branch (335:20): [True: 2.64k, False: 706]
  ------------------
  336|  2.64k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 90, False: 2.55k]
  ------------------
  337|     90|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     90|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 90]
  |  |  ------------------
  ------------------
  338|     90|			return 0;
  339|     90|		}
  340|  2.64k|	}
  341|    754|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|    754|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 754]
  |  |  ------------------
  ------------------
  342|    754|	return 1;
  343|    844|}
is_json.c:json_parse_number:
  276|  14.0k|{
  277|  14.0k|	const unsigned char *uc = *ucp;
  278|  14.0k|	int got = 0;
  279|       |
  280|  14.0k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  14.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
  281|  14.0k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 14.0k]
  ------------------
  282|      0|		return 0;
  283|  14.0k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 87, False: 13.9k]
  ------------------
  284|     87|		uc++;
  285|       |
  286|  36.7M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 36.7M, False: 44]
  ------------------
  287|  36.7M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 14.0k, False: 36.7M]
  ------------------
  288|  14.0k|			break;
  289|  36.7M|		got = 1;
  290|  36.7M|	}
  291|  14.0k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 44, False: 14.0k]
  ------------------
  292|     44|		goto out;
  293|  14.0k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 250, False: 13.7k]
  ------------------
  294|    250|		uc++;
  295|  1.72M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 1.72M, False: 19]
  ------------------
  296|  1.72M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 13.9k, False: 1.71M]
  ------------------
  297|  13.9k|			break;
  298|  1.71M|		got = 1;
  299|  1.71M|	}
  300|  14.0k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 19, False: 13.9k]
  ------------------
  301|     19|		goto out;
  302|  13.9k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 2.06k, False: 11.9k]
  |  Branch (302:14): [True: 573, False: 1.49k]
  |  Branch (302:28): [True: 121, False: 1.37k]
  ------------------
  303|    694|		uc++;
  304|    694|		got = 0;
  305|    694|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 10, False: 684]
  ------------------
  306|     10|			goto out;
  307|    684|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 22, False: 662]
  |  Branch (307:21): [True: 270, False: 392]
  ------------------
  308|    292|			uc++;
  309|  1.45M|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 1.45M, False: 26]
  ------------------
  310|  1.45M|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 658, False: 1.45M]
  ------------------
  311|    658|				break;
  312|  1.45M|			got = 1;
  313|  1.45M|		}
  314|    684|	}
  315|  14.0k|out:
  316|  14.0k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 11.9k, False: 2.07k]
  ------------------
  317|  11.9k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  11.9k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 11.9k]
  |  |  ------------------
  ------------------
  318|  2.07k|	else
  319|  2.07k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  2.07k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 2.07k]
  |  |  ------------------
  ------------------
  320|  14.0k|	*ucp = uc;
  321|  14.0k|	return got;
  322|  13.9k|}

file_is_simh:
  158|  12.9k|{
  159|  12.9k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
  160|  12.9k|	const unsigned char *ue = uc + b->flen;
  161|  12.9k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  162|       |
  163|  12.9k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  12.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  12.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (163:6): [True: 0, False: 12.9k]
  ------------------
  164|      0|		return 0;
  165|       |
  166|  12.9k|	if (!simh_parse(uc, ue))
  ------------------
  |  Branch (166:6): [True: 12.8k, False: 25]
  ------------------
  167|  12.8k|		return 0;
  168|       |
  169|     25|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     25|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (169:6): [True: 0, False: 25]
  ------------------
  170|      0|		return 1;
  171|       |
  172|     25|	if (mime) {
  ------------------
  |  Branch (172:6): [True: 0, False: 25]
  ------------------
  173|      0|		if (file_printf(ms, "application/SIMH-tape-data") == -1)
  ------------------
  |  Branch (173:7): [True: 0, False: 0]
  ------------------
  174|      0|			return -1;
  175|      0|		return 1;
  176|      0|	}
  177|       |
  178|     25|	if (file_printf(ms, "SIMH tape data") == -1)
  ------------------
  |  Branch (178:6): [True: 0, False: 25]
  ------------------
  179|      0|		return -1;
  180|       |
  181|     25|	return 1;
  182|     25|}
is_simh.c:simh_parse:
  114|  12.9k|{
  115|  12.9k|	uint32_t nbytes, cbytes;
  116|  12.9k|	const unsigned char *orig_uc = uc;
  117|  12.9k|	size_t nt = 0, nr = 0;
  118|  12.9k|	int err = 0;
  119|       |
  120|  12.9k|	(void)memcpy(simh_bo.s, "\01\02\03\04", 4);
  121|       |
  122|  16.9k|	while (ue - uc >= CAST(ptrdiff_t, sizeof(nbytes))) {
  ------------------
  |  |  452|  16.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (122:9): [True: 16.2k, False: 727]
  ------------------
  123|  16.2k|		nbytes = getlen(&uc, &err);
  124|  16.2k|		if (err)
  ------------------
  |  Branch (124:7): [True: 9.08k, False: 7.11k]
  ------------------
  125|  9.08k|			return 0;
  126|  7.11k|		if ((nt > 0 || nr > 0) && nbytes == 0xFFFFFFFF)
  ------------------
  |  Branch (126:8): [True: 2.73k, False: 4.38k]
  |  Branch (126:18): [True: 1.24k, False: 3.13k]
  |  Branch (126:29): [True: 3, False: 3.97k]
  ------------------
  127|       |			/* EOM after at least one record or tapemark */
  128|      3|			break;
  129|  7.11k|		if (nbytes == 0) {
  ------------------
  |  Branch (129:7): [True: 1.17k, False: 5.94k]
  ------------------
  130|  1.17k|			nt++;	/* count tapemarks */
  131|  1.17k|#if SIMH_TAPEMARKS
  132|  1.17k|			if (nt == SIMH_TAPEMARKS)
  ------------------
  |  |   65|  1.17k|#define SIMH_TAPEMARKS 10
  ------------------
  |  Branch (132:8): [True: 103, False: 1.06k]
  ------------------
  133|    103|				break;
  134|  1.06k|#endif
  135|  1.06k|			continue;
  136|  1.17k|		}
  137|       |		/* handle a data record */
  138|  5.94k|		uc += nbytes;
  139|  5.94k|		if (ue - uc < CAST(ptrdiff_t, sizeof(nbytes)))
  ------------------
  |  |  452|  5.94k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (139:7): [True: 2.81k, False: 3.13k]
  ------------------
  140|  2.81k|			break;
  141|  3.13k|		cbytes = getlen(&uc, &err);
  142|  3.13k|		if (err)
  ------------------
  |  Branch (142:7): [True: 65, False: 3.06k]
  ------------------
  143|     65|			return 0;
  144|  3.06k|		if (nbytes != cbytes)
  ------------------
  |  Branch (144:7): [True: 114, False: 2.95k]
  ------------------
  145|    114|			return 0;
  146|  2.95k|		nr++;
  147|  2.95k|	}
  148|  3.64k|	if (nt * sizeof(uint32_t) == CAST(size_t, uc - orig_uc))
  ------------------
  |  |  452|  3.64k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (148:6): [True: 826, False: 2.81k]
  ------------------
  149|    826|		return 0;	/* All examined data was tapemarks (0) */
  150|  2.81k|	if (nr == 0)		/* No records */
  ------------------
  |  Branch (150:6): [True: 2.79k, False: 25]
  ------------------
  151|  2.79k|		return 0;
  152|     25|	return 1;
  153|  2.81k|}
is_simh.c:getlen:
   95|  19.3k|{
   96|  19.3k|	uint32_t n;
   97|  19.3k|	memcpy(&n, *uc, sizeof(n));
   98|  19.3k|	*err = 0;
   99|  19.3k|	*uc += sizeof(n);
  100|  19.3k|	if (NEED_SWAP)
  ------------------
  |  |   75|  19.3k|#define NEED_SWAP	(simh_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  452|  19.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (75:19): [True: 0, False: 19.3k]
  |  |  ------------------
  ------------------
  101|      0|		n = swap4(n);
  102|  19.3k|	if (n == 0xffffffff)	/* check for End of Medium */
  ------------------
  |  Branch (102:6): [True: 35, False: 19.3k]
  ------------------
  103|     35|		return n;
  104|       |	/* Check bits 25 to 28 are not used */
  105|  19.3k|	*err = ((n & 0x00ffffff) != (n & 0x0fffffff));
  106|  19.3k|	n &= 0x00ffffff;	/* keep only the record len */
  107|  19.3k|	if (n & 1)
  ------------------
  |  Branch (107:6): [True: 8.90k, False: 10.4k]
  ------------------
  108|  8.90k|		n++;
  109|  19.3k|	return n;
  110|  19.3k|}

file_is_tar:
   64|  12.9k|{
   65|  12.9k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  12.9k|	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|  12.9k|	int tar;
   72|  12.9k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  12.9k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  12.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  12.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 12.9k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  12.9k|	tar = is_tar(buf, nbytes);
   78|  12.9k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 12.8k, False: 10]
  |  Branch (78:17): [True: 0, False: 10]
  ------------------
   79|  12.8k|		return 0;
   80|       |
   81|     10|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     10|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 10]
  ------------------
   82|      0|		return 1;
   83|       |
   84|     10|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 10]
  |  Branch (84:28): [True: 0, False: 10]
  ------------------
   85|     10|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|     10|	return 1;
   89|     10|}
is_tar.c:is_tar:
  100|  12.9k|{
  101|  12.9k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  12.9k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  453|  12.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  12.9k|	    RCAST(const void *, buf));
  105|  12.9k|	size_t i;
  106|  12.9k|	int sum, recsum;
  107|  12.9k|	const unsigned char *p, *ep;
  108|  12.9k|	const char *nulp;
  109|       |
  110|  12.9k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 9.68k, False: 3.22k]
  ------------------
  111|  9.68k|		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|  3.22k|	nulp = CAST(const char *,
  ------------------
  |  |  452|  3.22k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  3.22k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  3.22k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 2.98k, False: 242]
  |  Branch (118:22): [True: 1.95k, False: 1.03k]
  ------------------
  119|  1.95k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 50, False: 1.90k]
  ------------------
  120|  1.95k|	    sizeof(gpkg_match)) == 0)
  121|     50|	    return 0;
  122|       |
  123|  3.17k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  3.17k|	sum = 0;
  126|  3.17k|	p = header->charptr;
  127|  3.17k|	ep = header->charptr + sizeof(*header);
  128|  1.62M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.62M, False: 3.17k]
  ------------------
  129|  1.62M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  28.5k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 25.4k, False: 3.17k]
  ------------------
  133|  25.4k|		sum -= header->header.chksum[i];
  134|  3.17k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  3.17k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 3.16k, False: 10]
  ------------------
  137|  3.16k|		return 0;	/* Not a tar archive */
  138|       |
  139|     10|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|     10|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 1, False: 9]
  ------------------
  140|     10|	    sizeof(header->header.magic)) == 0)
  141|      1|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|      9|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|      9|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 1, False: 8]
  ------------------
  144|      9|	    sizeof(header->header.magic)) == 0)
  145|      1|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|      8|	return 1;			/* Old fashioned tar archive */
  148|      9|}
is_tar.c:from_oct:
  158|  3.17k|{
  159|  3.17k|	int	value;
  160|       |
  161|  3.71k|	while (digs > 0 && isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  ------------------
  |  Branch (161:9): [True: 3.65k, False: 55]
  |  Branch (161:21): [True: 533, False: 3.12k]
  ------------------
  162|    533|		where++;
  163|    533|		digs--;
  164|    533|	}
  165|  3.17k|	if (digs == 0)
  ------------------
  |  Branch (165:6): [True: 55, False: 3.12k]
  ------------------
  166|     55|		return -1;		/* All blank field */
  167|  3.12k|	value = 0;
  168|  3.51k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  3.47k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 957, False: 2.52k]
  |  |  |  Branch (51:39): [True: 390, False: 567]
  |  |  ------------------
  ------------------
  |  Branch (168:9): [True: 3.47k, False: 34]
  ------------------
  169|    390|		value = (value << 3) | (*where++ - '0');
  170|    390|		digs--;
  171|    390|	}
  172|       |
  173|  3.12k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (173:6): [True: 3.08k, False: 34]
  |  Branch (173:18): [True: 1.29k, False: 1.79k]
  |  Branch (173:28): [True: 1.29k, False: 4]
  ------------------
  174|  1.29k|		return -1;			/* Ended on non-(space/NUL) */
  175|       |
  176|  1.83k|	return value;
  177|  3.12k|}

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

file_fmtdatetime:
  311|  2.27k|{
  312|  2.27k|	char *pp;
  313|  2.27k|	time_t t;
  314|  2.27k|	struct tm *tm, tmz;
  315|       |
  316|  2.27k|	if (flags & FILE_T_WINDOWS) {
  ------------------
  |  |  541|  2.27k|#define FILE_T_WINDOWS	2
  ------------------
  |  Branch (316:6): [True: 956, False: 1.32k]
  ------------------
  317|    956|		struct timespec ts;
  318|    956|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  452|    956|#define CAST(T, b)	((T)(b))
  ------------------
  319|    956|		t = ts.tv_sec;
  320|  1.32k|	} else {
  321|       |		// XXX: perhaps detect and print something if overflow
  322|       |		// on 32 bit time_t?
  323|  1.32k|		t = CAST(time_t, v);
  ------------------
  |  |  452|  1.32k|#define CAST(T, b)	((T)(b))
  ------------------
  324|  1.32k|	}
  325|       |
  326|  2.27k|	if (t > MAX_CTIME)
  ------------------
  |  |  173|  2.27k|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  452|  4.55k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.27k, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (326:6): [True: 281, False: 1.99k]
  ------------------
  327|    281|		goto out;
  328|       |
  329|  1.99k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  540|  1.99k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (329:6): [True: 363, False: 1.63k]
  ------------------
  330|    363|		tzset();
  331|    363|		tm = localtime_r(&t, &tmz);
  332|  1.63k|	} else {
  333|  1.63k|		tm = gmtime_r(&t, &tmz);
  334|  1.63k|	}
  335|  1.99k|	if (tm == NULL)
  ------------------
  |  Branch (335:6): [True: 84, False: 1.91k]
  ------------------
  336|     84|		goto out;
  337|  1.91k|	pp = asctime_r(tm, buf);
  338|       |
  339|  1.91k|	if (pp == NULL)
  ------------------
  |  Branch (339:6): [True: 200, False: 1.71k]
  ------------------
  340|    200|		goto out;
  341|  1.71k|	pp[strcspn(pp, "\n")] = '\0';
  342|  1.71k|	return pp;
  343|    565|out:
  344|    565|	strlcpy(buf, "*Invalid datetime*", bsize);
  345|    565|	return buf;
  346|  1.91k|}
file_fmtdate:
  354|    219|{
  355|    219|	struct tm tm;
  356|       |
  357|    219|	memset(&tm, 0, sizeof(tm));
  358|    219|	tm.tm_mday = v & 0x1f;
  359|    219|	tm.tm_mon = ((v >> 5) & 0xf) - 1;
  360|       |	// Sanity check because some OS's coredump with invalid values.
  361|       |	// Yes, Cygwin I am looking at you!
  362|    219|	if (tm.tm_mon < 0 || tm.tm_mon > 11)
  ------------------
  |  Branch (362:6): [True: 89, False: 130]
  |  Branch (362:23): [True: 61, False: 69]
  ------------------
  363|    150|		tm.tm_mon = 0;
  364|    219|	tm.tm_year = (v >> 9) + 80;
  365|       |
  366|    219|	if (strftime(buf, bsize, "%b %d %Y", &tm) == 0)
  ------------------
  |  Branch (366:6): [True: 0, False: 219]
  ------------------
  367|      0|		goto out;
  368|       |
  369|    219|	return buf;
  370|      0|out:
  371|      0|	strlcpy(buf, "*Invalid date*", bsize);
  372|      0|	return buf;
  373|    219|}
file_fmttime:
  377|    219|{
  378|    219|	struct tm tm;
  379|       |
  380|    219|	memset(&tm, 0, sizeof(tm));
  381|    219|	tm.tm_sec = (v & 0x1f) * 2;
  382|    219|	tm.tm_min = ((v >> 5) & 0x3f);
  383|    219|	tm.tm_hour = (v >> 11);
  384|       |
  385|    219|	if (strftime(buf, bsize, "%T", &tm) == 0)
  ------------------
  |  Branch (385:6): [True: 0, False: 219]
  ------------------
  386|      0|		goto out;
  387|       |
  388|    219|	return buf;
  389|      0|out:
  390|      0|	strlcpy(buf, "*Invalid time*", bsize);
  391|      0|	return buf;
  392|       |
  393|    219|}

file_trycdf:
  562|  12.9k|{
  563|  12.9k|	int fd = b->fd;
  564|  12.9k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  12.9k|#define CAST(T, b)	((T)(b))
  ------------------
  565|  12.9k|	size_t nbytes = b->flen;
  566|  12.9k|	cdf_info_t info;
  567|  12.9k|	cdf_header_t h;
  568|  12.9k|	cdf_sat_t sat, ssat;
  569|  12.9k|	cdf_stream_t sst, scn;
  570|  12.9k|	cdf_dir_t dir;
  571|  12.9k|	int i;
  572|  12.9k|	const char *expn = "";
  573|  12.9k|	const cdf_directory_t *root_storage;
  574|       |
  575|  12.9k|	scn.sst_tab = NULL;
  576|  12.9k|	info.i_fd = fd;
  577|  12.9k|	info.i_buf = buf;
  578|  12.9k|	info.i_len = nbytes;
  579|  12.9k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  12.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  12.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (579:6): [True: 0, False: 12.9k]
  ------------------
  580|      0|		return 0;
  581|  12.9k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (581:6): [True: 11.5k, False: 1.40k]
  ------------------
  582|  11.5k|		return 0;
  583|       |#ifdef CDF_DEBUG
  584|       |	cdf_dump_header(&h);
  585|       |#endif
  586|       |
  587|  1.40k|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (587:6): [True: 161, False: 1.24k]
  ------------------
  588|    161|		expn = "Can't read SAT";
  589|    161|		goto out0;
  590|    161|	}
  591|       |#ifdef CDF_DEBUG
  592|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  593|       |#endif
  594|       |
  595|  1.24k|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (595:6): [True: 224, False: 1.02k]
  ------------------
  596|    224|		expn = "Can't read SSAT";
  597|    224|		goto out1;
  598|    224|	}
  599|       |#ifdef CDF_DEBUG
  600|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  601|       |#endif
  602|       |
  603|  1.02k|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (603:6): [True: 107, False: 913]
  ------------------
  604|    107|		expn = "Can't read directory";
  605|    107|		goto out2;
  606|    107|	}
  607|       |
  608|    913|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (608:6): [True: 49, False: 864]
  ------------------
  609|    913|	    &root_storage)) == -1) {
  610|     49|		expn = "Cannot read short stream";
  611|     49|		goto out3;
  612|     49|	}
  613|       |#ifdef CDF_DEBUG
  614|       |	cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
  615|       |#endif
  616|       |#ifdef notdef
  617|       |	if (root_storage) {
  618|       |		if (NOTMIME(ms)) {
  619|       |			char clsbuf[128];
  620|       |			if (file_printf(ms, "CLSID %s, ",
  621|       |			    format_clsid(clsbuf, sizeof(clsbuf),
  622|       |			    root_storage->d_storage_uuid)) == -1)
  623|       |				return -1;
  624|       |		}
  625|       |	}
  626|       |#endif
  627|       |
  628|    864|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (628:6): [True: 16, False: 848]
  ------------------
  629|    864|	    "FileHeader", &scn) != -1) {
  630|     16|#define HWP5_SIGNATURE "HWP Document File"
  631|     16|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  630|     16|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (631:7): [True: 15, False: 1]
  ------------------
  632|     15|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  630|     15|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (632:10): [True: 1, False: 14]
  ------------------
  633|     15|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  630|     15|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  634|      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]
  |  |  ------------------
  ------------------
  635|      1|			if (file_printf(ms,
  ------------------
  |  Branch (635:8): [True: 0, False: 1]
  ------------------
  636|      1|			    "Hancom HWP (Hangul Word Processor) file, version 5.0") == -1)
  637|      0|			    return -1;
  638|      1|		    } else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (638:18): [True: 0, False: 0]
  ------------------
  639|      0|			if (file_printf(ms, "application/x-hwp") == -1)
  ------------------
  |  Branch (639:8): [True: 0, False: 0]
  ------------------
  640|      0|			    return -1;
  641|      0|		    }
  642|      1|		    i = 1;
  643|      1|		    goto out5;
  644|     15|		} else {
  645|     15|		    cdf_zero_stream(&scn);
  646|     15|		}
  647|     16|	}
  648|       |
  649|    863|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (649:6): [True: 282, False: 581]
  ------------------
  650|    863|	    &scn)) == -1) {
  651|    282|		if (errno != ESRCH) {
  ------------------
  |  Branch (651:7): [True: 114, False: 168]
  ------------------
  652|    114|			expn = "Cannot read summary info";
  653|    114|		}
  654|    581|	} else {
  655|    581|		i = cdf_check_summary_info(ms, &info, &h,
  656|    581|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  657|    581|		cdf_zero_stream(&scn);
  658|    581|	}
  659|    863|	if (i <= 0) {
  ------------------
  |  Branch (659:6): [True: 751, False: 112]
  ------------------
  660|    751|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (660:7): [True: 638, False: 113]
  ------------------
  661|    751|		    &sst, &dir, &scn)) == -1) {
  662|    638|			if (errno != ESRCH) {
  ------------------
  |  Branch (662:8): [True: 27, False: 611]
  ------------------
  663|     27|				expn = "Cannot read summary info";
  664|     27|			}
  665|    638|		} else {
  666|    113|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  667|    113|			    &sst, &dir, &scn, root_storage, &expn);
  668|    113|		}
  669|    751|	}
  670|    863|	if (i <= 0) {
  ------------------
  |  Branch (670:6): [True: 751, False: 112]
  ------------------
  671|    751|		i = cdf_file_dir_info(ms, &dir);
  672|    751|		if (i < 0)
  ------------------
  |  Branch (672:7): [True: 729, False: 22]
  ------------------
  673|    729|			expn = "Cannot read section info";
  674|    751|	}
  675|    864|out5:
  676|    864|	cdf_zero_stream(&scn);
  677|    864|	cdf_zero_stream(&sst);
  678|    913|out3:
  679|    913|	free(dir.dir_tab);
  680|  1.02k|out2:
  681|  1.02k|	free(ssat.sat_tab);
  682|  1.24k|out1:
  683|  1.24k|	free(sat.sat_tab);
  684|  1.40k|out0:
  685|       |	/* If we handled it already, return */
  686|  1.40k|	if (i != -1)
  ------------------
  |  Branch (686:6): [True: 135, False: 1.27k]
  ------------------
  687|    135|		return i;
  688|       |	/* Provide a default handler */
  689|  1.27k|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|  1.27k|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|  1.27k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.27k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1.27k, False: 0]
  |  |  ------------------
  ------------------
  690|  1.27k|		if (file_printf(ms,
  ------------------
  |  Branch (690:7): [True: 0, False: 1.27k]
  ------------------
  691|  1.27k|		    "Composite Document File V2 Document") == -1)
  692|      0|			return -1;
  693|  1.27k|		if (*expn)
  ------------------
  |  Branch (693:7): [True: 1.27k, False: 0]
  ------------------
  694|  1.27k|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (694:8): [True: 0, False: 1.27k]
  ------------------
  695|      0|				return -1;
  696|  1.27k|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (696:13): [True: 0, False: 0]
  ------------------
  697|       |		/* https://reposcope.com/mimetype/application/x-ole-storage */
  698|      0|		if (file_printf(ms, "application/x-ole-storage") == -1)
  ------------------
  |  Branch (698:7): [True: 0, False: 0]
  ------------------
  699|      0|			return -1;
  700|      0|	}
  701|  1.27k|	return 1;
  702|  1.27k|}
readcdf.c:cdf_check_summary_info:
  396|    694|{
  397|    694|	int i;
  398|    694|	const char *str = NULL;
  399|    694|	cdf_directory_t *d;
  400|    694|	char name[__arraycount(d->d_name)];
  401|    694|	size_t j, k;
  402|       |
  403|       |#ifdef CDF_DEBUG
  404|       |	cdf_dump_summary_info(h, scn);
  405|       |#endif
  406|    694|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (406:6): [True: 582, False: 112]
  ------------------
  407|    582|	    *expn = "Can't expand summary_info";
  408|    582|	    return i;
  409|    582|	}
  410|    112|	if (i == 1)
  ------------------
  |  Branch (410:6): [True: 112, False: 0]
  ------------------
  411|    112|		return i;
  412|      0|	for (j = 0; str == NULL && j < dir->dir_len; j++) {
  ------------------
  |  Branch (412:14): [True: 0, False: 0]
  |  Branch (412:29): [True: 0, False: 0]
  ------------------
  413|      0|		d = &dir->dir_tab[j];
  414|      0|		for (k = 0; k < sizeof(name); k++)
  ------------------
  |  Branch (414:15): [True: 0, False: 0]
  ------------------
  415|      0|			name[k] = CAST(char, cdf_tole2(d->d_name[k]));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  416|      0|		str = cdf_app_to_mime(name,
  417|      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]
  |  |  ------------------
  ------------------
  418|      0|	}
  419|      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]
  |  |  ------------------
  ------------------
  420|      0|		if (str != NULL) {
  ------------------
  |  Branch (420:7): [True: 0, False: 0]
  ------------------
  421|      0|			if (file_printf(ms, "%s", str) == -1)
  ------------------
  |  Branch (421:8): [True: 0, False: 0]
  ------------------
  422|      0|				return -1;
  423|      0|			i = 1;
  424|      0|		}
  425|      0|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|		if (str == NULL)
  ------------------
  |  Branch (426:7): [True: 0, False: 0]
  ------------------
  427|      0|			str = "vnd.ms-office";
  428|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (428:7): [True: 0, False: 0]
  ------------------
  429|      0|			return -1;
  430|      0|		i = 1;
  431|      0|	}
  432|      0|	if (i <= 0) {
  ------------------
  |  Branch (432:6): [True: 0, False: 0]
  ------------------
  433|      0|		i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst,
  434|      0|					  dir, scn);
  435|      0|	}
  436|      0|	return i;
  437|      0|}
readcdf.c:cdf_file_summary_info:
  304|    694|{
  305|    694|	cdf_summary_info_header_t si;
  306|    694|	cdf_property_info_t *info;
  307|    694|	size_t count;
  308|    694|	int m;
  309|       |
  310|    694|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (310:6): [True: 458, False: 236]
  ------------------
  311|    458|		return -1;
  312|       |
  313|    236|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|    236|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    236|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    236|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    236|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 236, False: 0]
  |  |  ------------------
  ------------------
  314|    236|		const char *str;
  315|       |
  316|    236|		if (file_printf(ms, "Composite Document File V2 Document")
  ------------------
  |  Branch (316:7): [True: 0, False: 236]
  ------------------
  317|    236|		    == -1)
  318|      0|			return -1;
  319|       |
  320|    236|		if (file_printf(ms, ", %s Endian",
  ------------------
  |  Branch (320:7): [True: 0, False: 236]
  ------------------
  321|    236|		    si.si_byte_order == 0xfffe ?  "Little" : "Big") == -1)
  ------------------
  |  Branch (321:7): [True: 45, False: 191]
  ------------------
  322|      0|			return -2;
  323|    236|		switch (si.si_os) {
  324|     38|		case 2:
  ------------------
  |  Branch (324:3): [True: 38, False: 198]
  ------------------
  325|     38|			if (file_printf(ms, ", Os: Windows, Version %d.%d",
  ------------------
  |  Branch (325:8): [True: 0, False: 38]
  ------------------
  326|     38|			    si.si_os_version & 0xff,
  327|     38|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  452|     38|#define CAST(T, b)	((T)(b))
  ------------------
  328|      0|				return -2;
  329|     38|			break;
  330|     38|		case 1:
  ------------------
  |  Branch (330:3): [True: 25, False: 211]
  ------------------
  331|     25|			if (file_printf(ms, ", Os: MacOS, Version %d.%d",
  ------------------
  |  Branch (331:8): [True: 0, False: 25]
  ------------------
  332|     25|			    CAST(uint32_t, si.si_os_version) >> 8,
  ------------------
  |  |  452|     25|#define CAST(T, b)	((T)(b))
  ------------------
  333|     25|			    si.si_os_version & 0xff) == -1)
  334|      0|				return -2;
  335|     25|			break;
  336|    173|		default:
  ------------------
  |  Branch (336:3): [True: 173, False: 63]
  ------------------
  337|    173|			if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
  ------------------
  |  Branch (337:8): [True: 0, False: 173]
  ------------------
  338|    173|			    si.si_os_version & 0xff,
  339|    173|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  452|    173|#define CAST(T, b)	((T)(b))
  ------------------
  340|      0|				return -2;
  341|    173|			break;
  342|    236|		}
  343|    236|		if (root_storage) {
  ------------------
  |  Branch (343:7): [True: 60, False: 176]
  ------------------
  344|     60|			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  345|     60|			    clsid2desc);
  346|     60|			if (str) {
  ------------------
  |  Branch (346:8): [True: 0, False: 60]
  ------------------
  347|      0|				if (file_printf(ms, ", %s", str) == -1)
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      0|					return -2;
  349|      0|			}
  350|     60|		}
  351|    236|	}
  352|       |
  353|    236|	m = cdf_file_property_info(ms, info, count, root_storage);
  354|    236|	free(info);
  355|       |
  356|    236|	return m == -1 ? -2 : m;
  ------------------
  |  Branch (356:9): [True: 124, False: 112]
  ------------------
  357|    236|}
readcdf.c:cdf_clsid_to_mime:
   97|     60|{
   98|     60|	size_t i;
   99|    120|	for (i = 0; cv[i].mime != NULL; i++) {
  ------------------
  |  Branch (99:14): [True: 60, False: 60]
  ------------------
  100|     60|		if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
  ------------------
  |  Branch (100:7): [True: 0, False: 60]
  |  Branch (100:37): [True: 0, False: 0]
  ------------------
  101|      0|			return cv[i].mime;
  102|     60|	}
  103|       |#ifdef CDF_DEBUG
  104|       |	fprintf(stderr, "unknown mime %" PRIx64 ", %" PRIx64 "\n", clsid[0],
  105|       |	    clsid[1]);
  106|       |#endif
  107|     60|	return NULL;
  108|     60|}
readcdf.c:cdf_file_property_info:
  150|    236|{
  151|    236|	size_t i;
  152|    236|	cdf_timestamp_t tp;
  153|    236|	struct timespec ts;
  154|    236|	char buf[64];
  155|    236|	const char *str = NULL;
  156|    236|	const char *s, *e;
  157|    236|	int len;
  158|       |
  159|    236|	if (!NOTMIME(ms) && root_storage)
  ------------------
  |  |   42|    472|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    236|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    236|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    236|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (159:6): [True: 0, False: 236]
  |  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.70k|	for (i = 0; i < count; i++) {
  ------------------
  |  Branch (163:14): [True: 1.58k, False: 112]
  ------------------
  164|  1.58k|		cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
  165|  1.58k|		switch (info[i].pi_type) {
  166|    238|		case CDF_NULL:
  ------------------
  |  |  198|    238|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (166:3): [True: 238, False: 1.35k]
  ------------------
  167|    238|			break;
  168|    254|		case CDF_SIGNED16:
  ------------------
  |  |  199|    254|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (168:3): [True: 254, False: 1.33k]
  ------------------
  169|    254|			if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
  ------------------
  |  |   42|    508|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    254|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    254|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    254|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 254, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (169:23): [True: 0, False: 254]
  ------------------
  170|    254|			    info[i].pi_s16) == -1)
  ------------------
  |  |  187|    254|#define pi_s16	pi_val._pi_s16
  ------------------
  171|      0|				return -1;
  172|    254|			break;
  173|    254|		case CDF_SIGNED32:
  ------------------
  |  |  200|    119|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (173:3): [True: 119, False: 1.47k]
  ------------------
  174|    119|			if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
  ------------------
  |  |   42|    238|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    119|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    119|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    119|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 119, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (174:23): [True: 0, False: 119]
  ------------------
  175|    119|			    info[i].pi_s32) == -1)
  ------------------
  |  |  185|    119|#define pi_s32	pi_val._pi_s32
  ------------------
  176|      0|				return -1;
  177|    119|			break;
  178|    119|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|     47|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (178:3): [True: 47, False: 1.54k]
  ------------------
  179|     47|			if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
  ------------------
  |  |   42|     94|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     47|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     47|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     47|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 47, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (179:23): [True: 0, False: 47]
  ------------------
  180|     47|			    info[i].pi_u32) == -1)
  ------------------
  |  |  184|     47|#define pi_u32	pi_val._pi_u32
  ------------------
  181|      0|				return -1;
  182|     47|			break;
  183|     93|		case CDF_FLOAT:
  ------------------
  |  |  201|     93|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (183:3): [True: 93, False: 1.49k]
  ------------------
  184|     93|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    186|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     93|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     93|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     93|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 93, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (184:23): [True: 0, False: 93]
  ------------------
  185|     93|			    info[i].pi_f) == -1)
  ------------------
  |  |  188|     93|#define pi_f	pi_val._pi_f
  ------------------
  186|      0|				return -1;
  187|     93|			break;
  188|     93|		case CDF_DOUBLE:
  ------------------
  |  |  202|     73|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (188:3): [True: 73, False: 1.51k]
  ------------------
  189|     73|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    146|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     73|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     73|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     73|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 73, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (189:23): [True: 0, False: 73]
  ------------------
  190|     73|			    info[i].pi_d) == -1)
  ------------------
  |  |  189|     73|#define pi_d	pi_val._pi_d
  ------------------
  191|      0|				return -1;
  192|     73|			break;
  193|     79|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|     79|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (193:3): [True: 79, False: 1.51k]
  ------------------
  194|    182|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    182|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (194:3): [True: 103, False: 1.48k]
  ------------------
  195|    182|			len = info[i].pi_str.s_len;
  ------------------
  |  |  191|    182|#define pi_str	pi_val._pi_str
  ------------------
  196|    182|			if (len > 1) {
  ------------------
  |  Branch (196:8): [True: 147, False: 35]
  ------------------
  197|    147|				char vbuf[1024];
  198|    147|				size_t j, k = 1;
  199|       |
  200|    147|				if (info[i].pi_type == CDF_LENGTH32_WSTRING)
  ------------------
  |  |  227|    147|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (200:9): [True: 76, False: 71]
  ------------------
  201|     76|				    k++;
  202|    147|				s = info[i].pi_str.s_buf;
  ------------------
  |  |  191|    147|#define pi_str	pi_val._pi_str
  ------------------
  203|    147|				e = info[i].pi_str.s_buf + len;
  ------------------
  |  |  191|    147|#define pi_str	pi_val._pi_str
  ------------------
  204|  28.3k|				for (j = 0; s < e && j < sizeof(vbuf)
  ------------------
  |  Branch (204:17): [True: 28.3k, False: 26]
  |  Branch (204:26): [True: 28.3k, False: 7]
  ------------------
  205|  28.3k|				    && len--; s += k) {
  ------------------
  |  Branch (205:12): [True: 28.3k, False: 0]
  ------------------
  206|  28.3k|					if (*s == '\0')
  ------------------
  |  Branch (206:10): [True: 114, False: 28.1k]
  ------------------
  207|    114|						break;
  208|  28.1k|					if (isprint(CAST(unsigned char, *s)))
  ------------------
  |  Branch (208:10): [True: 15.2k, False: 12.9k]
  ------------------
  209|  15.2k|						vbuf[j++] = *s;
  210|  28.1k|				}
  211|    147|				if (j == sizeof(vbuf))
  ------------------
  |  Branch (211:9): [True: 7, False: 140]
  ------------------
  212|      7|					--j;
  213|    147|				vbuf[j] = '\0';
  214|    147|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|    147|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    147|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    147|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    147|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 147, False: 0]
  |  |  ------------------
  ------------------
  215|    147|					if (vbuf[0]) {
  ------------------
  |  Branch (215:10): [True: 102, False: 45]
  ------------------
  216|    102|						if (file_printf(ms, ", %s: %s",
  ------------------
  |  Branch (216:11): [True: 4, False: 98]
  ------------------
  217|    102|						    buf, vbuf) == -1)
  218|      4|							return -1;
  219|    102|					}
  220|    147|				} 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|       |#ifdef CDF_DEBUG
  224|       |					fprintf(stderr, "Found property "
  225|       |					    "application name = \"%s\" "
  226|       |					    "(mime=%s)\n", vbuf, str);
  227|       |#endif
  228|      0|				}
  229|    147|			}
  230|    178|			break;
  231|    448|		case CDF_FILETIME:
  ------------------
  |  |  228|    448|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (231:3): [True: 448, False: 1.14k]
  ------------------
  232|    448|			tp = info[i].pi_tp;
  ------------------
  |  |  190|    448|#define pi_tp	pi_val._pi_tp
  ------------------
  233|    448|			if (tp != 0) {
  ------------------
  |  Branch (233:8): [True: 426, False: 22]
  ------------------
  234|    426|				char tbuf[64];
  235|    426|				if (tp < 1000000000000000LL) {
  ------------------
  |  Branch (235:9): [True: 169, False: 257]
  ------------------
  236|    169|					cdf_print_elapsed_time(tbuf,
  237|    169|					    sizeof(tbuf), tp);
  238|    169|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    338|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    169|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    169|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    169|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 169, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (238:25): [True: 0, False: 169]
  ------------------
  239|    169|					    ", %s: %s", buf, tbuf) == -1)
  240|      0|						return -1;
  241|    257|				} else {
  242|    257|					char *c, *ec;
  243|    257|					cdf_timestamp_to_timespec(&ts, tp);
  244|    257|					c = cdf_ctime(&ts.tv_sec, tbuf);
  245|    257|					if (c != NULL &&
  ------------------
  |  Branch (245:10): [True: 257, False: 0]
  ------------------
  246|    257|					    (ec = strchr(c, '\n')) != NULL)
  ------------------
  |  Branch (246:10): [True: 257, False: 0]
  ------------------
  247|    257|						*ec = '\0';
  248|       |
  249|    257|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    514|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    257|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    257|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    257|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 257, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (249:25): [True: 0, False: 257]
  ------------------
  250|    257|					    ", %s: %s", buf, c) == -1)
  251|      0|						return -1;
  252|    257|				}
  253|    426|			}
  254|    448|			break;
  255|    448|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|     15|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (255:3): [True: 15, False: 1.57k]
  ------------------
  256|     15|			break;
  257|    120|		default:
  ------------------
  |  Branch (257:3): [True: 120, False: 1.46k]
  ------------------
  258|    120|			return -1;
  259|  1.58k|		}
  260|  1.58k|	}
  261|    112|	if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|    112|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (261:6): [True: 0, False: 112]
  ------------------
  262|      0|		if (str == NULL)
  ------------------
  |  Branch (262:7): [True: 0, False: 0]
  ------------------
  263|      0|			return 0;
  264|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (264:7): [True: 0, False: 0]
  ------------------
  265|      0|			return -1;
  266|      0|	}
  267|    112|	return 1;
  268|    112|}
readcdf.c:cdf_file_dir_info:
  518|    751|{
  519|    751|	size_t sd, i, j;
  520|    751|	uint16_t *dir_name;
  521|    751|	int dir_type;
  522|    751|	const char* section_name;
  523|       |
  524|  9.86k|	for (i = 0; i < dir->dir_len; i++) {
  ------------------
  |  Branch (524:14): [True: 9.13k, False: 729]
  ------------------
  525|  9.13k|		dir_name = dir->dir_tab[i].d_name;
  526|  9.13k|		dir_type = dir->dir_tab[i].d_type;
  527|       |
  528|  63.8k|		for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  130|  63.8k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (528:16): [True: 54.7k, False: 9.11k]
  ------------------
  529|  54.7k|			const struct sinfo *si = &sectioninfo[sd];
  530|   136k|			for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (530:16): [True: 82.1k, False: 54.7k]
  ------------------
  531|  82.1k|				if (si->sections[j] == NULL)
  ------------------
  |  Branch (531:9): [True: 0, False: 82.1k]
  ------------------
  532|      0|					continue;
  533|  82.1k|				section_name = si->sections[j];
  534|  82.1k|				if (si->types[j] != dir_type ||
  ------------------
  |  Branch (534:9): [True: 71.2k, False: 10.8k]
  ------------------
  535|  10.8k|				    cdf_namecmp(section_name, dir_name,
  ------------------
  |  Branch (535:9): [True: 10.8k, False: 22]
  ------------------
  536|  10.8k|					strlen(section_name) + 1) != 0)
  537|  82.1k|				    continue;
  538|       |#ifdef CDF_DEBUG
  539|       |				fprintf(stderr, "Matching directory %"
  540|       |				    SIZE_T_FORMAT
  541|       |				    "u with expected name \"%s\"\n",
  542|       |				    i, section_name);
  543|       |#endif
  544|     22|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|     22|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     22|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     22|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     22|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 22, False: 0]
  |  |  ------------------
  ------------------
  545|     22|					if (file_printf(ms, "CDFV2 %s",
  ------------------
  |  Branch (545:10): [True: 0, False: 22]
  ------------------
  546|     22|					    si->name) == -1)
  547|      0|						return -1;
  548|     22|				} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (548:16): [True: 0, False: 0]
  ------------------
  549|      0|					if (file_printf(ms, "application/%s",
  ------------------
  |  Branch (549:10): [True: 0, False: 0]
  ------------------
  550|      0|					    si->mime) == -1)
  551|      0|						return -1;
  552|      0|				}
  553|     22|				return 1;
  554|     22|			}
  555|  54.7k|		}
  556|  9.13k|	}
  557|    729|	return -1;
  558|    751|}

file_tryelf:
 1896|  7.09k|{
 1897|  7.09k|	int fd = b->fd;
 1898|  7.09k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  7.09k|#define CAST(T, b)	((T)(b))
  ------------------
 1899|  7.09k|	size_t nbytes = b->flen;
 1900|  7.09k|	union {
 1901|  7.09k|		int32_t l;
 1902|  7.09k|		char c[sizeof(int32_t)];
 1903|  7.09k|	} u;
 1904|  7.09k|	int clazz;
 1905|  7.09k|	int swap;
 1906|  7.09k|	struct stat st;
 1907|  7.09k|	const struct stat *stp;
 1908|  7.09k|	off_t fsize;
 1909|  7.09k|	int flags = 0;
 1910|  7.09k|	Elf32_Ehdr elf32hdr;
 1911|  7.09k|	Elf64_Ehdr elf64hdr;
 1912|  7.09k|	uint16_t type, phnum, shnum, notecount;
 1913|       |
 1914|  7.09k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  7.09k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  7.09k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (1914:6): [True: 0, False: 7.09k]
  ------------------
 1915|      0|		return 0;
 1916|       |	/*
 1917|       |	 * ELF executables have multiple section headers in arbitrary
 1918|       |	 * file locations and thus file(1) cannot determine it from easily.
 1919|       |	 * Instead we traverse thru all section headers until a symbol table
 1920|       |	 * one is found or else the binary is stripped.
 1921|       |	 * Return immediately if it's not ELF (so we avoid pipe2file unless
 1922|       |	 * needed).
 1923|       |	 */
 1924|  7.09k|	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  157|  7.09k|#define	EI_MAG0		0		/* e_ident[] indexes */
  ------------------
              	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  166|  14.1k|#define	ELFMAG0		0x7f		/* EI_MAG */
  ------------------
  |  Branch (1924:6): [True: 3.38k, False: 3.71k]
  ------------------
 1925|  3.71k|	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  3.71k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  167|  7.42k|#define	ELFMAG1		'E'
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  2.98k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  172|  2.98k|#define	OLFMAG1		'O'
  ------------------
  |  Branch (1925:10): [True: 2.98k, False: 725]
  |  Branch (1925:37): [True: 19, False: 2.96k]
  ------------------
 1926|  3.69k|	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  159|  3.69k|#define	EI_MAG2		2
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  168|  10.7k|#define	ELFMAG2		'L'
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  160|  3.68k|#define	EI_MAG3		3
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  169|  3.68k|#define	ELFMAG3		'F'
  ------------------
  |  Branch (1926:9): [True: 9, False: 3.68k]
  |  Branch (1926:36): [True: 8, False: 3.67k]
  ------------------
 1927|  3.42k|		return 0;
 1928|       |
 1929|       |	/*
 1930|       |	 * If we cannot seek, it must be a pipe, socket or fifo.
 1931|       |	 */
 1932|  3.67k|	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  452|  3.67k|#define CAST(T, b)	((T)(b))
  ------------------
              	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  452|  3.67k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1932:5): [True: 0, False: 3.67k]
  ------------------
 1933|      0|	    && (errno == ESPIPE))
  ------------------
  |  Branch (1933:9): [True: 0, False: 0]
  ------------------
 1934|      0|		fd = file_pipe2file(ms, fd, buf, nbytes);
 1935|       |
 1936|  3.67k|	if (fd == -1) {
  ------------------
  |  Branch (1936:6): [True: 0, False: 3.67k]
  ------------------
 1937|      0|		file_badread(ms);
 1938|      0|		return -1;
 1939|      0|	}
 1940|       |
 1941|  3.67k|	stp = &b->st;
 1942|       |	/*
 1943|       |	 * b->st.st_size != 0 if previous fstat() succeeded,
 1944|       |	 * which is likely, we can avoid extra stat() call.
 1945|       |	 */
 1946|  3.67k|	if (b->st.st_size == 0) {
  ------------------
  |  Branch (1946:6): [True: 0, False: 3.67k]
  ------------------
 1947|      0|		stp = &st;
 1948|      0|		if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (1948:7): [True: 0, False: 0]
  ------------------
 1949|      0|			file_badread(ms);
 1950|      0|			return -1;
 1951|      0|		}
 1952|      0|	}
 1953|  3.67k|	if (S_ISREG(stp->st_mode) || stp->st_size != 0)
  ------------------
  |  Branch (1953:6): [True: 3.67k, False: 0]
  |  Branch (1953:31): [True: 0, False: 0]
  ------------------
 1954|  3.67k|		fsize = stp->st_size;
 1955|      0|	else
 1956|      0|		fsize = SIZE_UNKNOWN;
  ------------------
  |  |   65|      0|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1957|       |
 1958|  3.67k|	clazz = buf[EI_CLASS];
  ------------------
  |  |  161|  3.67k|#define	EI_CLASS	4
  ------------------
 1959|       |
 1960|  3.67k|	switch (clazz) {
 1961|  2.31k|	case ELFCLASS32:
  ------------------
  |  |  153|  2.31k|#define	ELFCLASS32	1
  ------------------
  |  Branch (1961:2): [True: 2.31k, False: 1.36k]
  ------------------
 1962|  2.31k|#undef elf_getu
 1963|  2.31k|#define elf_getu(a, b)	elf_getu32(a, b)
 1964|  2.31k|#undef elfhdr
 1965|  2.31k|#define elfhdr elf32hdr
 1966|  2.31k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  2.31k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1965|  2.31k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 19, False: 2.29k]
  |  |  ------------------
  |  |   28|     19|		return 0;
  |  |   29|       |
  |  |   30|  2.29k|	u.l = 1;
  |  |   31|  2.29k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.29k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.29k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |   32|  2.29k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1965|  2.29k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  2.29k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  2.29k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  2.29k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  2.29k|	notecount = ms->elf_notes_max;
  |  |   36|  2.29k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|  1.44k|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|  1.44k|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 1.44k, False: 854]
  |  |  ------------------
  |  |   39|  1.44k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|  1.44k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|  1.44k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 19, False: 1.42k]
  |  |  ------------------
  |  |   41|     19|			return toomany(ms, "program headers", phnum);
  |  |   42|  1.42k|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|  1.42k|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|  1.42k|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 1.42k]
  |  |  ------------------
  |  |   44|  1.42k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|  1.42k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|  1.42k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|  1.42k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|  1.42k|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|  1.42k|		break;
  |  |   49|  1.42k|#endif
  |  |   50|  1.42k|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    759|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 759, False: 1.53k]
  |  |  ------------------
  |  |   51|    849|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    849|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 90, False: 2.20k]
  |  |  ------------------
  |  |   52|    849|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    849|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    849|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 16, False: 833]
  |  |  ------------------
  |  |   54|     16|			return toomany(ms, "program", phnum);
  |  |   55|    833|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    833|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    833|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 10, False: 823]
  |  |  ------------------
  |  |   57|     10|			return toomany(ms, "section", shnum);
  |  |   58|    823|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 822]
  |  |  ------------------
  |  |   59|    823|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|    823|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    823|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|    823|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    823|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|    826|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|    826|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 4, False: 2.29k]
  |  |  ------------------
  |  |   65|    826|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    826|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|    826|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 1, False: 825]
  |  |  ------------------
  |  |   67|      1|			return toomany(ms, "section headers", shnum);
  |  |   68|    825|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 35, False: 790]
  |  |  ------------------
  |  |   69|    825|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  452|    825|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|    825|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  452|    825|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|    825|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|    825|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|    825|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  452|    825|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    825|		    &flags, &notecount) == -1)
  |  |   74|     35|			return -1;
  |  |   75|    790|		break;
  |  |   76|       |
  |  |   77|    790|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 1, False: 2.29k]
  |  |  ------------------
  |  |   78|      1|		break;
  |  |   79|  2.29k|	}
  |  |   80|  2.21k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 14, False: 2.19k]
  |  |  ------------------
  |  |   81|     14|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  2.19k|	return 1;
  ------------------
 1967|  1.35k|	case ELFCLASS64:
  ------------------
  |  |  154|  1.35k|#define	ELFCLASS64	2
  ------------------
  |  Branch (1967:2): [True: 1.35k, False: 2.31k]
  ------------------
 1968|  1.35k|#undef elf_getu
 1969|  1.35k|#define elf_getu(a, b)	elf_getu64(a, b)
 1970|  1.35k|#undef elfhdr
 1971|  1.35k|#define elfhdr elf64hdr
 1972|  1.35k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  1.35k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1971|  1.35k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 7, False: 1.35k]
  |  |  ------------------
  |  |   28|      7|		return 0;
  |  |   29|       |
  |  |   30|  1.35k|	u.l = 1;
  |  |   31|  1.35k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.35k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.35k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |   32|  1.35k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1971|  1.35k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  1.35k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  1.35k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  1.35k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  1.35k|	notecount = ms->elf_notes_max;
  |  |   36|  1.35k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|    489|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|    489|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 489, False: 862]
  |  |  ------------------
  |  |   39|    489|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    489|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|    489|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 8, False: 481]
  |  |  ------------------
  |  |   41|      8|			return toomany(ms, "program headers", phnum);
  |  |   42|    481|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|    481|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|    481|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 481]
  |  |  ------------------
  |  |   44|    481|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|    481|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|    481|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|    481|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|    481|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|    481|		break;
  |  |   49|    481|#endif
  |  |   50|    484|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    484|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 484, False: 867]
  |  |  ------------------
  |  |   51|    810|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    810|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 326, False: 1.02k]
  |  |  ------------------
  |  |   52|    810|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    810|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    810|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 2, False: 808]
  |  |  ------------------
  |  |   54|      2|			return toomany(ms, "program", phnum);
  |  |   55|    808|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    808|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    808|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 10, False: 798]
  |  |  ------------------
  |  |   57|     10|			return toomany(ms, "section", shnum);
  |  |   58|    798|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 797]
  |  |  ------------------
  |  |   59|    798|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|    798|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    798|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|    798|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    798|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|    848|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|    848|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 51, False: 1.30k]
  |  |  ------------------
  |  |   65|    848|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    848|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|    848|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 5, False: 843]
  |  |  ------------------
  |  |   67|      5|			return toomany(ms, "section headers", shnum);
  |  |   68|    843|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 59, False: 784]
  |  |  ------------------
  |  |   69|    843|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  452|    843|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|    843|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  452|    843|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|    843|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|    843|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|    843|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  452|    843|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    843|		    &flags, &notecount) == -1)
  |  |   74|     59|			return -1;
  |  |   75|    784|		break;
  |  |   76|       |
  |  |   77|    784|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 1, False: 1.35k]
  |  |  ------------------
  |  |   78|      1|		break;
  |  |   79|  1.35k|	}
  |  |   80|  1.26k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 4, False: 1.26k]
  |  |  ------------------
  |  |   81|      4|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  1.26k|	return 1;
  ------------------
 1973|      6|	default:
  ------------------
  |  Branch (1973:2): [True: 6, False: 3.67k]
  ------------------
 1974|      6|	    if (elf_printf(ms, ", unknown class %d", clazz) == -1)
  ------------------
  |  Branch (1974:10): [True: 0, False: 6]
  ------------------
 1975|      0|		    return -1;
 1976|      6|	    break;
 1977|  3.67k|	}
 1978|      6|	return 0;
 1979|  3.67k|}
readelf.c:getu16:
   94|  19.0k|{
   95|  19.0k|	union {
   96|  19.0k|		uint16_t ui;
   97|  19.0k|		char c[2];
   98|  19.0k|	} retval, tmpval;
   99|       |
  100|  19.0k|	if (swap) {
  ------------------
  |  Branch (100:6): [True: 6.63k, False: 12.4k]
  ------------------
  101|  6.63k|		tmpval.ui = value;
  102|       |
  103|  6.63k|		retval.c[0] = tmpval.c[1];
  104|  6.63k|		retval.c[1] = tmpval.c[0];
  105|       |
  106|  6.63k|		return retval.ui;
  107|  6.63k|	} else
  108|  12.4k|		return value;
  109|  19.0k|}
readelf.c:toomany:
   86|     89|{
   87|     89|	if (elf_printf(ms, ", too many %s (%u)", name, num) == -1)
  ------------------
  |  Branch (87:6): [True: 0, False: 89]
  ------------------
   88|      0|		return -1;
   89|     89|	return 1;
   90|     89|}
readelf.c:dophn_core:
  367|  1.90k|{
  368|  1.90k|	Elf32_Phdr ph32;
  369|  1.90k|	Elf64_Phdr ph64;
  370|  1.90k|	size_t offset, len;
  371|  1.90k|	unsigned char nbuf[NBUFSIZE];
  372|  1.90k|	ssize_t bufsize;
  373|  1.90k|	off_t ph_off = off, offs;
  374|  1.90k|	int ph_num = num;
  375|       |
  376|  1.90k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.90k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.90k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.90k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (376:6): [True: 0, False: 1.90k]
  ------------------
  377|      0|		return 0;
  378|       |
  379|  1.90k|	if (num == 0) {
  ------------------
  |  Branch (379:6): [True: 4, False: 1.89k]
  ------------------
  380|      4|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (380:7): [True: 0, False: 4]
  ------------------
  381|      0|			return -1;
  382|      4|		return 0;
  383|      4|	}
  384|  1.89k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  1.89k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.89k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 1.41k, False: 480]
  |  |  ------------------
  |  |  184|  1.89k|			 ? sizeof(ph32)				\
  |  |  185|  1.89k|			 : sizeof(ph64))
  ------------------
  |  Branch (384:6): [True: 20, False: 1.87k]
  ------------------
  385|     20|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (385:7): [True: 0, False: 20]
  ------------------
  386|      0|			return -1;
  387|     20|		return 0;
  388|     20|	}
  389|       |
  390|       |	/*
  391|       |	 * Loop through all the program headers.
  392|       |	 */
  393|  20.9k|	for ( ; num; num--) {
  ------------------
  |  Branch (393:10): [True: 20.8k, False: 89]
  ------------------
  394|  20.8k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  20.8k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 11.2k, False: 9.57k]
  |  |  ------------------
  |  |  181|  20.8k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  452|  11.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  20.8k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  452|  9.57k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  20.8k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 11.2k, False: 9.57k]
  |  |  ------------------
  |  |  184|  20.8k|			 ? sizeof(ph32)				\
  |  |  185|  20.8k|			 : sizeof(ph64))
  ------------------
  |  Branch (394:7): [True: 1.76k, False: 19.0k]
  ------------------
  395|  20.8k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  452|  41.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 11.2k, False: 9.57k]
  |  |  ------------------
  ------------------
  396|  1.76k|			if (elf_printf(ms, 
  ------------------
  |  Branch (396:8): [True: 0, False: 1.76k]
  ------------------
  397|  1.76k|			    ", can't read elf program headers at %jd",
  398|  1.76k|			    (intmax_t)off) == -1)
  399|      0|				return -1;
  400|  1.76k|			return 0;
  401|  1.76k|		}
  402|  19.0k|		off += size;
  403|       |
  404|  19.0k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  19.0k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  38.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  19.0k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  38.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 9.88k, False: 9.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  19.0k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  19.0k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (404:7): [True: 19.0k, False: 0]
  |  Branch (404:32): [True: 9.31k, False: 9.74k]
  ------------------
  405|       |			/* Perhaps warn here */
  406|  9.31k|			continue;
  407|  9.31k|		}
  408|       |
  409|  9.74k|		if (xph_type != PT_NOTE)
  ------------------
  |  |  186|  9.74k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  9.74k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 6.42k, False: 3.32k]
  |  |  ------------------
  |  |  187|  9.74k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  6.42k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  9.74k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  3.32k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
              		if (xph_type != PT_NOTE)
  ------------------
  |  |  201|  9.74k|#define	PT_NOTE		4
  ------------------
  |  Branch (409:7): [True: 4.23k, False: 5.50k]
  ------------------
  410|  4.23k|			continue;
  411|       |
  412|       |		/*
  413|       |		 * This is a PT_NOTE section; loop through all the notes
  414|       |		 * in the section.
  415|       |		 */
  416|  5.50k|		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  5.50k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  11.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 4.33k, False: 1.17k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  5.50k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  5.50k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  1.30k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  2.61k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 771, False: 534]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  5.50k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  5.50k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (416:9): [True: 1.30k, False: 4.20k]
  ------------------
  417|  5.50k|		offs = xph_offset;
  ------------------
  |  |  189|  5.50k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  11.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 4.33k, False: 1.17k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  5.50k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  5.50k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  418|  5.50k|		if ((bufsize = pread(fd, nbuf, len, offs)) == -1) {
  ------------------
  |  Branch (418:7): [True: 26, False: 5.48k]
  ------------------
  419|     26|			if (elf_printf(ms, " can't read note section at %jd",
  ------------------
  |  Branch (419:8): [True: 0, False: 26]
  ------------------
  420|     26|			    (intmax_t)offs) == -1)
  421|      0|				return -1;
  422|     26|			return 0;
  423|     26|		}
  424|  5.48k|		offset = 0;
  425|  25.2k|		for (;;) {
  426|  25.2k|			if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  452|  25.2k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (426:8): [True: 4.16k, False: 21.1k]
  ------------------
  427|  4.16k|				break;
  428|  21.1k|			offset = donote(ms, nbuf, offset, CAST(size_t, bufsize),
  ------------------
  |  |  452|  21.1k|#define CAST(T, b)	((T)(b))
  ------------------
  429|  21.1k|			    clazz, swap, 4, flags, notecount, fd, ph_off,
  430|  21.1k|			    ph_num, fsize);
  431|  21.1k|			if (offset == 0)
  ------------------
  |  Branch (431:8): [True: 1.31k, False: 19.7k]
  ------------------
  432|  1.31k|				break;
  433|       |
  434|  21.1k|		}
  435|  5.48k|	}
  436|     89|	return 0;
  437|  1.87k|}
readelf.c:donote:
 1234|  30.2k|{
 1235|  30.2k|	Elf32_Nhdr nh32;
 1236|  30.2k|	Elf64_Nhdr nh64;
 1237|  30.2k|	size_t noff, doff;
 1238|  30.2k|	uint32_t namesz, descsz;
 1239|  30.2k|	char buf[256];
 1240|  30.2k|	unsigned char *nbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  452|  30.2k|#define CAST(T, b)	((T)(b))
  ------------------
 1241|       |
 1242|  30.2k|	if (*notecount == 0)
  ------------------
  |  Branch (1242:6): [True: 373, False: 29.8k]
  ------------------
 1243|    373|		return 0;
 1244|  29.8k|	--*notecount;
 1245|       |
 1246|  29.8k|	if (xnh_sizeof + offset > size) {
  ------------------
  |  |  211|  29.8k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  29.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 24.1k, False: 5.67k]
  |  |  ------------------
  |  |  212|  29.8k|			 ? sizeof(nh32)				\
  |  |  213|  29.8k|			 : sizeof(nh64))
  ------------------
  |  Branch (1246:6): [True: 2.64k, False: 27.2k]
  ------------------
 1247|       |		/*
 1248|       |		 * We're out of note headers.
 1249|       |		 */
 1250|  2.64k|		return xnh_sizeof + offset;
  ------------------
  |  |  211|  2.64k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.64k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 2.24k, False: 394]
  |  |  ------------------
  |  |  212|  2.64k|			 ? sizeof(nh32)				\
  |  |  213|  2.64k|			 : sizeof(nh64))
  ------------------
 1251|  2.64k|	}
 1252|       |	/*XXX: GCC */
 1253|  27.2k|	memset(&nh32, 0, sizeof(nh32));
 1254|  27.2k|	memset(&nh64, 0, sizeof(nh64));
 1255|       |
 1256|  27.2k|	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  208|  27.2k|#define xnh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (208:19): [True: 21.9k, False: 5.27k]
  |  |  ------------------
  |  |  209|  27.2k|			 ? CAST(void *, &nh32)			\
  |  |  ------------------
  |  |  |  |  452|  21.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  210|  27.2k|			 : CAST(void *, &nh64))
  |  |  ------------------
  |  |  |  |  452|  5.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  211|  27.2k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 21.9k, False: 5.27k]
  |  |  ------------------
  |  |  212|  27.2k|			 ? sizeof(nh32)				\
  |  |  213|  27.2k|			 : sizeof(nh64))
  ------------------
 1257|  27.2k|	offset += xnh_sizeof;
  ------------------
  |  |  211|  27.2k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 21.9k, False: 5.27k]
  |  |  ------------------
  |  |  212|  27.2k|			 ? sizeof(nh32)				\
  |  |  213|  27.2k|			 : sizeof(nh64))
  ------------------
 1258|       |
 1259|  27.2k|	namesz = xnh_namesz;
  ------------------
  |  |  217|  27.2k|#define xnh_namesz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (217:21): [True: 21.9k, False: 5.27k]
  |  |  ------------------
  |  |  218|  27.2k|			 ? elf_getu32(swap, nh32.n_namesz)	\
  |  |  ------------------
  |  |  |  |  158|  21.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  219|  27.2k|			 : elf_getu32(swap, nh64.n_namesz))
  |  |  ------------------
  |  |  |  |  158|  5.27k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1260|  27.2k|	descsz = xnh_descsz;
  ------------------
  |  |  220|  27.2k|#define xnh_descsz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (220:21): [True: 21.9k, False: 5.27k]
  |  |  ------------------
  |  |  221|  27.2k|			 ? elf_getu32(swap, nh32.n_descsz)	\
  |  |  ------------------
  |  |  |  |  158|  21.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  222|  27.2k|			 : elf_getu32(swap, nh64.n_descsz))
  |  |  ------------------
  |  |  |  |  158|  5.27k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1261|       |
 1262|  27.2k|	if ((namesz == 0) && (descsz == 0)) {
  ------------------
  |  Branch (1262:6): [True: 3.24k, False: 23.9k]
  |  Branch (1262:23): [True: 281, False: 2.96k]
  ------------------
 1263|       |		/*
 1264|       |		 * We're out of note headers.
 1265|       |		 */
 1266|    281|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1266:10): [True: 12, False: 269]
  ------------------
 1267|    281|	}
 1268|       |
 1269|  26.9k|	if (namesz & 0x80000000) {
  ------------------
  |  Branch (1269:6): [True: 599, False: 26.3k]
  ------------------
 1270|    599|	    (void)elf_printf(ms, ", bad note name size %#lx",
 1271|    599|		CAST(unsigned long, namesz));
  ------------------
  |  |  452|    599|#define CAST(T, b)	((T)(b))
  ------------------
 1272|    599|	    return 0;
 1273|    599|	}
 1274|       |
 1275|  26.3k|	if (descsz & 0x80000000) {
  ------------------
  |  Branch (1275:6): [True: 1.35k, False: 24.9k]
  ------------------
 1276|  1.35k|		(void)elf_printf(ms, ", bad note description size %#lx",
 1277|  1.35k|		    CAST(unsigned long, descsz));
  ------------------
  |  |  452|  1.35k|#define CAST(T, b)	((T)(b))
  ------------------
 1278|  1.35k|		return 0;
 1279|  1.35k|	}
 1280|       |
 1281|  24.9k|	noff = offset;
 1282|  24.9k|	doff = ELF_ALIGN(offset + namesz);
  ------------------
  |  |   56|  24.9k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1283|       |
 1284|  24.9k|	if (offset + namesz > size) {
  ------------------
  |  Branch (1284:6): [True: 2.35k, False: 22.6k]
  ------------------
 1285|       |		/*
 1286|       |		 * We're past the end of the buffer.
 1287|       |		 */
 1288|  2.35k|		return doff;
 1289|  2.35k|	}
 1290|       |
 1291|  22.6k|	offset = ELF_ALIGN(doff + descsz);
  ------------------
  |  |   56|  22.6k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1292|  22.6k|	if (doff + descsz > size) {
  ------------------
  |  Branch (1292:6): [True: 1.48k, False: 21.1k]
  ------------------
 1293|       |		/*
 1294|       |		 * We're past the end of the buffer.
 1295|       |		 */
 1296|  1.48k|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1296:10): [True: 1.11k, False: 377]
  ------------------
 1297|  1.48k|	}
 1298|       |
 1299|       |
 1300|  21.1k|	if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
  ------------------
  |  |  352|  21.1k|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  |  Branch (1300:6): [True: 20.1k, False: 1.03k]
  ------------------
 1301|  20.1k|		if (do_os_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  20.1k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 17.0k, False: 3.05k]
  |  |  ------------------
  |  |  215|  20.1k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  17.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  20.1k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1301:7): [True: 137, False: 19.9k]
  ------------------
 1302|  20.1k|		    namesz, descsz, noff, doff, flags))
 1303|    137|			return offset;
 1304|  20.1k|	}
 1305|       |
 1306|  21.0k|	if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
  ------------------
  |  |  353|  21.0k|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  |  Branch (1306:6): [True: 20.5k, False: 438]
  ------------------
 1307|  20.5k|		if (do_bid_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  20.5k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 17.5k, False: 3.05k]
  |  |  ------------------
  |  |  215|  20.5k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  17.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  20.5k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1307:7): [True: 358, False: 20.2k]
  ------------------
 1308|  20.5k|		    namesz, descsz, noff, doff, flags))
 1309|    358|			return offset;
 1310|  20.5k|	}
 1311|       |
 1312|  20.6k|	if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
  ------------------
  |  |  355|  20.6k|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  |  Branch (1312:6): [True: 20.2k, False: 456]
  ------------------
 1313|  20.2k|		if (do_pax_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  20.2k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 17.1k, False: 3.05k]
  |  |  ------------------
  |  |  215|  20.2k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  17.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  20.2k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1313:7): [True: 40, False: 20.1k]
  ------------------
 1314|  20.2k|		    namesz, descsz, noff, doff, flags))
 1315|     40|			return offset;
 1316|  20.2k|	}
 1317|  20.6k|	if ((*flags & FLAGS_DID_ANDROID_MEMTAG) == 0) {
  ------------------
  |  |  360|  20.6k|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  |  Branch (1317:6): [True: 20.2k, False: 344]
  ------------------
 1318|  20.2k|		if (do_memtag_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  20.2k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 17.2k, False: 3.05k]
  |  |  ------------------
  |  |  215|  20.2k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  17.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  20.2k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1318:7): [True: 48, False: 20.2k]
  ------------------
 1319|  20.2k|		    namesz, descsz, noff, doff, flags))
 1320|     48|			return offset;
 1321|  20.2k|	}
 1322|       |
 1323|  20.5k|	if ((*flags & FLAGS_DID_CORE) == 0) {
  ------------------
  |  |  351|  20.5k|#define FLAGS_DID_CORE			0x0004
  ------------------
  |  Branch (1323:6): [True: 19.8k, False: 695]
  ------------------
 1324|  19.8k|		if (do_core_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  19.8k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 16.8k, False: 3.05k]
  |  |  ------------------
  |  |  215|  19.8k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  16.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  19.8k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1324:7): [True: 85, False: 19.7k]
  ------------------
 1325|  19.8k|		    namesz, descsz, noff, doff, flags, size, clazz))
 1326|     85|			return offset;
 1327|  19.8k|	}
 1328|       |
 1329|  20.4k|	if ((*flags & FLAGS_DID_AUXV) == 0) {
  ------------------
  |  |  362|  20.4k|#define FLAGS_DID_AUXV			0x2000
  ------------------
  |  Branch (1329:6): [True: 20.0k, False: 465]
  ------------------
 1330|  20.0k|		if (do_auxv_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  20.0k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 16.9k, False: 3.03k]
  |  |  ------------------
  |  |  215|  20.0k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  16.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  20.0k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.03k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1330:7): [True: 537, False: 19.4k]
  ------------------
 1331|  20.0k|			namesz, descsz, noff, doff, flags, size, clazz,
 1332|  20.0k|			fd, ph_off, ph_num, fsize))
 1333|    537|			return offset;
 1334|  20.0k|	}
 1335|       |
 1336|  19.9k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "NetBSD")) {
  ------------------
  |  |   67|  19.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.54k, False: 17.4k]
  |  |  |  Branch (67:29): [True: 1.42k, False: 1.11k]
  |  |  ------------------
  ------------------
 1337|  1.42k|		int descw, flag;
 1338|  1.42k|		const char *str, *tag;
 1339|  1.42k|		if (descsz > 100)
  ------------------
  |  Branch (1339:7): [True: 74, False: 1.35k]
  ------------------
 1340|     74|			descsz = 100;
 1341|  1.42k|		switch (xnh_type) {
  ------------------
  |  |  214|  1.42k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.42k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 1.13k, False: 293]
  |  |  ------------------
  |  |  215|  1.42k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  1.13k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  1.42k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|    293|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1342|    256|	    	case NT_NETBSD_VERSION:
  ------------------
  |  |  285|    256|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (1342:7): [True: 256, False: 1.17k]
  ------------------
 1343|    256|			return offset;
 1344|    247|		case NT_NETBSD_MARCH:
  ------------------
  |  |  346|    247|#define NT_NETBSD_MARCH		5
  ------------------
  |  Branch (1344:3): [True: 247, False: 1.18k]
  ------------------
 1345|    247|			flag = FLAGS_DID_NETBSD_MARCH;
  ------------------
  |  |  356|    247|#define FLAGS_DID_NETBSD_MARCH		0x0080
  ------------------
 1346|    247|			tag = "compiled for";
 1347|    247|			break;
 1348|    215|		case NT_NETBSD_CMODEL:
  ------------------
  |  |  356|    215|#define NT_NETBSD_CMODEL	6
  ------------------
  |  Branch (1348:3): [True: 215, False: 1.21k]
  ------------------
 1349|    215|			flag = FLAGS_DID_NETBSD_CMODEL;
  ------------------
  |  |  357|    215|#define FLAGS_DID_NETBSD_CMODEL		0x0100
  ------------------
 1350|    215|			tag = "compiler model";
 1351|    215|			break;
 1352|    209|		case NT_NETBSD_EMULATION:
  ------------------
  |  |  286|    209|#define	NT_NETBSD_EMULATION	2
  ------------------
  |  Branch (1352:3): [True: 209, False: 1.21k]
  ------------------
 1353|    209|			flag = FLAGS_DID_NETBSD_EMULATION;
  ------------------
  |  |  358|    209|#define FLAGS_DID_NETBSD_EMULATION	0x0200
  ------------------
 1354|    209|			tag = "emulation:";
 1355|    209|			break;
 1356|    501|		default:
  ------------------
  |  Branch (1356:3): [True: 501, False: 927]
  ------------------
 1357|    501|			if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  ------------------
  |  |  359|    501|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
  |  Branch (1357:8): [True: 438, False: 63]
  ------------------
 1358|    438|				return offset;
 1359|     63|			*flags |= FLAGS_DID_NETBSD_UNKNOWN;
  ------------------
  |  |  359|     63|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
 1360|     63|			if (elf_printf(ms, ", note=%u", xnh_type) == -1)
  ------------------
  |  |  214|     63|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|     63|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 36, False: 27]
  |  |  ------------------
  |  |  215|     63|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|     36|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|     63|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|     27|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1360:8): [True: 0, False: 63]
  ------------------
 1361|      0|				return offset;
 1362|     63|			return offset;
 1363|  1.42k|		}
 1364|       |
 1365|    671|		if (*flags & flag)
  ------------------
  |  Branch (1365:7): [True: 639, False: 32]
  ------------------
 1366|    639|			return offset;
 1367|     32|		str = RCAST(const char *, &nbuf[doff]);
  ------------------
  |  |  453|     32|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1368|     32|		descw = CAST(int, descsz);
  ------------------
  |  |  452|     32|#define CAST(T, b)	((T)(b))
  ------------------
 1369|     32|		*flags |= flag;
 1370|     32|		elf_printf(ms, ", %s: %s", tag,
 1371|     32|		    file_copystr(buf, sizeof(buf), descw, str));
 1372|     32|		return offset;
 1373|    671|	}
 1374|       |
 1375|  18.5k|	return offset;
 1376|  19.9k|}
readelf.c:do_os_note:
  615|  20.1k|{
  616|  20.1k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  20.1k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  617|       |
  618|  20.1k|	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |   67|  40.2k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.00k, False: 19.1k]
  |  |  |  Branch (67:29): [True: 565, False: 443]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |  297|  20.6k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (618:34): [True: 232, False: 333]
  |  Branch (618:60): [True: 1, False: 231]
  ------------------
  619|      1|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|      1|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  620|      1|		if (elf_printf(ms, ", for SuSE %d.%d", nbuf[doff],
  ------------------
  |  Branch (620:7): [True: 0, False: 1]
  ------------------
  621|      1|		    nbuf[doff + 1]) == -1)
  622|      0|		    return -1;
  623|      1|	    return 1;
  624|      1|	}
  625|       |
  626|  20.1k|	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |   67|  40.2k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 11.3k, False: 8.74k]
  |  |  |  Branch (67:29): [True: 813, False: 10.5k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |  297|  20.9k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (626:33): [True: 221, False: 592]
  |  Branch (626:59): [True: 20, False: 201]
  ------------------
  627|     20|		uint32_t desc[4];
  628|     20|		memcpy(desc, &nbuf[doff], sizeof(desc));
  629|       |
  630|     20|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     20|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  631|     20|		if (elf_printf(ms, ", for GNU/") == -1)
  ------------------
  |  Branch (631:7): [True: 0, False: 20]
  ------------------
  632|      0|			return -1;
  633|     20|		switch (elf_getu32(swap, desc[0])) {
  ------------------
  |  |  158|     20|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  634|      2|		case GNU_OS_LINUX:
  ------------------
  |  |  300|      2|#define	GNU_OS_LINUX	0
  ------------------
  |  Branch (634:3): [True: 2, False: 18]
  ------------------
  635|      2|			if (elf_printf(ms, "Linux") == -1)
  ------------------
  |  Branch (635:8): [True: 0, False: 2]
  ------------------
  636|      0|				return -1;
  637|      2|			break;
  638|      2|		case GNU_OS_HURD:
  ------------------
  |  |  301|      1|#define	GNU_OS_HURD	1
  ------------------
  |  Branch (638:3): [True: 1, False: 19]
  ------------------
  639|      1|			if (elf_printf(ms, "Hurd") == -1)
  ------------------
  |  Branch (639:8): [True: 0, False: 1]
  ------------------
  640|      0|				return -1;
  641|      1|			break;
  642|      1|		case GNU_OS_SOLARIS:
  ------------------
  |  |  302|      1|#define	GNU_OS_SOLARIS	2
  ------------------
  |  Branch (642:3): [True: 1, False: 19]
  ------------------
  643|      1|			if (elf_printf(ms, "Solaris") == -1)
  ------------------
  |  Branch (643:8): [True: 0, False: 1]
  ------------------
  644|      0|				return -1;
  645|      1|			break;
  646|      1|		case GNU_OS_KFREEBSD:
  ------------------
  |  |  303|      1|#define	GNU_OS_KFREEBSD	3
  ------------------
  |  Branch (646:3): [True: 1, False: 19]
  ------------------
  647|      1|			if (elf_printf(ms, "kFreeBSD") == -1)
  ------------------
  |  Branch (647:8): [True: 0, False: 1]
  ------------------
  648|      0|				return -1;
  649|      1|			break;
  650|      1|		case GNU_OS_KNETBSD:
  ------------------
  |  |  304|      1|#define	GNU_OS_KNETBSD	4
  ------------------
  |  Branch (650:3): [True: 1, False: 19]
  ------------------
  651|      1|			if (elf_printf(ms, "kNetBSD") == -1)
  ------------------
  |  Branch (651:8): [True: 0, False: 1]
  ------------------
  652|      0|				return -1;
  653|      1|			break;
  654|     14|		default:
  ------------------
  |  Branch (654:3): [True: 14, False: 6]
  ------------------
  655|     14|			if (elf_printf(ms, "<unknown>") == -1)
  ------------------
  |  Branch (655:8): [True: 0, False: 14]
  ------------------
  656|      0|				return -1;
  657|     20|		}
  658|     20|		if (elf_printf(ms, " %d.%d.%d", elf_getu32(swap, desc[1]),
  ------------------
  |  |  158|     20|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  |  Branch (658:7): [True: 0, False: 20]
  ------------------
  659|     20|		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  158|     20|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
              		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  158|     20|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  660|      0|			return -1;
  661|     20|		return 1;
  662|     20|	}
  663|       |
  664|  20.1k|	if (NAMEEQUALS(name, "NetBSD") &&
  ------------------
  |  |   67|  40.2k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.58k, False: 17.5k]
  |  |  |  Branch (67:29): [True: 1.47k, False: 1.11k]
  |  |  ------------------
  ------------------
  665|  1.47k|	    type == NT_NETBSD_VERSION && descsz == 4) {
  ------------------
  |  |  285|  21.5k|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (665:6): [True: 298, False: 1.17k]
  |  Branch (665:35): [True: 50, False: 248]
  ------------------
  666|     50|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     50|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  667|     50|		if (do_note_netbsd_version(ms, swap, &nbuf[doff]) == -1)
  ------------------
  |  Branch (667:7): [True: 0, False: 50]
  ------------------
  668|      0|			return -1;
  669|     50|		return 1;
  670|     50|	}
  671|       |
  672|  20.0k|	if (NAMEEQUALS(name, "FreeBSD") &&
  ------------------
  |  |   67|  40.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.60k, False: 18.4k]
  |  |  |  Branch (67:29): [True: 563, False: 1.04k]
  |  |  ------------------
  ------------------
  673|    563|	    type == NT_FREEBSD_VERSION && descsz == 4) {
  ------------------
  |  |  287|  20.6k|#define	NT_FREEBSD_VERSION	1
  ------------------
  |  Branch (673:6): [True: 291, False: 272]
  |  Branch (673:36): [True: 63, False: 228]
  ------------------
  674|     63|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     63|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  675|     63|		if (do_note_freebsd_version(ms, swap, &nbuf[doff])
  ------------------
  |  Branch (675:7): [True: 0, False: 63]
  ------------------
  676|     63|		    == -1)
  677|      0|			return -1;
  678|     63|		return 1;
  679|     63|	}
  680|       |
  681|  19.9k|	if (NAMEEQUALS(name, "OpenBSD") &&
  ------------------
  |  |   67|  39.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.54k, False: 18.4k]
  |  |  |  Branch (67:29): [True: 174, False: 1.37k]
  |  |  ------------------
  ------------------
  682|    174|	    type == NT_OPENBSD_VERSION && descsz == 4) {
  ------------------
  |  |  288|  20.1k|#define	NT_OPENBSD_VERSION	1
  ------------------
  |  Branch (682:6): [True: 75, False: 99]
  |  Branch (682:36): [True: 1, False: 74]
  ------------------
  683|      1|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|      1|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  684|      1|		if (elf_printf(ms, ", for OpenBSD") == -1)
  ------------------
  |  Branch (684:7): [True: 0, False: 1]
  ------------------
  685|      0|			return -1;
  686|       |		/* Content of note is always 0 */
  687|      1|		return 1;
  688|      1|	}
  689|       |
  690|  19.9k|	if (NAMEEQUALS(name, "DragonFly") &&
  ------------------
  |  |   67|  39.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 445, False: 19.5k]
  |  |  |  Branch (67:29): [True: 207, False: 238]
  |  |  ------------------
  ------------------
  691|    207|	    type == NT_DRAGONFLY_VERSION && descsz == 4) {
  ------------------
  |  |  289|  20.1k|#define	NT_DRAGONFLY_VERSION	1
  ------------------
  |  Branch (691:6): [True: 101, False: 106]
  |  Branch (691:38): [True: 2, False: 99]
  ------------------
  692|      2|		uint32_t desc;
  693|      2|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|      2|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  694|      2|		if (elf_printf(ms, ", for DragonFly") == -1)
  ------------------
  |  Branch (694:7): [True: 0, False: 2]
  ------------------
  695|      0|			return -1;
  696|      2|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  697|      2|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  698|      2|		if (elf_printf(ms, " %d.%d.%d", desc / 100000,
  ------------------
  |  Branch (698:7): [True: 0, False: 2]
  ------------------
  699|      2|		    desc / 10000 % 10, desc % 10000) == -1)
  700|      0|			return -1;
  701|      2|		return 1;
  702|      2|	}
  703|       |
  704|  19.9k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  39.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.54k, False: 18.4k]
  |  |  |  Branch (67:29): [True: 383, False: 1.16k]
  |  |  ------------------
  ------------------
  705|    383|	    type == NT_ANDROID_VERSION && descsz >= 4) {
  ------------------
  |  |  377|  20.3k|#define NT_ANDROID_VERSION	1
  ------------------
  |  Branch (705:6): [True: 20, False: 363]
  |  Branch (705:36): [True: 5, False: 15]
  ------------------
  706|      5|		uint32_t api_level;
  707|      5|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|      5|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  708|      5|		memcpy(&api_level, &nbuf[doff], sizeof(api_level));
  709|      5|		api_level = elf_getu32(swap, api_level);
  ------------------
  |  |  158|      5|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  710|      5|		if (elf_printf(ms, ", for Android %d", api_level) == -1)
  ------------------
  |  Branch (710:7): [True: 0, False: 5]
  ------------------
  711|      0|			return -1;
  712|       |		/*
  713|       |		 * NDK r14 and later also include details of the NDK that
  714|       |		 * built the binary. OS binaries (or binaries built by older
  715|       |		 * NDKs) don't have this. The NDK release and build number
  716|       |		 * are both 64-byte strings.
  717|       |		 */
  718|      5|		if (descsz >= 4 + 64 + 64) {
  ------------------
  |  Branch (718:7): [True: 1, False: 4]
  ------------------
  719|      1|			if (elf_printf(ms, ", built by NDK %.64s (%.64s)",
  ------------------
  |  Branch (719:8): [True: 0, False: 1]
  ------------------
  720|      1|			    &nbuf[doff + 4], &nbuf[doff + 4 + 64]) == -1)
  721|      0|				return -1;
  722|      1|		}
  723|      5|	}
  724|       |
  725|  19.9k|	return 0;
  726|  19.9k|}
readelf.c:do_note_netbsd_version:
  442|     50|{
  443|     50|	uint32_t desc;
  444|     50|	memcpy(&desc, v, sizeof(desc));
  445|     50|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     50|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  446|       |
  447|     50|	if (elf_printf(ms, ", for NetBSD") == -1)
  ------------------
  |  Branch (447:6): [True: 0, False: 50]
  ------------------
  448|      0|		return -1;
  449|       |	/*
  450|       |	 * The version number used to be stuck as 199905, and was thus
  451|       |	 * basically content-free.  Newer versions of NetBSD have fixed
  452|       |	 * this and now use the encoding of __NetBSD_Version__:
  453|       |	 *
  454|       |	 *	MMmmrrpp00
  455|       |	 *
  456|       |	 * M = major version
  457|       |	 * m = minor version
  458|       |	 * r = release ["",A-Z,Z[A-Z] but numeric]
  459|       |	 * p = patchlevel
  460|       |	 */
  461|     50|	if (desc > 100000000U) {
  ------------------
  |  Branch (461:6): [True: 48, False: 2]
  ------------------
  462|     48|		uint32_t ver_patch = (desc / 100) % 100;
  463|     48|		uint32_t ver_rel = (desc / 10000) % 100;
  464|     48|		uint32_t ver_min = (desc / 1000000) % 100;
  465|     48|		uint32_t ver_maj = desc / 100000000;
  466|       |
  467|     48|		if (elf_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
  ------------------
  |  Branch (467:7): [True: 0, False: 48]
  ------------------
  468|      0|			return -1;
  469|     48|		if (ver_maj >= 9) {
  ------------------
  |  Branch (469:7): [True: 22, False: 26]
  ------------------
  470|     22|			ver_patch += 100 * ver_rel;
  471|     22|			ver_rel = 0;
  472|     22|		}
  473|     48|		if (ver_rel == 0 && ver_patch != 0) {
  ------------------
  |  Branch (473:7): [True: 23, False: 25]
  |  Branch (473:23): [True: 21, False: 2]
  ------------------
  474|     21|			if (elf_printf(ms, ".%u", ver_patch) == -1)
  ------------------
  |  Branch (474:8): [True: 0, False: 21]
  ------------------
  475|      0|				return -1;
  476|     27|		} else if (ver_rel != 0) {
  ------------------
  |  Branch (476:14): [True: 25, False: 2]
  ------------------
  477|     61|			while (ver_rel > 26) {
  ------------------
  |  Branch (477:11): [True: 36, False: 25]
  ------------------
  478|     36|				if (elf_printf(ms, "Z") == -1)
  ------------------
  |  Branch (478:9): [True: 0, False: 36]
  ------------------
  479|      0|					return -1;
  480|     36|				ver_rel -= 26;
  481|     36|			}
  482|     25|			if (elf_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
  ------------------
  |  Branch (482:8): [True: 0, False: 25]
  ------------------
  483|      0|				return -1;
  484|     25|		}
  485|     48|	}
  486|     50|	return 0;
  487|     50|}
readelf.c:do_note_freebsd_version:
  491|     63|{
  492|     63|	uint32_t desc;
  493|       |
  494|     63|	memcpy(&desc, v, sizeof(desc));
  495|     63|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     63|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  496|     63|	if (elf_printf(ms, ", for FreeBSD") == -1)
  ------------------
  |  Branch (496:6): [True: 0, False: 63]
  ------------------
  497|      0|		return -1;
  498|       |
  499|       |	/*
  500|       |	 * Contents is __FreeBSD_version, whose relation to OS
  501|       |	 * versions is defined by a huge table in the Porter's
  502|       |	 * Handbook.  This is the general scheme:
  503|       |	 *
  504|       |	 * Releases:
  505|       |	 * 	Mmp000 (before 4.10)
  506|       |	 * 	Mmi0p0 (before 5.0)
  507|       |	 * 	Mmm0p0
  508|       |	 *
  509|       |	 * Development branches:
  510|       |	 * 	Mmpxxx (before 4.6)
  511|       |	 * 	Mmp1xx (before 4.10)
  512|       |	 * 	Mmi1xx (before 5.0)
  513|       |	 * 	M000xx (pre-M.0)
  514|       |	 * 	Mmm1xx
  515|       |	 *
  516|       |	 * M = major version
  517|       |	 * m = minor version
  518|       |	 * i = minor version increment (491000 -> 4.10)
  519|       |	 * p = patchlevel
  520|       |	 * x = revision
  521|       |	 *
  522|       |	 * The first release of FreeBSD to use ELF by default
  523|       |	 * was version 3.0.
  524|       |	 */
  525|     63|	if (desc == 460002) {
  ------------------
  |  Branch (525:6): [True: 1, False: 62]
  ------------------
  526|      1|		if (elf_printf(ms, " 4.6.2") == -1)
  ------------------
  |  Branch (526:7): [True: 0, False: 1]
  ------------------
  527|      0|			return -1;
  528|     62|	} else if (desc < 460100) {
  ------------------
  |  Branch (528:13): [True: 23, False: 39]
  ------------------
  529|     23|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (529:7): [True: 0, False: 23]
  ------------------
  530|     23|		    desc / 10000 % 10) == -1)
  531|      0|			return -1;
  532|     23|		if (desc / 1000 % 10 > 0)
  ------------------
  |  Branch (532:7): [True: 14, False: 9]
  ------------------
  533|     14|			if (elf_printf(ms, ".%d", desc / 1000 % 10) == -1)
  ------------------
  |  Branch (533:8): [True: 0, False: 14]
  ------------------
  534|      0|				return -1;
  535|     23|		if ((desc % 1000 > 0) || (desc % 100000 == 0))
  ------------------
  |  Branch (535:7): [True: 20, False: 3]
  |  Branch (535:28): [True: 2, False: 1]
  ------------------
  536|     22|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (536:8): [True: 0, False: 22]
  ------------------
  537|      0|				return -1;
  538|     39|	} else if (desc < 500000) {
  ------------------
  |  Branch (538:13): [True: 6, False: 33]
  ------------------
  539|      6|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (539:7): [True: 0, False: 6]
  ------------------
  540|      6|		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
  541|      0|			return -1;
  542|      6|		if (desc / 100 % 10 > 0) {
  ------------------
  |  Branch (542:7): [True: 3, False: 3]
  ------------------
  543|      3|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (543:8): [True: 0, False: 3]
  ------------------
  544|      0|				return -1;
  545|      3|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (545:14): [True: 2, False: 1]
  ------------------
  546|      2|			if (elf_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (546:8): [True: 0, False: 2]
  ------------------
  547|      0|				return -1;
  548|      2|		}
  549|     33|	} else {
  550|     33|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (550:7): [True: 0, False: 33]
  ------------------
  551|     33|		    desc / 1000 % 100) == -1)
  552|      0|			return -1;
  553|     33|		if ((desc / 100 % 10 > 0) ||
  ------------------
  |  Branch (553:7): [True: 18, False: 15]
  ------------------
  554|     20|		    (desc % 100000 / 100 == 0)) {
  ------------------
  |  Branch (554:7): [True: 2, False: 13]
  ------------------
  555|     20|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (555:8): [True: 0, False: 20]
  ------------------
  556|      0|				return -1;
  557|     20|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (557:14): [True: 11, False: 2]
  ------------------
  558|     11|			if (elf_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (558:8): [True: 0, False: 11]
  ------------------
  559|      0|				return -1;
  560|     11|		}
  561|     33|	}
  562|     63|	return 0;
  563|     63|}
readelf.c:do_bid_note:
  570|  20.5k|{
  571|  20.5k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "GNU") &&
  ------------------
  |  |   67|  41.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 11.6k, False: 8.91k]
  |  |  |  Branch (67:29): [True: 1.15k, False: 10.5k]
  |  |  ------------------
  ------------------
  572|  1.15k|	    type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
  ------------------
  |  |  319|  21.7k|#define	NT_GNU_BUILD_ID		3
  ------------------
  |  Branch (572:6): [True: 467, False: 684]
  |  Branch (572:34): [True: 401, False: 66]
  |  Branch (572:49): [True: 13, False: 388]
  ------------------
  573|     13|		uint8_t desc[20];
  574|     13|		const char *btype;
  575|     13|		uint32_t i;
  576|     13|		*flags |= FLAGS_DID_BUILD_ID;
  ------------------
  |  |  353|     13|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  577|     13|		switch (descsz) {
  578|      2|		case 8:
  ------------------
  |  Branch (578:3): [True: 2, False: 11]
  ------------------
  579|      2|		    btype = "xxHash";
  580|      2|		    break;
  581|      7|		case 16:
  ------------------
  |  Branch (581:3): [True: 7, False: 6]
  ------------------
  582|      7|		    btype = "md5/uuid";
  583|      7|		    break;
  584|      2|		case 20:
  ------------------
  |  Branch (584:3): [True: 2, False: 11]
  ------------------
  585|      2|		    btype = "sha1";
  586|      2|		    break;
  587|      2|		default:
  ------------------
  |  Branch (587:3): [True: 2, False: 11]
  ------------------
  588|      2|		    btype = "unknown";
  589|      2|		    break;
  590|     13|		}
  591|     13|		if (elf_printf(ms, ", BuildID[%s]=", btype) == -1)
  ------------------
  |  Branch (591:7): [True: 0, False: 13]
  ------------------
  592|      0|			return -1;
  593|     13|		memcpy(desc, &nbuf[doff], descsz);
  594|    209|		for (i = 0; i < descsz; i++)
  ------------------
  |  Branch (594:15): [True: 196, False: 13]
  ------------------
  595|    196|		    if (elf_printf(ms, "%02x", desc[i]) == -1)
  ------------------
  |  Branch (595:11): [True: 0, False: 196]
  ------------------
  596|      0|			return -1;
  597|     13|		return 1;
  598|     13|	}
  599|  20.5k|	if (namesz == 4 && memcmp(RCAST(char *, &nbuf[noff]), "Go", 3) == 0 &&
  ------------------
  |  |  453|  11.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (599:6): [True: 11.6k, False: 8.91k]
  |  Branch (599:21): [True: 938, False: 10.7k]
  ------------------
  600|    938|	    type == NT_GO_BUILD_ID && descsz < 128) {
  ------------------
  |  |  365|  21.5k|#define NT_GO_BUILD_ID	4
  ------------------
  |  Branch (600:6): [True: 543, False: 395]
  |  Branch (600:32): [True: 345, False: 198]
  ------------------
  601|    345|		char buf[256];
  602|    345|		if (elf_printf(ms, ", Go BuildID=%s",
  ------------------
  |  Branch (602:7): [True: 0, False: 345]
  ------------------
  603|    345|		    file_copystr(buf, sizeof(buf), descsz,
  604|    345|		    RCAST(const char *, &nbuf[doff]))) == -1)
  ------------------
  |  |  453|    345|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  605|      0|			return -1;
  606|    345|		return 1;
  607|    345|	}
  608|  20.2k|	return 0;
  609|  20.5k|}
readelf.c:do_pax_note:
  732|  20.2k|{
  733|  20.2k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  20.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  734|       |
  735|  20.2k|	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |   67|  40.4k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 11.2k, False: 8.93k]
  |  |  |  Branch (67:29): [True: 999, False: 10.2k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |  330|  21.2k|#define NT_NETBSD_PAX		3
  ------------------
  |  Branch (735:33): [True: 440, False: 559]
  |  Branch (735:58): [True: 40, False: 400]
  ------------------
  736|     40|		static const char *pax[] = {
  737|     40|		    "+mprotect",
  738|     40|		    "-mprotect",
  739|     40|		    "+segvguard",
  740|     40|		    "-segvguard",
  741|     40|		    "+ASLR",
  742|     40|		    "-ASLR",
  743|     40|		};
  744|     40|		uint32_t desc;
  745|     40|		size_t i;
  746|     40|		int did = 0;
  747|       |
  748|     40|		*flags |= FLAGS_DID_NETBSD_PAX;
  ------------------
  |  |  355|     40|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  749|     40|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  750|     40|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     40|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  751|       |
  752|     40|		if (desc && elf_printf(ms, ", PaX: ") == -1)
  ------------------
  |  Branch (752:7): [True: 38, False: 2]
  |  Branch (752:15): [True: 0, False: 38]
  ------------------
  753|      0|			return -1;
  754|       |
  755|    280|		for (i = 0; i < __arraycount(pax); i++) {
  ------------------
  |  |  130|    280|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (755:15): [True: 240, False: 40]
  ------------------
  756|    240|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  452|    240|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (756:8): [True: 161, False: 79]
  ------------------
  757|    161|				continue;
  758|     79|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (758:8): [True: 0, False: 79]
  |  Branch (758:31): [True: 51, False: 28]
  ------------------
  759|     79|			    pax[i]) == -1)
  760|      0|				return -1;
  761|     79|		}
  762|     40|		return 1;
  763|     40|	}
  764|  20.1k|	return 0;
  765|  20.2k|}
readelf.c:do_memtag_note:
  771|  20.2k|{
  772|  20.2k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  20.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  773|       |
  774|  20.2k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  40.5k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.51k, False: 18.7k]
  |  |  |  Branch (67:29): [True: 350, False: 1.16k]
  |  |  ------------------
  ------------------
  775|    350|	    type == NT_ANDROID_MEMTAG && descsz == 4) {
  ------------------
  |  |  389|  20.6k|#define NT_ANDROID_MEMTAG	4
  ------------------
  |  Branch (775:6): [True: 115, False: 235]
  |  Branch (775:35): [True: 48, False: 67]
  ------------------
  776|     48|		static const char *memtag[] = {
  777|     48|		    "none",
  778|     48|		    "async",
  779|     48|		    "sync",
  780|     48|		    "heap",
  781|     48|		    "stack",
  782|     48|		};
  783|     48|		uint32_t desc;
  784|     48|		size_t i;
  785|     48|		int did = 0;
  786|       |
  787|     48|		*flags |= FLAGS_DID_ANDROID_MEMTAG;
  ------------------
  |  |  360|     48|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  788|     48|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  789|     48|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     48|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  790|       |
  791|     48|		if (desc && elf_printf(ms, ", Android Memtag: ") == -1)
  ------------------
  |  Branch (791:7): [True: 47, False: 1]
  |  Branch (791:15): [True: 0, False: 47]
  ------------------
  792|      0|			return -1;
  793|       |
  794|    288|		for (i = 0; i < __arraycount(memtag); i++) {
  ------------------
  |  |  130|    288|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (794:15): [True: 240, False: 48]
  ------------------
  795|    240|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  452|    240|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (795:8): [True: 148, False: 92]
  ------------------
  796|    148|				continue;
  797|     92|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (797:8): [True: 0, False: 92]
  |  Branch (797:31): [True: 54, False: 38]
  ------------------
  798|     92|			    memtag[i]) == -1)
  799|      0|				return -1;
  800|     92|		}
  801|     48|		return 1;
  802|     48|	}
  803|  20.2k|	return 0;
  804|  20.2k|}
readelf.c:do_core_note:
  810|  19.8k|{
  811|  19.8k|#ifdef ELFCORE
  812|  19.8k|	char buf[256];
  813|  19.8k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  19.8k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  814|       |
  815|  19.8k|	int os_style = -1;
  816|       |	/*
  817|       |	 * Sigh.  The 2.0.36 kernel in Debian 2.1, at
  818|       |	 * least, doesn't correctly implement name
  819|       |	 * sections, in core dumps, as specified by
  820|       |	 * the "Program Linking" section of "UNIX(R) System
  821|       |	 * V Release 4 Programmer's Guide: ANSI C and
  822|       |	 * Programming Support Tools", because my copy
  823|       |	 * clearly says "The first 'namesz' bytes in 'name'
  824|       |	 * contain a *null-terminated* [emphasis mine]
  825|       |	 * character representation of the entry's owner
  826|       |	 * or originator", but the 2.0.36 kernel code
  827|       |	 * doesn't include the terminating null in the
  828|       |	 * name....
  829|       |	 */
  830|  19.8k|	if ((namesz == 4 && memcmp(name, "CORE", 4) == 0) ||
  ------------------
  |  Branch (830:7): [True: 11.0k, False: 8.85k]
  |  Branch (830:22): [True: 1.05k, False: 9.96k]
  ------------------
  831|  18.8k|	    NAMEEQUALS(name, "CORE")) {
  ------------------
  |  |   67|  18.8k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.00k, False: 17.8k]
  |  |  |  Branch (67:29): [True: 114, False: 890]
  |  |  ------------------
  ------------------
  832|  1.16k|		os_style = OS_STYLE_SVR4;
  ------------------
  |  |  339|  1.16k|#define	OS_STYLE_SVR4		0
  ------------------
  833|  1.16k|	}
  834|       |
  835|  19.8k|	if (NAMEEQUALS(name, "FreeBSD")) {
  ------------------
  |  |   67|  19.8k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.49k, False: 18.3k]
  |  |  |  Branch (67:29): [True: 499, False: 999]
  |  |  ------------------
  ------------------
  836|    499|		os_style = OS_STYLE_FREEBSD;
  ------------------
  |  |  340|    499|#define	OS_STYLE_FREEBSD	1
  ------------------
  837|    499|	}
  838|       |
  839|  19.8k|	if ((namesz >= 11 && memcmp(name, "NetBSD-CORE", 11) == 0)) {
  ------------------
  |  Branch (839:7): [True: 1.26k, False: 18.6k]
  |  Branch (839:23): [True: 320, False: 944]
  ------------------
  840|    320|		os_style = OS_STYLE_NETBSD;
  ------------------
  |  |  341|    320|#define	OS_STYLE_NETBSD		2
  ------------------
  841|    320|	}
  842|       |
  843|  19.8k|	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
  ------------------
  |  |  354|  1.98k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (843:6): [True: 1.98k, False: 17.8k]
  |  Branch (843:24): [True: 688, False: 1.29k]
  ------------------
  844|    688|		if (elf_printf(ms, ", %s-style", os_style_names[os_style])
  ------------------
  |  Branch (844:7): [True: 0, False: 688]
  ------------------
  845|    688|		    == -1)
  846|      0|			return -1;
  847|    688|		*flags |= FLAGS_DID_CORE_STYLE;
  ------------------
  |  |  354|    688|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  848|    688|		*flags |= os_style;
  849|    688|	}
  850|       |
  851|  19.8k|	switch (os_style) {
  852|    320|	case OS_STYLE_NETBSD:
  ------------------
  |  |  341|    320|#define	OS_STYLE_NETBSD		2
  ------------------
  |  Branch (852:2): [True: 320, False: 19.5k]
  ------------------
  853|    320|		if (type == NT_NETBSD_CORE_PROCINFO) {
  ------------------
  |  |  232|    320|#define	NT_NETBSD_CORE_PROCINFO		1
  ------------------
  |  Branch (853:7): [True: 3, False: 317]
  ------------------
  854|      3|			char sbuf[512];
  855|      3|			struct NetBSD_elfcore_procinfo pi;
  856|      3|			memset(&pi, 0, sizeof(pi));
  857|      3|			memcpy(&pi, nbuf + doff, MIN(descsz, sizeof(pi)));
  ------------------
  |  Branch (857:29): [True: 2, False: 1]
  ------------------
  858|       |
  859|      3|			if (elf_printf(ms, ", from '%.31s', pid=%u, uid=%u, "
  ------------------
  |  Branch (859:8): [True: 0, False: 3]
  ------------------
  860|      3|			    "gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",
  861|      3|			    file_printable(ms, sbuf, sizeof(sbuf),
  862|      3|			    RCAST(char *, pi.cpi_name), sizeof(pi.cpi_name)),
  ------------------
  |  |  453|      3|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  863|      3|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_pid)),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  864|      3|			    elf_getu32(swap, pi.cpi_euid),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  865|      3|			    elf_getu32(swap, pi.cpi_egid),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  866|      3|			    elf_getu32(swap, pi.cpi_nlwps),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  867|      3|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_siglwp)),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  868|      3|			    elf_getu32(swap, pi.cpi_signo),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  869|      3|			    elf_getu32(swap, pi.cpi_sigcode)) == -1)
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  870|      0|				return -1;
  871|       |
  872|      3|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|      3|#define FLAGS_DID_CORE			0x0004
  ------------------
  873|      3|			return 1;
  874|      3|		}
  875|    317|		break;
  876|       |
  877|    499|	case OS_STYLE_FREEBSD:
  ------------------
  |  |  340|    499|#define	OS_STYLE_FREEBSD	1
  ------------------
  |  Branch (877:2): [True: 499, False: 19.3k]
  ------------------
  878|    499|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|    998|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|    174|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (878:7): [True: 174, False: 325]
  |  Branch (878:30): [True: 28, False: 146]
  ------------------
  879|     28|			size_t argoff, pidoff;
  880|       |
  881|     28|			if (clazz == ELFCLASS32)
  ------------------
  |  |  153|     28|#define	ELFCLASS32	1
  ------------------
  |  Branch (881:8): [True: 27, False: 1]
  ------------------
  882|     27|				argoff = 4 + 4 + 17;
  883|      1|			else
  884|      1|				argoff = 4 + 4 + 8 + 17;
  885|     28|			if (doff + argoff + 81 <= size) {
  ------------------
  |  Branch (885:8): [True: 11, False: 17]
  ------------------
  886|     11|				if (elf_printf(ms, ", from '%.80s'",
  ------------------
  |  Branch (886:9): [True: 0, False: 11]
  ------------------
  887|     11|				    nbuf + doff + argoff) == -1)
  888|      0|					return -1;
  889|     11|			}
  890|     28|			pidoff = argoff + 81 + 2;
  891|     28|			if (doff + pidoff + 4 <= size) {
  ------------------
  |  Branch (891:8): [True: 8, False: 20]
  ------------------
  892|      8|				if (elf_printf(ms, ", pid=%u",
  ------------------
  |  Branch (892:9): [True: 0, False: 8]
  ------------------
  893|      8|				    elf_getu32(swap, *RCAST(uint32_t *, (nbuf +
  ------------------
  |  |  158|      8|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  894|      8|				    doff + pidoff)))) == -1)
  895|      0|					return -1;
  896|      8|			}
  897|     28|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     28|#define FLAGS_DID_CORE			0x0004
  ------------------
  898|     28|		}			    
  899|    499|		break;
  900|       |
  901|  19.0k|	default:
  ------------------
  |  Branch (901:2): [True: 19.0k, False: 819]
  ------------------
  902|  19.0k|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|  38.1k|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|  2.24k|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (902:7): [True: 2.24k, False: 16.8k]
  |  Branch (902:30): [True: 1.72k, False: 522]
  ------------------
  903|  1.72k|			size_t i, j;
  904|  1.72k|			unsigned char c;
  905|       |			/*
  906|       |			 * Extract the program name.  We assume
  907|       |			 * it to be 16 characters (that's what it
  908|       |			 * is in SunOS 5.x and Linux).
  909|       |			 *
  910|       |			 * Unfortunately, it's at a different offset
  911|       |			 * in various OSes, so try multiple offsets.
  912|       |			 * If the characters aren't all printable,
  913|       |			 * reject it.
  914|       |			 */
  915|  13.3k|			for (i = 0; i < NOFFSETS; i++) {
  ------------------
  |  |  308|  13.3k|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|  13.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|  12.8k|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  12.8k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  306|    512|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    512|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (308:19): [True: 12.8k, False: 512]
  |  |  ------------------
  ------------------
  |  Branch (915:16): [True: 11.7k, False: 1.64k]
  ------------------
  916|  11.7k|				unsigned char *cname, *cp;
  917|  11.7k|				size_t reloffset = prpsoffsets(i);
  ------------------
  |  |  263|  11.7k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  11.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 11.2k, False: 428]
  |  |  ------------------
  |  |  264|  11.7k|			 ? prpsoffsets32[i]			\
  |  |  265|  11.7k|			 : prpsoffsets64[i])
  ------------------
  918|  11.7k|				size_t noffset = doff + reloffset;
  919|  11.7k|				size_t k;
  920|  13.1k|				for (j = 0; j < 16; j++, noffset++,
  ------------------
  |  Branch (920:17): [True: 13.1k, False: 25]
  ------------------
  921|  13.1k|				    reloffset++) {
  922|       |					/*
  923|       |					 * Make sure we're not past
  924|       |					 * the end of the buffer; if
  925|       |					 * we are, just give up.
  926|       |					 */
  927|  13.1k|					if (noffset >= size)
  ------------------
  |  Branch (927:10): [True: 2.36k, False: 10.7k]
  ------------------
  928|  2.36k|						goto tryanother;
  929|       |
  930|       |					/*
  931|       |					 * Make sure we're not past
  932|       |					 * the end of the contents;
  933|       |					 * if we are, this obviously
  934|       |					 * isn't the right offset.
  935|       |					 */
  936|  10.7k|					if (reloffset >= descsz)
  ------------------
  |  Branch (936:10): [True: 6.32k, False: 4.45k]
  ------------------
  937|  6.32k|						goto tryanother;
  938|       |
  939|  4.45k|					c = nbuf[noffset];
  940|  4.45k|					if (c == '\0') {
  ------------------
  |  Branch (940:10): [True: 755, False: 3.70k]
  ------------------
  941|       |						/*
  942|       |						 * A '\0' at the
  943|       |						 * beginning is
  944|       |						 * obviously wrong.
  945|       |						 * Any other '\0'
  946|       |						 * means we're done.
  947|       |						 */
  948|    755|						if (j == 0)
  ------------------
  |  Branch (948:11): [True: 698, False: 57]
  ------------------
  949|    698|							goto tryanother;
  950|     57|						else
  951|     57|							break;
  952|  3.70k|					} else {
  953|       |						/*
  954|       |						 * A nonprintable
  955|       |						 * character is also
  956|       |						 * wrong.
  957|       |						 */
  958|  3.70k|						if (!isprint(c) || isquote(c))
  ------------------
  |  |   58|  1.98k|#define isquote(c) (strchr("'\"`", (c)) != NULL)
  |  |  ------------------
  |  |  |  Branch (58:20): [True: 537, False: 1.44k]
  |  |  ------------------
  ------------------
  |  Branch (958:11): [True: 1.71k, False: 1.98k]
  ------------------
  959|  2.25k|							goto tryanother;
  960|  3.70k|					}
  961|  4.45k|				}
  962|       |				/*
  963|       |				 * Well, that worked.
  964|       |				 */
  965|       |
  966|       |				/*
  967|       |				 * Try next offsets, in case this match is
  968|       |				 * in the middle of a string.
  969|       |				 */
  970|    269|				for (k = i + 1 ; k < NOFFSETS; k++) {
  ------------------
  |  |  308|    269|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|    269|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|    253|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    253|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  306|     16|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     16|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (308:19): [True: 253, False: 16]
  |  |  ------------------
  ------------------
  |  Branch (970:22): [True: 187, False: 82]
  ------------------
  971|    187|					size_t no;
  972|    187|					int adjust = 1;
  973|    187|					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    187|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    187|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 175, False: 12]
  |  |  ------------------
  |  |  264|    187|			 ? prpsoffsets32[i]			\
  |  |  265|    187|			 : prpsoffsets64[i])
  ------------------
              					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    187|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    187|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 175, False: 12]
  |  |  ------------------
  |  |  264|    187|			 ? prpsoffsets32[i]			\
  |  |  265|    187|			 : prpsoffsets64[i])
  ------------------
  |  Branch (973:10): [True: 44, False: 143]
  ------------------
  974|     44|						continue;
  975|       |					/*
  976|       |					 * pr_fname == pr_psargs - 16 &&
  977|       |					 * non-nul-terminated fname (qemu)
  978|       |					 */
  979|    143|					if (prpsoffsets(k) ==
  ------------------
  |  |  263|    143|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    143|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 131, False: 12]
  |  |  ------------------
  |  |  264|    143|			 ? prpsoffsets32[i]			\
  |  |  265|    143|			 : prpsoffsets64[i])
  ------------------
  |  Branch (979:10): [True: 33, False: 110]
  ------------------
  980|    143|					    prpsoffsets(i) - 16 && j == 16)
  ------------------
  |  |  263|    143|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    143|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 131, False: 12]
  |  |  ------------------
  |  |  264|    143|			 ? prpsoffsets32[i]			\
  |  |  265|    143|			 : prpsoffsets64[i])
  ------------------
  |  Branch (980:33): [True: 16, False: 17]
  ------------------
  981|     16|						continue;
  982|    127|					for (no = doff + prpsoffsets(k);
  ------------------
  |  |  263|    127|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    127|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 115, False: 12]
  |  |  ------------------
  |  |  264|    127|			 ? prpsoffsets32[i]			\
  |  |  265|    127|			 : prpsoffsets64[i])
  ------------------
  983|  4.59k|					     no < doff + prpsoffsets(i); no++)
  ------------------
  |  |  263|  4.59k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  4.59k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 3.93k, False: 668]
  |  |  ------------------
  |  |  264|  4.59k|			 ? prpsoffsets32[i]			\
  |  |  265|  4.59k|			 : prpsoffsets64[i])
  ------------------
  |  Branch (983:11): [True: 4.47k, False: 127]
  ------------------
  984|  4.47k|						adjust = adjust
  ------------------
  |  Branch (984:16): [True: 1.54k, False: 2.92k]
  ------------------
  985|  4.47k|						         && isprint(nbuf[no]);
  ------------------
  |  Branch (985:19): [True: 1.45k, False: 96]
  ------------------
  986|    127|					if (adjust)
  ------------------
  |  Branch (986:10): [True: 31, False: 96]
  ------------------
  987|     31|						i = k;
  988|    127|				}
  989|       |
  990|     82|				cname = CAST(unsigned char *,
  ------------------
  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 78, False: 4]
  |  |  ------------------
  ------------------
  991|     82|				    &nbuf[doff + prpsoffsets(i)]);
  992|  6.89k|				for (cp = cname; cp < nbuf + size && *cp
  ------------------
  |  Branch (992:22): [True: 6.88k, False: 13]
  |  Branch (992:42): [True: 6.81k, False: 66]
  ------------------
  993|  6.89k|				    && isprint(*cp); cp++)
  ------------------
  |  Branch (993:12): [True: 6.81k, False: 3]
  ------------------
  994|  6.81k|					continue;
  995|       |				/*
  996|       |				 * Linux apparently appends a space at the end
  997|       |				 * of the command line: remove it.
  998|       |				 */
  999|    438|				while (cp > cname && isspace(cp[-1]))
  ------------------
  |  Branch (999:12): [True: 429, False: 9]
  |  Branch (999:26): [True: 356, False: 73]
  ------------------
 1000|    356|					cp--;
 1001|     82|				if (elf_printf(ms, ", from '%s'",
  ------------------
  |  Branch (1001:9): [True: 0, False: 82]
  ------------------
 1002|     82|				    file_copystr(buf, sizeof(buf),
 1003|     82|				    CAST(size_t, cp - cname),
  ------------------
  |  |  452|     82|#define CAST(T, b)	((T)(b))
  ------------------
 1004|     82|				    RCAST(char *, cname))) == -1)
  ------------------
  |  |  453|     82|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1005|      0|					return -1;
 1006|     82|				*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     82|#define FLAGS_DID_CORE			0x0004
  ------------------
 1007|     82|				return 1;
 1008|       |
 1009|  11.6k|			tryanother:
 1010|  11.6k|				;
 1011|  11.6k|			}
 1012|  1.72k|		}
 1013|  18.9k|		break;
 1014|  19.8k|	}
 1015|  19.7k|#endif
 1016|  19.7k|	return 0;
 1017|  19.8k|}
readelf.c:do_auxv_note:
 1094|  20.0k|{
 1095|  20.0k|#ifdef ELFCORE
 1096|  20.0k|	Aux32Info auxv32;
 1097|  20.0k|	Aux64Info auxv64;
 1098|  20.0k|	size_t elsize = xauxv_sizeof;
  ------------------
  |  |  253|  20.0k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 16.9k, False: 3.03k]
  |  |  ------------------
  |  |  254|  20.0k|			 ? sizeof(auxv32)			\
  |  |  255|  20.0k|			 : sizeof(auxv64))
  ------------------
 1099|  20.0k|	const char *tag;
 1100|  20.0k|	int is_string;
 1101|  20.0k|	size_t nval, off;
 1102|       |
 1103|  20.0k|	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  361|  20.0k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  354|  20.0k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (1103:6): [True: 16.9k, False: 3.10k]
  ------------------
 1104|  20.0k|	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  361|  20.0k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  354|  20.0k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
 1105|  16.9k|		return 0;
 1106|       |
 1107|  3.10k|	switch (*flags & FLAGS_CORE_STYLE) {
  ------------------
  |  |  349|  3.10k|#define FLAGS_CORE_STYLE		0x0003
  ------------------
 1108|  1.54k|	case OS_STYLE_SVR4:
  ------------------
  |  |  339|  1.54k|#define	OS_STYLE_SVR4		0
  ------------------
  |  Branch (1108:2): [True: 1.54k, False: 1.56k]
  ------------------
 1109|  1.54k|		if (type != NT_AUXV)
  ------------------
  |  |  281|  1.54k|#define	NT_AUXV		6
  ------------------
  |  Branch (1109:7): [True: 1.01k, False: 537]
  ------------------
 1110|  1.01k|			return 0;
 1111|    537|		break;
 1112|       |#ifdef notyet
 1113|       |	case OS_STYLE_NETBSD:
 1114|       |		if (type != NT_NETBSD_CORE_AUXV)
 1115|       |			return 0;
 1116|       |		break;
 1117|       |	case OS_STYLE_FREEBSD:
 1118|       |		if (type != NT_FREEBSD_PROCSTAT_AUXV)
 1119|       |			return 0;
 1120|       |		break;
 1121|       |#endif
 1122|  1.56k|	default:
  ------------------
  |  Branch (1122:2): [True: 1.56k, False: 1.54k]
  ------------------
 1123|  1.56k|		return 0;
 1124|  3.10k|	}
 1125|       |
 1126|    537|	*flags |= FLAGS_DID_AUXV;
  ------------------
  |  |  362|    537|#define FLAGS_DID_AUXV			0x2000
  ------------------
 1127|       |
 1128|    537|	nval = 0;
 1129|  7.20k|	for (off = 0; off + elsize <= descsz; off += elsize) {
  ------------------
  |  Branch (1129:16): [True: 6.67k, False: 525]
  ------------------
 1130|  6.67k|		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  250|  6.67k|#define xauxv_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.67k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (250:21): [True: 2.84k, False: 3.83k]
  |  |  ------------------
  |  |  251|  6.67k|			 ? CAST(void *, &auxv32)		\
  |  |  ------------------
  |  |  |  |  452|  2.84k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  252|  6.67k|			 : CAST(void *, &auxv64))
  |  |  ------------------
  |  |  |  |  452|  3.83k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  253|  6.67k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.67k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 2.84k, False: 3.83k]
  |  |  ------------------
  |  |  254|  6.67k|			 ? sizeof(auxv32)			\
  |  |  255|  6.67k|			 : sizeof(auxv64))
  ------------------
 1131|       |		/* Limit processing to 50 vector entries to prevent DoS */
 1132|  6.67k|		if (nval++ >= 50) {
  ------------------
  |  Branch (1132:7): [True: 12, False: 6.66k]
  ------------------
 1133|     12|			file_error(ms, 0, "Too many ELF Auxv elements");
 1134|     12|			return 1;
 1135|     12|		}
 1136|       |
 1137|  6.66k|		switch(xauxv_type) {
  ------------------
  |  |  256|  6.66k|#define xauxv_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.66k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (256:21): [True: 2.83k, False: 3.82k]
  |  |  ------------------
  |  |  257|  6.66k|			 ? elf_getu32(swap, auxv32.a_type)	\
  |  |  ------------------
  |  |  |  |  158|  2.83k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  258|  6.66k|			 : elf_getu64(swap, auxv64.a_type))
  |  |  ------------------
  |  |  |  |  159|  3.82k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1138|    988|		case AT_LINUX_EXECFN:
  ------------------
  |  |   90|    988|#define AT_LINUX_EXECFN 31   /* filename of program */
  ------------------
  |  Branch (1138:3): [True: 988, False: 5.67k]
  ------------------
 1139|    988|			is_string = 1;
 1140|    988|			tag = "execfn";
 1141|    988|			break;
 1142|    785|		case AT_LINUX_PLATFORM:
  ------------------
  |  |   81|    785|#define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
  ------------------
  |  Branch (1142:3): [True: 785, False: 5.87k]
  ------------------
 1143|    785|			is_string = 1;
 1144|    785|			tag = "platform";
 1145|    785|			break;
 1146|     40|		case AT_LINUX_UID:
  ------------------
  |  |   77|     40|#define AT_LINUX_UID    11    /* real uid */
  ------------------
  |  Branch (1146:3): [True: 40, False: 6.62k]
  ------------------
 1147|     40|			is_string = 0;
 1148|     40|			tag = "real uid";
 1149|     40|			break;
 1150|     35|		case AT_LINUX_GID:
  ------------------
  |  |   79|     35|#define AT_LINUX_GID    13    /* real gid */
  ------------------
  |  Branch (1150:3): [True: 35, False: 6.62k]
  ------------------
 1151|     35|			is_string = 0;
 1152|     35|			tag = "real gid";
 1153|     35|			break;
 1154|     51|		case AT_LINUX_EUID:
  ------------------
  |  |   78|     51|#define AT_LINUX_EUID   12    /* effective uid */
  ------------------
  |  Branch (1154:3): [True: 51, False: 6.61k]
  ------------------
 1155|     51|			is_string = 0;
 1156|     51|			tag = "effective uid";
 1157|     51|			break;
 1158|     64|		case AT_LINUX_EGID:
  ------------------
  |  |   80|     64|#define AT_LINUX_EGID   14    /* effective gid */
  ------------------
  |  Branch (1158:3): [True: 64, False: 6.60k]
  ------------------
 1159|     64|			is_string = 0;
 1160|     64|			tag = "effective gid";
 1161|     64|			break;
 1162|  4.70k|		default:
  ------------------
  |  Branch (1162:3): [True: 4.70k, False: 1.96k]
  ------------------
 1163|  4.70k|			is_string = 0;
 1164|  4.70k|			tag = NULL;
 1165|  4.70k|			break;
 1166|  6.66k|		}
 1167|       |
 1168|  6.66k|		if (tag == NULL)
  ------------------
  |  Branch (1168:7): [True: 4.70k, False: 1.96k]
  ------------------
 1169|  4.70k|			continue;
 1170|       |
 1171|  1.96k|		if (is_string) {
  ------------------
  |  Branch (1171:7): [True: 1.77k, False: 190]
  ------------------
 1172|  1.77k|			char buf[256];
 1173|  1.77k|			ssize_t buflen;
 1174|  1.77k|			buflen = get_string_on_virtaddr(ms, swap, clazz, fd,
 1175|  1.77k|			    ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf));
  ------------------
  |  |  259|  1.77k|#define xauxv_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.77k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (259:20): [True: 950, False: 823]
  |  |  ------------------
  |  |  260|  1.77k|			 ? elf_getu32(swap, auxv32.a_v)		\
  |  |  ------------------
  |  |  |  |  158|    950|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  261|  1.77k|			 : elf_getu64(swap, auxv64.a_v))
  |  |  ------------------
  |  |  |  |  159|    823|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1176|       |
 1177|  1.77k|			if (buflen == 0)
  ------------------
  |  Branch (1177:8): [True: 1.71k, False: 56]
  ------------------
 1178|  1.71k|				continue;
 1179|       |
 1180|     56|			if (elf_printf(ms, ", %s: '%s'", tag, buf) == -1)
  ------------------
  |  Branch (1180:8): [True: 0, False: 56]
  ------------------
 1181|      0|				return -1;
 1182|    190|		} else {
 1183|    190|			if (elf_printf(ms, ", %s: %d", tag,
  ------------------
  |  Branch (1183:8): [True: 0, False: 190]
  ------------------
 1184|    190|			    CAST(int, xauxv_val)) == -1)
  ------------------
  |  |  452|    380|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 164, False: 26]
  |  |  ------------------
  ------------------
 1185|      0|				return -1;
 1186|    190|		}
 1187|  1.96k|	}
 1188|    525|	return 1;
 1189|       |#else
 1190|       |	return 0;
 1191|       |#endif
 1192|    537|}
readelf.c:get_string_on_virtaddr:
 1057|  1.77k|{
 1058|  1.77k|	char *bptr;
 1059|  1.77k|	off_t offset;
 1060|       |
 1061|  1.77k|	if (buflen == 0)
  ------------------
  |  Branch (1061:6): [True: 0, False: 1.77k]
  ------------------
 1062|      0|		return 0;
 1063|       |
 1064|  1.77k|	offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
 1065|  1.77k|	    fsize, virtaddr);
 1066|  1.77k|	if (offset < 0 ||
  ------------------
  |  Branch (1066:6): [True: 174, False: 1.59k]
  ------------------
 1067|  1.59k|	    (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
  ------------------
  |  |  452|  1.59k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1067:6): [True: 614, False: 985]
  ------------------
 1068|    788|		(void)elf_printf(ms, ", can't read elf string at %jd",
 1069|    788|		    (intmax_t)offset);
 1070|    788|		return 0;
 1071|    788|	}
 1072|       |
 1073|    985|	buf[buflen - 1] = '\0';
 1074|       |
 1075|       |	/* We expect only printable characters, so return if buffer contains
 1076|       |	 * non-printable character before the '\0' or just '\0'. */
 1077|  1.52k|	for (bptr = buf; *bptr && isprint(CAST(unsigned char, *bptr)); bptr++)
  ------------------
  |  Branch (1077:19): [True: 1.36k, False: 161]
  |  Branch (1077:28): [True: 536, False: 824]
  ------------------
 1078|    536|		continue;
 1079|    985|	if (*bptr != '\0')
  ------------------
  |  Branch (1079:6): [True: 824, False: 161]
  ------------------
 1080|    824|		return 0;
 1081|       |
 1082|    161|	return bptr - buf;
 1083|    985|}
readelf.c:get_offset_from_virtaddr:
 1022|  1.77k|{
 1023|  1.77k|	Elf32_Phdr ph32;
 1024|  1.77k|	Elf64_Phdr ph64;
 1025|       |
 1026|       |	/*
 1027|       |	 * Loop through all the program headers and find the header with
 1028|       |	 * virtual address in which the "virtaddr" belongs to.
 1029|       |	 */
 1030|  22.4k|	for ( ; num; num--) {
  ------------------
  |  Branch (1030:10): [True: 22.3k, False: 96]
  ------------------
 1031|  22.3k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  22.3k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 10.6k, False: 11.6k]
  |  |  ------------------
  |  |  181|  22.3k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  452|  10.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  22.3k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  452|  11.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  22.3k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 10.6k, False: 11.6k]
  |  |  ------------------
  |  |  184|  22.3k|			 ? sizeof(ph32)				\
  |  |  185|  22.3k|			 : sizeof(ph64))
  ------------------
  |  Branch (1031:7): [True: 710, False: 21.6k]
  ------------------
 1032|  22.3k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  452|  44.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 10.6k, False: 11.6k]
  |  |  ------------------
  ------------------
 1033|    710|			if (elf_printf(ms,
  ------------------
  |  Branch (1033:8): [True: 0, False: 710]
  ------------------
 1034|    710|			    ", can't read elf program header at %jd",
 1035|    710|			    (intmax_t)off) == -1)
 1036|      0|				return -1;
 1037|    710|			return 0;
 1038|       |
 1039|    710|		}
 1040|  21.6k|		off += xph_sizeof;
  ------------------
  |  |  183|  21.6k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 10.2k, False: 11.3k]
  |  |  ------------------
  |  |  184|  21.6k|			 ? sizeof(ph32)				\
  |  |  185|  21.6k|			 : sizeof(ph64))
  ------------------
 1041|       |
 1042|  21.6k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  21.6k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  43.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  21.6k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  43.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 10.2k, False: 11.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  21.6k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  21.6k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1042:7): [True: 21.6k, False: 0]
  |  Branch (1042:32): [True: 12.9k, False: 8.60k]
  ------------------
 1043|       |			/* Perhaps warn here */
 1044|  12.9k|			continue;
 1045|  12.9k|		}
 1046|       |
 1047|  8.60k|		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  8.60k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  34.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.55k, False: 591]
  |  |  |  |  |  Branch (452:25): [True: 4.74k, False: 711]
  |  |  |  |  |  Branch (452:25): [True: 3.14k, False: 5.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  8.60k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  8.60k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  8.60k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  8.60k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  5.15k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  20.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.78k, False: 584]
  |  |  |  |  |  Branch (452:25): [True: 2.09k, False: 695]
  |  |  |  |  |  Branch (452:25): [True: 2.36k, False: 2.78k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  5.15k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  5.15k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  5.15k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  5.15k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  202|  5.15k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  10.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.36k, False: 2.78k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1047:7): [True: 5.15k, False: 3.45k]
  |  Branch (1047:32): [True: 967, False: 4.18k]
  ------------------
 1048|    967|			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  189|    967|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  1.93k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 483, False: 484]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|    967|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|    967|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
              			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  197|    967|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  3.86k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 400, False: 83]
  |  |  |  |  |  Branch (452:25): [True: 360, False: 124]
  |  |  |  |  |  Branch (452:25): [True: 483, False: 484]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|    967|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|    967|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|    967|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|    967|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
 1049|  8.60k|	}
 1050|     96|	return 0;
 1051|  1.77k|}
readelf.c:getu32:
  113|   606k|{
  114|   606k|	union {
  115|   606k|		uint32_t ui;
  116|   606k|		char c[4];
  117|   606k|	} retval, tmpval;
  118|       |
  119|   606k|	if (swap) {
  ------------------
  |  Branch (119:6): [True: 144k, False: 462k]
  ------------------
  120|   144k|		tmpval.ui = value;
  121|       |
  122|   144k|		retval.c[0] = tmpval.c[3];
  123|   144k|		retval.c[1] = tmpval.c[2];
  124|   144k|		retval.c[2] = tmpval.c[1];
  125|   144k|		retval.c[3] = tmpval.c[0];
  126|       |
  127|   144k|		return retval.ui;
  128|   144k|	} else
  129|   462k|		return value;
  130|   606k|}
readelf.c:dophn_exec:
 1740|  1.62k|{
 1741|  1.62k|	Elf32_Phdr ph32;
 1742|  1.62k|	Elf64_Phdr ph64;
 1743|  1.62k|	const char *str;
 1744|  1.62k|	unsigned char nbuf[NBUFSIZE];
 1745|  1.62k|	char interp[NBUFSIZE];
 1746|  1.62k|	ssize_t bufsize;
 1747|  1.62k|	size_t offset, align, need = 0;
 1748|  1.62k|	int pie = 0, dynamic = 0;
 1749|       |
 1750|  1.62k|	if (num == 0) {
  ------------------
  |  Branch (1750:6): [True: 530, False: 1.09k]
  ------------------
 1751|    530|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (1751:7): [True: 0, False: 530]
  ------------------
 1752|      0|			return -1;
 1753|    530|		return 0;
 1754|    530|	}
 1755|  1.09k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  1.09k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.09k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 572, False: 519]
  |  |  ------------------
  |  |  184|  1.09k|			 ? sizeof(ph32)				\
  |  |  185|  1.09k|			 : sizeof(ph64))
  ------------------
  |  Branch (1755:6): [True: 328, False: 763]
  ------------------
 1756|    328|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (1756:7): [True: 0, False: 328]
  ------------------
 1757|      0|			return -1;
 1758|    328|		return 0;
 1759|    328|	}
 1760|       |
 1761|    763|	interp[0] = '\0';
 1762|  27.7k|  	for ( ; num; num--) {
  ------------------
  |  Branch (1762:12): [True: 27.6k, False: 50]
  ------------------
 1763|  27.6k|		int doread;
 1764|  27.6k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  27.6k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 22.5k, False: 5.13k]
  |  |  ------------------
  |  |  181|  27.6k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  452|  22.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  27.6k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  452|  5.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  27.6k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 22.5k, False: 5.13k]
  |  |  ------------------
  |  |  184|  27.6k|			 ? sizeof(ph32)				\
  |  |  185|  27.6k|			 : sizeof(ph64))
  ------------------
  |  Branch (1764:7): [True: 703, False: 26.9k]
  ------------------
 1765|  27.6k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  452|  55.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 22.5k, False: 5.13k]
  |  |  ------------------
  ------------------
 1766|    703|			if (elf_printf(ms,
  ------------------
  |  Branch (1766:8): [True: 0, False: 703]
  ------------------
 1767|    703|			    ", can't read elf program headers at %jd",
 1768|    703|			    (intmax_t)off) == -1)
 1769|      0|				return -1;
 1770|    703|			return 0;
 1771|    703|		}
 1772|       |
 1773|  26.9k|		off += size;
 1774|  26.9k|		bufsize = 0;
 1775|  26.9k|		align = 4;
 1776|       |
 1777|       |		/* Things we can determine before we seek */
 1778|  26.9k|		switch (xph_type) {
  ------------------
  |  |  186|  26.9k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  26.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 22.1k, False: 4.78k]
  |  |  ------------------
  |  |  187|  26.9k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  22.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  26.9k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  4.78k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1779|  1.60k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  1.60k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1779:3): [True: 1.60k, False: 25.3k]
  ------------------
 1780|  1.60k|			doread = 1;
 1781|  1.60k|			break;
 1782|  4.04k|		case PT_NOTE:
  ------------------
  |  |  201|  4.04k|#define	PT_NOTE		4
  ------------------
  |  Branch (1782:3): [True: 4.04k, False: 22.9k]
  ------------------
 1783|  4.04k|			if (sh_num)	/* Did this through section headers */
  ------------------
  |  Branch (1783:8): [True: 507, False: 3.54k]
  ------------------
 1784|    507|				continue;
 1785|  3.54k|			if (((align = xph_align) & 0x80000000UL) != 0 ||
  ------------------
  |  |  192|  3.54k|#define xph_align	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  14.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.35k, False: 896]
  |  |  |  |  |  Branch (452:25): [True: 1.10k, False: 187]
  |  |  |  |  |  Branch (452:25): [True: 2.25k, False: 1.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|  3.54k|			 ? CAST(off_t, (ph32.p_align ? 		\
  |  |  194|  3.54k|			    elf_getu32(swap, ph32.p_align) : 4))\
  |  |  195|  3.54k|			 : CAST(off_t, (ph64.p_align ?		\
  |  |  196|  3.54k|			    elf_getu64(swap, ph64.p_align) : 4))))
  ------------------
  |  Branch (1785:8): [True: 274, False: 3.26k]
  ------------------
 1786|  3.26k|			    align < 4) {
  ------------------
  |  Branch (1786:8): [True: 634, False: 2.63k]
  ------------------
 1787|    908|				if (elf_printf(ms,
  ------------------
  |  Branch (1787:9): [True: 0, False: 908]
  ------------------
 1788|    908|				    ", invalid note alignment %#lx",
 1789|    908|				    CAST(unsigned long, align)) == -1)
  ------------------
  |  |  452|    908|#define CAST(T, b)	((T)(b))
  ------------------
 1790|      0|					return -1;
 1791|    908|				align = 4;
 1792|    908|			}
 1793|       |			/*FALLTHROUGH*/
 1794|  4.21k|		case PT_INTERP:
  ------------------
  |  |  200|  4.21k|#define	PT_INTERP	3
  ------------------
  |  Branch (1794:3): [True: 673, False: 26.2k]
  ------------------
 1795|  4.21k|			doread = 1;
 1796|  4.21k|			break;
 1797|  20.6k|		default:
  ------------------
  |  Branch (1797:3): [True: 20.6k, False: 6.33k]
  ------------------
 1798|  20.6k|			doread = 0;
 1799|  20.6k|			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  20.6k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  41.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  20.6k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  41.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 17.3k, False: 3.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  20.6k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  20.6k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1799:8): [True: 20.6k, False: 0]
  |  Branch (1799:33): [True: 11.7k, False: 8.91k]
  ------------------
 1800|       |				/* Maybe warn here? */
 1801|  11.7k|				continue;
 1802|  11.7k|			}
 1803|  8.91k|			break;
 1804|  26.9k|		}
 1805|       |
 1806|  14.7k|		if (doread) {
  ------------------
  |  Branch (1806:7): [True: 5.82k, False: 8.91k]
  ------------------
 1807|  5.82k|			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  5.82k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  11.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 4.33k, False: 1.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  5.82k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  5.82k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  2.36k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  4.72k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.98k, False: 382]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  5.82k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  5.82k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (1807:17): [True: 2.36k, False: 3.46k]
  ------------------
 1808|  5.82k|			    : sizeof(nbuf);
 1809|  5.82k|			off_t offs = xph_offset;
  ------------------
  |  |  189|  5.82k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  11.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 4.33k, False: 1.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  5.82k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  5.82k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
 1810|  5.82k|			bufsize = pread(fd, nbuf, len, offs);
 1811|  5.82k|			if (bufsize == -1) {
  ------------------
  |  Branch (1811:8): [True: 10, False: 5.81k]
  ------------------
 1812|     10|				if (elf_printf(ms,
  ------------------
  |  Branch (1812:9): [True: 0, False: 10]
  ------------------
 1813|     10|				    ", can't read section at %jd",
 1814|     10|				    (intmax_t)offs) == -1)
 1815|      0|					return -1;
 1816|     10|				return 0;
 1817|     10|			}
 1818|  5.82k|		}
 1819|       |
 1820|       |		/* Things we can determine when we seek */
 1821|  14.7k|		switch (xph_type) {
  ------------------
  |  |  186|  14.7k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  14.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 11.4k, False: 3.29k]
  |  |  ------------------
  |  |  187|  14.7k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  11.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  14.7k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  3.29k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1822|  1.60k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  1.60k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1822:3): [True: 1.60k, False: 13.1k]
  ------------------
 1823|  1.60k|			dynamic = 1;
 1824|  1.60k|			offset = 0;
 1825|       |			// Let DF_1 determine if we are PIE or not.
 1826|  1.60k|			ms->mode &= ~0111;
 1827|  35.3k|			for (;;) {
 1828|  35.3k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  452|  35.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1828:9): [True: 1.60k, False: 33.7k]
  ------------------
 1829|  1.60k|					break;
 1830|  33.7k|				offset = dodynamic(ms, nbuf, offset,
 1831|  33.7k|				    CAST(size_t, bufsize), clazz, swap,
  ------------------
  |  |  452|  33.7k|#define CAST(T, b)	((T)(b))
  ------------------
 1832|  33.7k|				    &pie, &need);
 1833|  33.7k|				if (offset == 0)
  ------------------
  |  Branch (1833:9): [True: 0, False: 33.7k]
  ------------------
 1834|      0|					break;
 1835|  33.7k|			}
 1836|  1.60k|			break;
 1837|       |
 1838|  33.7k|		case PT_INTERP:
  ------------------
  |  |  200|    673|#define	PT_INTERP	3
  ------------------
  |  Branch (1838:3): [True: 673, False: 14.0k]
  ------------------
 1839|    673|			need++;
 1840|    673|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    673|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    673|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    673|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1840:8): [True: 0, False: 673]
  ------------------
 1841|      0|				continue;
 1842|    673|			if (bufsize && nbuf[0]) {
  ------------------
  |  Branch (1842:8): [True: 476, False: 197]
  |  Branch (1842:19): [True: 305, False: 171]
  ------------------
 1843|    305|				nbuf[bufsize - 1] = '\0';
 1844|    305|				str = RCAST(const char *, nbuf);
  ------------------
  |  |  453|    305|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1845|    305|			} else
 1846|    368|				str = "*empty*";
 1847|    673|			strlcpy(interp, str, sizeof(interp));
 1848|    673|			break;
 1849|  3.53k|		case PT_NOTE:
  ------------------
  |  |  201|  3.53k|#define	PT_NOTE		4
  ------------------
  |  Branch (1849:3): [True: 3.53k, False: 11.2k]
  ------------------
 1850|  3.53k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  3.53k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  3.53k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  3.53k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1850:8): [True: 0, False: 3.53k]
  ------------------
 1851|      0|				return 0;
 1852|       |			/*
 1853|       |			 * This is a PT_NOTE section; loop through all the notes
 1854|       |			 * in the section.
 1855|       |			 */
 1856|  3.53k|			offset = 0;
 1857|  6.78k|			for (;;) {
 1858|  6.78k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  452|  6.78k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1858:9): [True: 2.90k, False: 3.88k]
  ------------------
 1859|  2.90k|					break;
 1860|  3.88k|				offset = donote(ms, nbuf, offset,
 1861|  3.88k|				    CAST(size_t, bufsize), clazz, swap, align,
  ------------------
  |  |  452|  3.88k|#define CAST(T, b)	((T)(b))
  ------------------
 1862|  3.88k|				    flags, notecount, fd, 0, 0, 0);
 1863|  3.88k|				if (offset == 0)
  ------------------
  |  Branch (1863:9): [True: 623, False: 3.25k]
  ------------------
 1864|    623|					break;
 1865|  3.88k|			}
 1866|  3.53k|			break;
 1867|  8.91k|		default:
  ------------------
  |  Branch (1867:3): [True: 8.91k, False: 5.81k]
  ------------------
 1868|  8.91k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  8.91k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  8.91k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  8.91k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1868:8): [True: 0, False: 8.91k]
  ------------------
 1869|      0|				continue;
 1870|  8.91k|			break;
 1871|  14.7k|		}
 1872|  14.7k|	}
 1873|     50|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|     50|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|     50|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|     50|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1873:6): [True: 0, False: 50]
  ------------------
 1874|      0|		return 0;
 1875|     50|	if (dynamic) {
  ------------------
  |  Branch (1875:6): [True: 22, False: 28]
  ------------------
 1876|     22|		if (pie && need == 0)
  ------------------
  |  Branch (1876:7): [True: 4, False: 18]
  |  Branch (1876:14): [True: 2, False: 2]
  ------------------
 1877|      2|			str = "static-pie";
 1878|     20|		else
 1879|     20|			str = "dynamically";
 1880|     28|	} else {
 1881|     28|		str = "statically";
 1882|     28|	}
 1883|     50|	if (elf_printf(ms, ", %s linked", str) == -1)
  ------------------
  |  Branch (1883:6): [True: 0, False: 50]
  ------------------
 1884|      0|		return -1;
 1885|     50|	if (interp[0])
  ------------------
  |  Branch (1885:6): [True: 9, False: 41]
  ------------------
 1886|      9|		if (elf_printf(ms, ", interpreter %s", file_printable(ms,
  ------------------
  |  Branch (1886:7): [True: 2, False: 7]
  ------------------
 1887|      9|		    RCAST(char *, nbuf), sizeof(nbuf),
  ------------------
  |  |  453|      9|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1888|      9|		    interp, sizeof(interp))) == -1)
 1889|      2|			return -1;
 1890|     48|	return 0;
 1891|     50|}
readelf.c:dodynamic:
 1197|  33.7k|{
 1198|  33.7k|	Elf32_Dyn dh32;
 1199|  33.7k|	Elf64_Dyn dh64;
 1200|  33.7k|	unsigned char *dbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  452|  33.7k|#define CAST(T, b)	((T)(b))
  ------------------
 1201|       |
 1202|  33.7k|	if (xdh_sizeof + offset > size) {
  ------------------
  |  |  227|  33.7k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 29.1k, False: 4.54k]
  |  |  ------------------
  |  |  228|  33.7k|			 ? sizeof(dh32)				\
  |  |  229|  33.7k|			 : sizeof(dh64))
  ------------------
  |  Branch (1202:6): [True: 1.26k, False: 32.4k]
  ------------------
 1203|       |		/*
 1204|       |		 * We're out of note headers.
 1205|       |		 */
 1206|  1.26k|		return xdh_sizeof + offset;
  ------------------
  |  |  227|  1.26k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.26k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 1.12k, False: 136]
  |  |  ------------------
  |  |  228|  1.26k|			 ? sizeof(dh32)				\
  |  |  229|  1.26k|			 : sizeof(dh64))
  ------------------
 1207|  1.26k|	}
 1208|       |
 1209|  32.4k|	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  224|  32.4k|#define xdh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (224:19): [True: 28.0k, False: 4.40k]
  |  |  ------------------
  |  |  225|  32.4k|			 ? CAST(void *, &dh32)			\
  |  |  ------------------
  |  |  |  |  452|  28.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  226|  32.4k|			 : CAST(void *, &dh64))
  |  |  ------------------
  |  |  |  |  452|  4.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  227|  32.4k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 28.0k, False: 4.40k]
  |  |  ------------------
  |  |  228|  32.4k|			 ? sizeof(dh32)				\
  |  |  229|  32.4k|			 : sizeof(dh64))
  ------------------
 1210|  32.4k|	offset += xdh_sizeof;
  ------------------
  |  |  227|  32.4k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 28.0k, False: 4.40k]
  |  |  ------------------
  |  |  228|  32.4k|			 ? sizeof(dh32)				\
  |  |  229|  32.4k|			 : sizeof(dh64))
  ------------------
 1211|       |
 1212|  32.4k|	switch (xdh_tag) {
  ------------------
  |  |  230|  32.4k|#define xdh_tag		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (230:19): [True: 28.0k, False: 4.40k]
  |  |  ------------------
  |  |  231|  32.4k|			 ? elf_getu32(swap, dh32.d_tag)		\
  |  |  ------------------
  |  |  |  |  158|  28.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  232|  32.4k|			 : elf_getu64(swap, dh64.d_tag))
  |  |  ------------------
  |  |  |  |  159|  4.40k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1213|  1.29k|	case DT_FLAGS_1:
  ------------------
  |  |  531|  1.29k|#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
  ------------------
  |  Branch (1213:2): [True: 1.29k, False: 31.1k]
  ------------------
 1214|  1.29k|		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  233|  1.29k|#define xdh_val		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.29k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (233:19): [True: 932, False: 364]
  |  |  ------------------
  |  |  234|  1.29k|			 ? elf_getu32(swap, dh32.d_un.d_val)	\
  |  |  ------------------
  |  |  |  |  158|    932|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  235|  1.29k|			 : elf_getu64(swap, dh64.d_un.d_val))
  |  |  ------------------
  |  |  |  |  159|    364|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
              		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  574|  1.29k|#define	DF_1_PIE	0x08000000	/* Position Independent Executable */
  ------------------
  |  Branch (1214:7): [True: 650, False: 646]
  ------------------
 1215|    650|			*pie = 1;
 1216|    650|			ms->mode |= 0111;
 1217|    650|		} else
 1218|    646|			ms->mode &= ~0111;
 1219|  1.29k|		break;
 1220|    459|	case DT_NEEDED:
  ------------------
  |  |  494|    459|#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
  ------------------
  |  Branch (1220:2): [True: 459, False: 32.0k]
  ------------------
 1221|    459|		(*need)++;
 1222|    459|		break;
 1223|  30.7k|	default:
  ------------------
  |  Branch (1223:2): [True: 30.7k, False: 1.75k]
  ------------------
 1224|  30.7k|		break;
 1225|  32.4k|	}
 1226|  32.4k|	return offset;
 1227|  32.4k|}
readelf.c:doshn:
 1432|  1.66k|{
 1433|  1.66k|	Elf32_Shdr sh32;
 1434|  1.66k|	Elf64_Shdr sh64;
 1435|  1.66k|	int stripped = 1, has_debug_info = 0;
 1436|  1.66k|	size_t nbadcap = 0;
 1437|  1.66k|	void *nbuf;
 1438|  1.66k|	off_t noff, coff, name_off, offs;
 1439|  1.66k|	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilities */
 1440|  1.66k|	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilities */
 1441|  1.66k|	char name[50];
 1442|  1.66k|	ssize_t namesize;
 1443|       |
 1444|  1.66k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.66k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.66k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.66k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1444:6): [True: 0, False: 1.66k]
  ------------------
 1445|      0|		return 0;
 1446|       |
 1447|  1.66k|	if (num == 0) {
  ------------------
  |  Branch (1447:6): [True: 453, False: 1.21k]
  ------------------
 1448|    453|		if (elf_printf(ms, ", no section header") == -1)
  ------------------
  |  Branch (1448:7): [True: 0, False: 453]
  ------------------
 1449|      0|			return -1;
 1450|    453|		return 0;
 1451|    453|	}
 1452|  1.21k|	if (size != xsh_sizeof) {
  ------------------
  |  |  164|  1.21k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.21k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 653, False: 562]
  |  |  ------------------
  |  |  165|  1.21k|			 ? sizeof(sh32)				\
  |  |  166|  1.21k|			 : sizeof(sh64))
  ------------------
  |  Branch (1452:6): [True: 260, False: 955]
  ------------------
 1453|    260|		if (elf_printf(ms, ", corrupted section header size") == -1)
  ------------------
  |  Branch (1453:7): [True: 0, False: 260]
  ------------------
 1454|      0|			return -1;
 1455|    260|		return 0;
 1456|    260|	}
 1457|       |
 1458|       |	/* Read offset of name section to be able to read section names later */
 1459|    955|	offs = CAST(off_t, (off + size * strtab));
  ------------------
  |  |  452|    955|#define CAST(T, b)	((T)(b))
  ------------------
 1460|    955|	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  161|    955|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    955|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 497, False: 458]
  |  |  ------------------
  |  |  162|    955|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  452|    497|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|    955|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  452|    458|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  164|    955|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    955|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 497, False: 458]
  |  |  ------------------
  |  |  165|    955|			 ? sizeof(sh32)				\
  |  |  166|    955|			 : sizeof(sh64))
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  452|  1.91k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 497, False: 458]
  |  |  ------------------
  ------------------
  |  Branch (1460:6): [True: 8, False: 947]
  ------------------
 1461|      8|		if (elf_printf(ms, ", missing section headers at %jd",
  ------------------
  |  Branch (1461:7): [True: 0, False: 8]
  ------------------
 1462|      8|		    (intmax_t)offs) == -1)
 1463|      0|			return -1;
 1464|      8|		return 0;
 1465|      8|	}
 1466|    947|	name_off = xsh_offset;
  ------------------
  |  |  170|    947|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  1.89k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 492, False: 455]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|    947|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|    947|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1467|       |
 1468|    947|	if (fsize != SIZE_UNKNOWN && fsize < name_off) {
  ------------------
  |  |   65|    947|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  1.89k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1468:6): [True: 947, False: 0]
  |  Branch (1468:31): [True: 8, False: 939]
  ------------------
 1469|      8|		if (elf_printf(ms, ", too large section header offset %jd",
  ------------------
  |  Branch (1469:7): [True: 0, False: 8]
  ------------------
 1470|      8|		    (intmax_t)name_off) == -1)
 1471|      0|			return -1;
 1472|      8|		return 0;
 1473|      8|	}
 1474|       |
 1475|  75.3k|	for ( ; num; num--) {
  ------------------
  |  Branch (1475:10): [True: 75.1k, False: 178]
  ------------------
 1476|       |		/* Read the name of this section. */
 1477|  75.1k|		offs = name_off + xsh_name;
  ------------------
  |  |  176|  75.1k|#define xsh_name    	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  75.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (176:23): [True: 60.3k, False: 14.8k]
  |  |  ------------------
  |  |  177|  75.1k|			 ? elf_getu32(swap, sh32.sh_name)	\
  |  |  ------------------
  |  |  |  |  158|  60.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  178|  75.1k|			 : elf_getu32(swap, sh64.sh_name))
  |  |  ------------------
  |  |  |  |  158|  14.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1478|  75.1k|		if ((namesize = pread(fd, name, sizeof(name) - 1, offs))
  ------------------
  |  Branch (1478:7): [True: 50, False: 75.1k]
  ------------------
 1479|  75.1k|		    == -1) {
 1480|     50|			if (elf_printf(ms, 
  ------------------
  |  Branch (1480:8): [True: 0, False: 50]
  ------------------
 1481|     50|			    ", can't read name of elf section at %jd",
 1482|     50|			    (intmax_t)offs) == -1)
 1483|      0|				return -1;
 1484|     50|			return 0;
 1485|     50|		}
 1486|  75.1k|		name[namesize] = '\0';
 1487|  75.1k|		if (strcmp(name, ".debug_info") == 0) {
  ------------------
  |  Branch (1487:7): [True: 193, False: 74.9k]
  ------------------
 1488|    193|			has_debug_info = 1;
 1489|    193|			stripped = 0;
 1490|    193|		}
 1491|       |
 1492|  75.1k|		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  161|  75.1k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  75.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 60.3k, False: 14.8k]
  |  |  ------------------
  |  |  162|  75.1k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  452|  60.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  75.1k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  452|  14.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  164|  75.1k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  75.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 60.3k, False: 14.8k]
  |  |  ------------------
  |  |  165|  75.1k|			 ? sizeof(sh32)				\
  |  |  166|  75.1k|			 : sizeof(sh64))
  ------------------
  |  Branch (1492:7): [True: 508, False: 74.6k]
  ------------------
 1493|  75.1k|		    CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  452|   150k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 60.3k, False: 14.8k]
  |  |  ------------------
  ------------------
 1494|    508|			if (elf_printf(ms, ", can't read elf section at %jd",
  ------------------
  |  Branch (1494:8): [True: 0, False: 508]
  ------------------
 1495|    508|			    (intmax_t)off) == -1)
 1496|      0|				return -1;
 1497|    508|			return 0;
 1498|    508|		}
 1499|  74.6k|		off += size;
 1500|       |
 1501|       |		/* Things we can determine before we seek */
 1502|  74.6k|		switch (xsh_type) {
  ------------------
  |  |  173|  74.6k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  74.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 59.9k, False: 14.6k]
  |  |  ------------------
  |  |  174|  74.6k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  59.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  74.6k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  14.6k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1503|  2.00k|		case SHT_SYMTAB:
  ------------------
  |  |  141|  2.00k|#define	SHT_SYMTAB	2
  ------------------
  |  Branch (1503:3): [True: 2.00k, False: 72.6k]
  ------------------
 1504|       |#if 0
 1505|       |		case SHT_DYNSYM:
 1506|       |#endif
 1507|  2.00k|			stripped = 0;
 1508|  2.00k|			break;
 1509|  72.6k|		default:
  ------------------
  |  Branch (1509:3): [True: 72.6k, False: 2.00k]
  ------------------
 1510|  72.6k|			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |   65|  72.6k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|   145k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |  170|  72.6k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|   145k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 58.0k, False: 14.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  72.6k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  72.6k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1510:8): [True: 72.6k, False: 0]
  |  Branch (1510:33): [True: 37.1k, False: 35.4k]
  ------------------
 1511|       |				/* Perhaps warn here */
 1512|  37.1k|				continue;
 1513|  37.1k|			}
 1514|  35.4k|			break;
 1515|  74.6k|		}
 1516|       |
 1517|       |
 1518|       |		/* Things we can determine when we seek */
 1519|  37.4k|		switch (xsh_type) {
  ------------------
  |  |  173|  37.4k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  37.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 31.3k, False: 6.17k]
  |  |  ------------------
  |  |  174|  37.4k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  31.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  37.4k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  6.17k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1520|  2.93k|		case SHT_NOTE:
  ------------------
  |  |  142|  2.93k|#define	SHT_NOTE	7
  ------------------
  |  Branch (1520:3): [True: 2.93k, False: 34.5k]
  ------------------
 1521|  2.93k|			if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
  ------------------
  |  |  452|  11.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 1.72k, False: 1.21k]
  |  |  |  Branch (452:25): [True: 1.72k, False: 1.21k]
  |  |  ------------------
  ------------------
  |  Branch (1521:8): [True: 98, False: 2.84k]
  ------------------
 1522|  2.93k|			    CAST(uintmax_t, fsize)) {
  ------------------
  |  |  452|  2.93k|#define CAST(T, b)	((T)(b))
  ------------------
 1523|     98|				if (elf_printf(ms,
  ------------------
  |  Branch (1523:9): [True: 0, False: 98]
  ------------------
 1524|     98|				    ", note offset/size %#" INTMAX_T_FORMAT
 1525|     98|				    "x+%#" INTMAX_T_FORMAT "x exceeds"
 1526|     98|				    " file size %#" INTMAX_T_FORMAT "x",
 1527|     98|				    CAST(uintmax_t, xsh_offset),
  ------------------
  |  |  452|    196|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 40, False: 58]
  |  |  ------------------
  ------------------
 1528|     98|				    CAST(uintmax_t, xsh_size),
  ------------------
  |  |  452|    196|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 40, False: 58]
  |  |  ------------------
  ------------------
 1529|     98|				    CAST(uintmax_t, fsize)) == -1)
  ------------------
  |  |  452|     98|#define CAST(T, b)	((T)(b))
  ------------------
 1530|      0|					return -1;
 1531|     98|				return 0;
 1532|     98|			}
 1533|  2.84k|			if (xsh_size > ms->elf_shsize_max) {
  ------------------
  |  |  167|  2.84k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  5.68k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.68k, False: 1.15k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.84k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.84k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1533:8): [True: 17, False: 2.82k]
  ------------------
 1534|     17|				file_error(ms, errno, "Note section size too "
 1535|     17|				    "big (%ju > %zu)", (uintmax_t)xsh_size,
  ------------------
  |  |  167|     17|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|     34|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|     17|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|     17|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1536|     17|				    ms->elf_shsize_max);
 1537|     17|				return -1;
 1538|     17|			}
 1539|  2.82k|			if ((nbuf = malloc(xsh_size)) == NULL) {
  ------------------
  |  |  167|  2.82k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  5.64k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.68k, False: 1.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.82k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.82k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1539:8): [True: 0, False: 2.82k]
  ------------------
 1540|      0|				file_error(ms, errno, "Cannot allocate memory"
 1541|      0|				    " for note");
 1542|      0|				return -1;
 1543|      0|			}
 1544|  2.82k|			offs = xsh_offset;
  ------------------
  |  |  170|  2.82k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  5.64k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.68k, False: 1.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  2.82k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  2.82k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1545|  2.82k|			if (pread(fd, nbuf, xsh_size, offs) <
  ------------------
  |  |  167|  2.82k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  5.64k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.68k, False: 1.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.82k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.82k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1545:8): [True: 11, False: 2.81k]
  ------------------
 1546|  2.82k|			    CAST(ssize_t, xsh_size)) {
  ------------------
  |  |  452|  5.64k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 1.68k, False: 1.13k]
  |  |  ------------------
  ------------------
 1547|     11|				free(nbuf);
 1548|     11|				if (elf_printf(ms,
  ------------------
  |  Branch (1548:9): [True: 0, False: 11]
  ------------------
 1549|     11|				    ", can't read elf note at %jd",
 1550|     11|				    (intmax_t)offs) == -1)
 1551|      0|					return -1;
 1552|     11|				return 0;
 1553|     11|			}
 1554|       |
 1555|  2.81k|			noff = 0;
 1556|  7.68k|			for (;;) {
 1557|  7.68k|				if (noff >= CAST(off_t, xsh_size))
  ------------------
  |  |  452|  15.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 3.62k, False: 4.05k]
  |  |  ------------------
  ------------------
  |  Branch (1557:9): [True: 2.42k, False: 5.25k]
  ------------------
 1558|  2.42k|					break;
 1559|  5.25k|				noff = donote(ms, nbuf, CAST(size_t, noff),
  ------------------
  |  |  452|  5.25k|#define CAST(T, b)	((T)(b))
  ------------------
 1560|  5.25k|				    xsh_size, clazz, swap, 4, flags, notecount,
  ------------------
  |  |  167|  5.25k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.09k, False: 3.16k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  5.25k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  5.25k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1561|  5.25k|				    fd, 0, 0, 0);
 1562|  5.25k|				if (noff == 0)
  ------------------
  |  Branch (1562:9): [True: 384, False: 4.87k]
  ------------------
 1563|    384|					break;
 1564|  5.25k|			}
 1565|  2.81k|			free(nbuf);
 1566|  2.81k|			break;
 1567|  2.44k|		case SHT_SUNW_cap:
  ------------------
  |  |  144|  2.44k|#define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
  ------------------
  |  Branch (1567:3): [True: 2.44k, False: 35.0k]
  ------------------
 1568|  2.44k|			switch (mach) {
 1569|    261|			case EM_SPARC:
  ------------------
  |  |  133|    261|#define	EM_SPARC	2
  ------------------
  |  Branch (1569:4): [True: 261, False: 2.18k]
  ------------------
 1570|    886|			case EM_SPARCV9:
  ------------------
  |  |  136|    886|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1570:4): [True: 625, False: 1.82k]
  ------------------
 1571|  1.11k|			case EM_IA_64:
  ------------------
  |  |  137|  1.11k|#define	EM_IA_64	50
  ------------------
  |  Branch (1571:4): [True: 229, False: 2.21k]
  ------------------
 1572|  1.79k|			case EM_386:
  ------------------
  |  |  134|  1.79k|#define	EM_386		3
  ------------------
  |  Branch (1572:4): [True: 680, False: 1.76k]
  ------------------
 1573|  1.99k|			case EM_AMD64:
  ------------------
  |  |  138|  1.99k|#define	EM_AMD64	62
  ------------------
  |  Branch (1573:4): [True: 196, False: 2.24k]
  ------------------
 1574|  1.99k|				break;
 1575|    454|			default:
  ------------------
  |  Branch (1575:4): [True: 454, False: 1.99k]
  ------------------
 1576|    454|				goto skip;
 1577|  2.44k|			}
 1578|       |
 1579|  1.99k|			if (nbadcap > 5)
  ------------------
  |  Branch (1579:8): [True: 504, False: 1.48k]
  ------------------
 1580|    504|				break;
 1581|  1.48k|			if (lseek(fd, xsh_offset, SEEK_SET)
  ------------------
  |  |  170|  1.48k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  2.97k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 827, False: 660]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.48k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.48k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1581:8): [True: 5, False: 1.48k]
  ------------------
 1582|  1.48k|			    == CAST(off_t, -1)) {
  ------------------
  |  |  452|  1.48k|#define CAST(T, b)	((T)(b))
  ------------------
 1583|      5|				file_badseek(ms);
 1584|      5|				return -1;
 1585|      5|			}
 1586|  1.48k|			coff = 0;
 1587|  9.18k|			for (;;) {
 1588|  9.18k|				Elf32_Cap cap32;
 1589|  9.18k|				Elf64_Cap cap64;
 1590|  9.18k|				cap32.c_un.c_val = 0;
 1591|  9.18k|				cap64.c_un.c_val = 0;
 1592|  9.18k|				char cbuf[/*CONSTCOND*/
 1593|  9.18k|				    MAX(sizeof(cap32), sizeof(cap64))];
 1594|  9.18k|				if ((coff += xcap_sizeof) >
  ------------------
  |  |  240|  9.18k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  9.18k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 4.65k, False: 4.53k]
  |  |  ------------------
  |  |  241|  9.18k|			 ? sizeof(cap32)			\
  |  |  242|  9.18k|			 : sizeof(cap64))
  ------------------
  |  Branch (1594:9): [True: 817, False: 8.36k]
  ------------------
 1595|  9.18k|				    CAST(off_t, xsh_size))
  ------------------
  |  |  452|  18.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 4.65k, False: 4.53k]
  |  |  ------------------
  ------------------
 1596|    817|					break;
 1597|  8.36k|				if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
  ------------------
  |  |  452|  16.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 4.30k, False: 4.05k]
  |  |  ------------------
  ------------------
  |  Branch (1597:9): [True: 72, False: 8.29k]
  ------------------
 1598|  8.36k|				    CAST(ssize_t, xcap_sizeof)) {
  ------------------
  |  |  452|  16.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 4.30k, False: 4.05k]
  |  |  ------------------
  ------------------
 1599|     72|					file_badread(ms);
 1600|     72|					return -1;
 1601|     72|				}
 1602|  8.29k|				if (cbuf[0] == 'A') {
  ------------------
  |  Branch (1602:9): [True: 336, False: 7.95k]
  ------------------
 1603|       |#ifdef notyet
 1604|       |					char *p = cbuf + 1;
 1605|       |					uint32_t len, tag;
 1606|       |					memcpy(&len, p, sizeof(len));
 1607|       |					p += 4;
 1608|       |					len = getu32(swap, len);
 1609|       |					if (memcmp("gnu", p, 3) != 0) {
 1610|       |					    if (elf_printf(ms,
 1611|       |						", unknown capability %.3s", p)
 1612|       |						== -1)
 1613|       |						return -1;
 1614|       |					    break;
 1615|       |					}
 1616|       |					p += strlen(p) + 1;
 1617|       |					tag = *p++;
 1618|       |					memcpy(&len, p, sizeof(len));
 1619|       |					p += 4;
 1620|       |					len = getu32(swap, len);
 1621|       |					if (tag != 1) {
 1622|       |					    if (elf_printf(ms, ", unknown gnu"
 1623|       |						" capability tag %d", tag)
 1624|       |						== -1)
 1625|       |						return -1;
 1626|       |					    break;
 1627|       |					}
 1628|       |					// gnu attributes
 1629|       |#endif
 1630|    336|					break;
 1631|    336|				}
 1632|  7.95k|				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  237|  7.95k|#define xcap_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.95k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (237:20): [True: 3.99k, False: 3.96k]
  |  |  ------------------
  |  |  238|  7.95k|			 ? CAST(void *, &cap32)			\
  |  |  ------------------
  |  |  |  |  452|  3.99k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  239|  7.95k|			 : CAST(void *, &cap64))
  |  |  ------------------
  |  |  |  |  452|  3.96k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  240|  7.95k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.95k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 3.99k, False: 3.96k]
  |  |  ------------------
  |  |  241|  7.95k|			 ? sizeof(cap32)			\
  |  |  242|  7.95k|			 : sizeof(cap64))
  ------------------
 1633|  7.95k|				switch (xcap_tag) {
  ------------------
  |  |  243|  7.95k|#define xcap_tag	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.95k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (243:19): [True: 3.99k, False: 3.96k]
  |  |  ------------------
  |  |  244|  7.95k|			 ? elf_getu32(swap, cap32.c_tag)	\
  |  |  ------------------
  |  |  |  |  158|  3.99k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  245|  7.95k|			 : elf_getu64(swap, cap64.c_tag))
  |  |  ------------------
  |  |  |  |  159|  3.96k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1634|  4.97k|				case CA_SUNW_NULL:
  ------------------
  |  |  424|  4.97k|#define	CA_SUNW_NULL	0
  ------------------
  |  Branch (1634:5): [True: 4.97k, False: 2.98k]
  ------------------
 1635|  4.97k|					break;
 1636|    983|				case CA_SUNW_HW_1:
  ------------------
  |  |  425|    983|#define	CA_SUNW_HW_1	1
  ------------------
  |  Branch (1636:5): [True: 983, False: 6.97k]
  ------------------
 1637|    983|					cap_hw1 |= xcap_val;
  ------------------
  |  |  246|    983|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    983|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 675, False: 308]
  |  |  ------------------
  |  |  247|    983|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    675|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|    983|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    308|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1638|    983|					break;
 1639|    911|				case CA_SUNW_SF_1:
  ------------------
  |  |  426|    911|#define	CA_SUNW_SF_1	2
  ------------------
  |  Branch (1639:5): [True: 911, False: 7.04k]
  ------------------
 1640|    911|					cap_sf1 |= xcap_val;
  ------------------
  |  |  246|    911|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    911|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 755, False: 156]
  |  |  ------------------
  |  |  247|    911|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    755|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|    911|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    156|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1641|    911|					break;
 1642|  1.08k|				default:
  ------------------
  |  Branch (1642:5): [True: 1.08k, False: 6.87k]
  ------------------
 1643|  1.08k|					if (elf_printf(ms,
  ------------------
  |  Branch (1643:10): [True: 0, False: 1.08k]
  ------------------
 1644|  1.08k|					    ", with unknown capability "
 1645|  1.08k|					    "%#" INT64_T_FORMAT "x = %#"
 1646|  1.08k|					    INT64_T_FORMAT "x",
 1647|  1.08k|					    CAST(unsigned long long, xcap_tag),
  ------------------
  |  |  452|  2.17k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 626, False: 460]
  |  |  ------------------
  ------------------
 1648|  1.08k|					    CAST(unsigned long long, xcap_val))
  ------------------
  |  |  452|  2.17k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 626, False: 460]
  |  |  ------------------
  ------------------
 1649|  1.08k|					    == -1)
 1650|      0|						return -1;
 1651|  1.08k|					if (nbadcap++ > 2)
  ------------------
  |  Branch (1651:10): [True: 257, False: 829]
  ------------------
 1652|    257|						goto skip;
 1653|    829|					break;
 1654|  7.95k|				}
 1655|  7.95k|			}
 1656|       |			/*FALLTHROUGH*/
 1657|  1.86k|		skip:
 1658|  33.9k|		default:
  ------------------
  |  Branch (1658:3): [True: 32.1k, False: 5.38k]
  ------------------
 1659|  33.9k|			break;
 1660|  37.4k|		}
 1661|  37.4k|	}
 1662|       |
 1663|    178|	if (has_debug_info) {
  ------------------
  |  Branch (1663:6): [True: 1, False: 177]
  ------------------
 1664|      1|		if (elf_printf(ms, ", with debug_info") == -1)
  ------------------
  |  Branch (1664:7): [True: 0, False: 1]
  ------------------
 1665|      0|			return -1;
 1666|      1|	}
 1667|    178|	if (elf_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
  ------------------
  |  Branch (1667:6): [True: 0, False: 178]
  |  Branch (1667:37): [True: 173, False: 5]
  ------------------
 1668|      0|		return -1;
 1669|    178|	if (cap_hw1) {
  ------------------
  |  Branch (1669:6): [True: 73, False: 105]
  ------------------
 1670|     73|		const cap_desc_t *cdp;
 1671|     73|		switch (mach) {
 1672|      9|		case EM_SPARC:
  ------------------
  |  |  133|      9|#define	EM_SPARC	2
  ------------------
  |  Branch (1672:3): [True: 9, False: 64]
  ------------------
 1673|      9|		case EM_SPARC32PLUS:
  ------------------
  |  |  135|      9|#define	EM_SPARC32PLUS	18
  ------------------
  |  Branch (1673:3): [True: 0, False: 73]
  ------------------
 1674|     62|		case EM_SPARCV9:
  ------------------
  |  |  136|     62|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1674:3): [True: 53, False: 20]
  ------------------
 1675|     62|			cdp = cap_desc_sparc;
 1676|     62|			break;
 1677|      4|		case EM_386:
  ------------------
  |  |  134|      4|#define	EM_386		3
  ------------------
  |  Branch (1677:3): [True: 4, False: 69]
  ------------------
 1678|      6|		case EM_IA_64:
  ------------------
  |  |  137|      6|#define	EM_IA_64	50
  ------------------
  |  Branch (1678:3): [True: 2, False: 71]
  ------------------
 1679|     11|		case EM_AMD64:
  ------------------
  |  |  138|     11|#define	EM_AMD64	62
  ------------------
  |  Branch (1679:3): [True: 5, False: 68]
  ------------------
 1680|     11|			cdp = cap_desc_386;
 1681|     11|			break;
 1682|      0|		default:
  ------------------
  |  Branch (1682:3): [True: 0, False: 73]
  ------------------
 1683|      0|			cdp = NULL;
 1684|      0|			break;
 1685|     73|		}
 1686|     73|		if (elf_printf(ms, ", uses") == -1)
  ------------------
  |  Branch (1686:7): [True: 0, False: 73]
  ------------------
 1687|      0|			return -1;
 1688|     73|		if (cdp) {
  ------------------
  |  Branch (1688:7): [True: 73, False: 0]
  ------------------
 1689|  1.03k|			while (cdp->cd_name) {
  ------------------
  |  Branch (1689:11): [True: 957, False: 73]
  ------------------
 1690|    957|				if (cap_hw1 & cdp->cd_mask) {
  ------------------
  |  Branch (1690:9): [True: 544, False: 413]
  ------------------
 1691|    544|					if (elf_printf(ms,
  ------------------
  |  Branch (1691:10): [True: 0, False: 544]
  ------------------
 1692|    544|					    " %s", cdp->cd_name) == -1)
 1693|      0|						return -1;
 1694|    544|					cap_hw1 &= ~cdp->cd_mask;
 1695|    544|				}
 1696|    957|				++cdp;
 1697|    957|			}
 1698|     73|			if (cap_hw1)
  ------------------
  |  Branch (1698:8): [True: 68, False: 5]
  ------------------
 1699|     68|				if (elf_printf(ms,
  ------------------
  |  Branch (1699:9): [True: 0, False: 68]
  ------------------
 1700|     68|				    " unknown hardware capability %#"
 1701|     68|				    INT64_T_FORMAT "x",
 1702|     68|				    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  452|     68|#define CAST(T, b)	((T)(b))
  ------------------
 1703|      0|					return -1;
 1704|     73|		} else {
 1705|      0|			if (elf_printf(ms,
  ------------------
  |  Branch (1705:8): [True: 0, False: 0]
  ------------------
 1706|      0|			    " hardware capability %#" INT64_T_FORMAT "x",
 1707|      0|			    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1708|      0|				return -1;
 1709|      0|		}
 1710|     73|	}
 1711|    178|	if (cap_sf1) {
  ------------------
  |  Branch (1711:6): [True: 84, False: 94]
  ------------------
 1712|     84|		if (cap_sf1 & SF1_SUNW_FPUSED) {
  ------------------
  |  |  430|     84|#define	SF1_SUNW_FPUSED	0x02
  ------------------
  |  Branch (1712:7): [True: 44, False: 40]
  ------------------
 1713|     44|			if (elf_printf(ms,
  ------------------
  |  Branch (1713:8): [True: 0, False: 44]
  ------------------
 1714|     44|			    (cap_sf1 & SF1_SUNW_FPKNWN)
  ------------------
  |  |  429|     44|#define	SF1_SUNW_FPKNWN	0x01
  ------------------
  |  Branch (1714:8): [True: 34, False: 10]
  ------------------
 1715|     44|			    ? ", uses frame pointer"
 1716|     44|			    : ", not known to use frame pointer") == -1)
 1717|      0|				return -1;
 1718|     44|		}
 1719|     84|		cap_sf1 &= ~SF1_SUNW_MASK;
  ------------------
  |  |  431|     84|#define	SF1_SUNW_MASK	0x03
  ------------------
 1720|     84|		if (cap_sf1)
  ------------------
  |  Branch (1720:7): [True: 83, False: 1]
  ------------------
 1721|     83|			if (elf_printf(ms,
  ------------------
  |  Branch (1721:8): [True: 0, False: 83]
  ------------------
 1722|     83|			    ", with unknown software capability %#"
 1723|     83|			    INT64_T_FORMAT "x",
 1724|     83|			    CAST(unsigned long long, cap_sf1)) == -1)
  ------------------
  |  |  452|     83|#define CAST(T, b)	((T)(b))
  ------------------
 1725|      0|				return -1;
 1726|     84|	}
 1727|    178|	return 0;
 1728|    178|}
readelf.c:getu64:
  134|  94.2k|{
  135|  94.2k|	union {
  136|  94.2k|		uint64_t ui;
  137|  94.2k|		char c[8];
  138|  94.2k|	} retval, tmpval;
  139|       |
  140|  94.2k|	if (swap) {
  ------------------
  |  Branch (140:6): [True: 41.3k, False: 52.8k]
  ------------------
  141|  41.3k|		tmpval.ui = value;
  142|       |
  143|  41.3k|		retval.c[0] = tmpval.c[7];
  144|  41.3k|		retval.c[1] = tmpval.c[6];
  145|  41.3k|		retval.c[2] = tmpval.c[5];
  146|  41.3k|		retval.c[3] = tmpval.c[4];
  147|  41.3k|		retval.c[4] = tmpval.c[3];
  148|  41.3k|		retval.c[5] = tmpval.c[2];
  149|  41.3k|		retval.c[6] = tmpval.c[1];
  150|  41.3k|		retval.c[7] = tmpval.c[0];
  151|       |
  152|  41.3k|		return retval.ui;
  153|  41.3k|	} else
  154|  52.8k|		return value;
  155|  94.2k|}
readelf.c:elf_printf:
   72|  13.7k|{
   73|  13.7k|	va_list ap;
   74|  13.7k|	int rv;
   75|       |
   76|  13.7k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  13.7k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  13.7k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  13.7k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (76:6): [True: 0, False: 13.7k]
  ------------------
   77|      0|		return 1;
   78|       |
   79|  13.7k|	va_start(ap, fmt);
   80|  13.7k|	rv = file_vprintf(ms, fmt, ap);
   81|       |	va_end(ap);
   82|  13.7k|	return rv;
   83|  13.7k|}

file_softmagic:
  130|  14.8k|{
  131|  14.8k|	struct mlist *ml;
  132|  14.8k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  133|  14.8k|	uint16_t nc, ic;
  134|       |
  135|  14.8k|	if (name_count == NULL) {
  ------------------
  |  Branch (135:6): [True: 14.8k, False: 0]
  ------------------
  136|  14.8k|		nc = 0;
  137|  14.8k|		name_count = &nc;
  138|  14.8k|	}
  139|  14.8k|	if (indir_count == NULL) {
  ------------------
  |  Branch (139:6): [True: 14.8k, False: 0]
  ------------------
  140|  14.8k|		ic = 0;
  141|  14.8k|		indir_count = &ic;
  142|  14.8k|	}
  143|       |
  144|  29.4k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (144:32): [True: 14.8k, False: 14.6k]
  ------------------
  145|  14.8k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  146|  14.8k|		    0, mode, text, 0, indir_count, name_count,
  147|  14.8k|		    &printed_something, &need_separator, &firstline,
  148|  14.8k|		    NULL, NULL);
  149|  14.8k|		switch (ret) {
  150|    151|		case -1:
  ------------------
  |  Branch (150:3): [True: 151, False: 14.6k]
  ------------------
  151|    151|			return ret;
  152|  4.53k|		case 0:
  ------------------
  |  Branch (152:3): [True: 4.53k, False: 10.2k]
  ------------------
  153|  4.53k|			continue;
  154|  10.1k|		default:
  ------------------
  |  Branch (154:3): [True: 10.1k, False: 4.68k]
  ------------------
  155|  10.1k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  10.1k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (155:8): [True: 0, False: 10.1k]
  ------------------
  156|      0|				return ret;
  157|  10.1k|			rv = ret;
  158|  10.1k|			break;
  159|  14.8k|		}
  160|  14.8k|	}
  161|       |
  162|  14.6k|	return rv;
  163|  14.8k|}
softmagic.c:match:
  222|  91.3k|{
  223|  91.3k|	uint32_t magindex = 0;
  224|  91.3k|	unsigned int cont_level = 0;
  225|  91.3k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  226|  91.3k|	int returnvalv = 0, e;
  227|  91.3k|	struct buffer bb;
  228|  91.3k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  91.3k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  91.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  91.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  91.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  91.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  91.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  229|       |
  230|  91.3k|	(void)memset(&bb, 0, sizeof(bb));
  231|       |	/*
  232|       |	 * returnval can be 0 if a match is found, but there was no
  233|       |	 * annotation to be printed.
  234|       |	 */
  235|  91.3k|	if (returnval == NULL)
  ------------------
  |  Branch (235:6): [True: 30.4k, False: 60.9k]
  ------------------
  236|  30.4k|		returnval = &returnvalv;
  237|  91.3k|	if (found_match == NULL)
  ------------------
  |  Branch (237:6): [True: 30.4k, False: 60.9k]
  ------------------
  238|  30.4k|		found_match = &found_matchv;
  239|       |
  240|  91.3k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (240:6): [True: 0, False: 91.3k]
  ------------------
  241|      0|		return -1;
  242|       |
  243|   116M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (243:21): [True: 116M, False: 89.5k]
  ------------------
  244|   116M|		int flush = 0;
  245|   116M|		struct magic *m = &magic[magindex];
  246|   116M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  247|       |
  248|   116M|		if (m->type != FILE_NAME)
  ------------------
  |  |  290|   116M|#define				FILE_NAME		45
  ------------------
  |  Branch (248:7): [True: 116M, False: 60.9k]
  ------------------
  249|   116M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  310|   232M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  250|   232M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (310:3): [True: 70.8M, False: 45.6M]
  |  |  ------------------
  |  |  311|   116M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  258|   162M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (311:3): [True: 30.2k, False: 45.6M]
  |  |  ------------------
  |  |  312|   116M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  263|   162M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (312:3): [True: 0, False: 45.6M]
  |  |  ------------------
  |  |  313|   116M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  264|   162M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (313:3): [True: 60.4k, False: 45.5M]
  |  |  ------------------
  |  |  314|   116M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  262|   162M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (314:3): [True: 2.26M, False: 43.2M]
  |  |  ------------------
  |  |  315|   116M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  265|   159M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (315:3): [True: 7.99M, False: 35.2M]
  |  |  ------------------
  |  |  316|   116M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  286|   151M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (316:3): [True: 0, False: 35.2M]
  |  |  ------------------
  |  |  317|   116M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  290|   151M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (317:3): [True: 0, False: 35.2M]
  |  |  ------------------
  |  |  318|   116M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  291|   151M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (318:3): [True: 0, False: 35.2M]
  |  |  ------------------
  |  |  319|   232M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  306|  35.2M|#define				FILE_OCTAL		61
  |  |  ------------------
  |  |  |  Branch (319:3): [True: 0, False: 35.2M]
  |  |  ------------------
  ------------------
  250|  81.1M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  251|  81.1M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  382|  10.4M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  250|  10.4M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  402|  10.4M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  10.4M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  401|  10.4M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  10.4M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  402|  10.4M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  395|  10.4M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (251:10): [True: 10.4M, False: 70.7M]
  |  Branch (251:18): [True: 421k, False: 10.0M]
  ------------------
  252|  80.7M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  382|  70.7M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  250|  70.7M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  402|  70.7M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  70.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  401|  70.7M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  70.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  401|  70.7M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  395|  70.7M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (252:10): [True: 70.7M, False: 10.0M]
  |  Branch (252:19): [True: 3.47M, False: 67.2M]
  ------------------
  253|   112M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (253:7): [True: 14.7M, False: 97.7M]
  ------------------
  254|   116M|flush:
  255|       |			/* Skip sub-tests */
  256|   521M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (256:11): [True: 521M, False: 4.07k]
  ------------------
  257|   521M|			    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (257:8): [True: 405M, False: 116M]
  ------------------
  258|   405M|				magindex++;
  259|   405M|			}
  260|   116M|			cont_level = 0;
  261|   116M|			continue; /* Skip to next top-level test*/
  262|  18.6M|		}
  263|       |
  264|  97.8M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1) {
  ------------------
  |  Branch (264:7): [True: 73.0k, False: 97.7M]
  ------------------
  265|  73.0k|			if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  175|  73.0k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  73.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (265:8): [True: 0, False: 73.0k]
  ------------------
  266|      0|				continue;
  267|  73.0k|			else
  268|  73.0k|				goto flush;
  269|  73.0k|		}
  270|  97.7M|		ms->line = m->lineno;
  271|       |
  272|       |		/* if main entry matches, print it... */
  273|  97.7M|		switch (mget(ms, m, b, &bb, offset, cont_level,
  274|  97.7M|		    mode, text, flip, indir_count, name_count,
  275|  97.7M|		    printed_something, need_separator, firstline, returnval,
  276|  97.7M|		    found_match))
  277|  97.7M|		{
  278|     57|		case -1:
  ------------------
  |  Branch (278:3): [True: 57, False: 97.7M]
  ------------------
  279|     57|			return -1;
  280|  13.5M|		case 0:
  ------------------
  |  Branch (280:3): [True: 13.5M, False: 84.2M]
  ------------------
  281|  13.5M|			flush = m->reln != '!';
  282|  13.5M|			break;
  283|  84.2M|		default:
  ------------------
  |  Branch (283:3): [True: 84.2M, False: 13.5M]
  ------------------
  284|  84.2M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  286|  84.2M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (284:8): [True: 0, False: 84.2M]
  ------------------
  285|      0|				*found_match = 1;
  286|      0|				*returnval = 1;
  287|      0|			}
  288|       |
  289|  84.2M|			switch (magiccheck(ms, m, m_rxcomp)) {
  290|      0|			case -1:
  ------------------
  |  Branch (290:4): [True: 0, False: 84.2M]
  ------------------
  291|      0|				return -1;
  292|  83.8M|			case 0:
  ------------------
  |  Branch (292:4): [True: 83.8M, False: 392k]
  ------------------
  293|  83.8M|				flush++;
  294|  83.8M|				break;
  295|   392k|			default:
  ------------------
  |  Branch (295:4): [True: 392k, False: 83.8M]
  ------------------
  296|   392k|				flush = 0;
  297|   392k|				break;
  298|  84.2M|			}
  299|  84.2M|			break;
  300|  97.7M|		}
  301|  97.7M|		if (flush) {
  ------------------
  |  Branch (301:7): [True: 97.3M, False: 392k]
  ------------------
  302|       |			/*
  303|       |			 * main entry didn't match,
  304|       |			 * flush its continuations
  305|       |			 */
  306|  97.3M|			goto flush;
  307|  97.3M|		}
  308|       |
  309|   392k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (309:7): [True: 0, False: 392k]
  ------------------
  310|      0|		{
  311|      0|			*found_match = 1;
  312|      0|			*need_separator = 1;
  313|      0|			*printed_something = 1;
  314|      0|			*returnval = 1;
  315|      0|			*firstline = 0;
  316|      0|			return e;
  317|      0|		}
  318|       |
  319|       |		/*
  320|       |		 * If we are going to print something, we'll need to print
  321|       |		 * a blank before we print something else.
  322|       |		 */
  323|   392k|		if (*m->desc) {
  ------------------
  |  Branch (323:7): [True: 28.5k, False: 364k]
  ------------------
  324|  28.5k|			*found_match = 1;
  325|  28.5k|			if (print) {
  ------------------
  |  Branch (325:8): [True: 28.5k, False: 0]
  ------------------
  326|  28.5k|				*returnval = 1;
  327|  28.5k|				*need_separator = 1;
  328|  28.5k|				*printed_something = 1;
  329|  28.5k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (329:9): [True: 0, False: 28.5k]
  ------------------
  330|      0|					return -1;
  331|  28.5k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (331:9): [True: 0, False: 28.5k]
  ------------------
  332|      0|					return -1;
  333|  28.5k|			}
  334|  28.5k|		}
  335|       |
  336|   392k|		switch (moffset(ms, m, bb.flen, offset,
  337|   392k|		    &ms->c.li[cont_level].off)) {
  338|  22.4k|		case -1:
  ------------------
  |  Branch (338:3): [True: 22.4k, False: 370k]
  ------------------
  339|  22.4k|		case 0:
  ------------------
  |  Branch (339:3): [True: 0, False: 392k]
  ------------------
  340|  22.4k|			goto flush;
  341|   370k|		default:
  ------------------
  |  Branch (341:3): [True: 370k, False: 22.4k]
  ------------------
  342|   370k|			break;
  343|   392k|		}
  344|       |
  345|       |		/* and any continuations that match */
  346|   370k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (346:7): [True: 0, False: 370k]
  ------------------
  347|      0|			return -1;
  348|       |
  349|  6.83M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (349:10): [True: 6.75M, False: 85.4k]
  ------------------
  350|  6.75M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (350:7): [True: 6.47M, False: 282k]
  ------------------
  351|  6.47M|			m = &magic[++magindex];
  352|  6.47M|			m_rxcomp = &magic_rxcomp[magindex];
  353|  6.47M|			ms->line = m->lineno; /* for messages */
  354|       |
  355|  6.47M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (355:8): [True: 4.95M, False: 1.52M]
  ------------------
  356|  4.95M|				continue;
  357|  1.52M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (357:8): [True: 119k, False: 1.40M]
  ------------------
  358|       |				/*
  359|       |				 * We're at the end of the level
  360|       |				 * "cont_level" continuations.
  361|       |				 */
  362|   119k|				cont_level = m->cont_level;
  363|   119k|			}
  364|  1.52M|			if (msetoffset(ms, m, &bb, b, offset, cont_level)
  ------------------
  |  Branch (364:8): [True: 128, False: 1.52M]
  ------------------
  365|  1.52M|			    == -1) {
  366|    128|				if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  175|    128|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|    128|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (366:9): [True: 0, False: 128]
  ------------------
  367|      0|					continue;
  368|    128|				else
  369|    128|					goto flush;
  370|    128|			}
  371|  1.52M|			if (m->flag & OFFADD) {
  ------------------
  |  |  227|  1.52M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (371:8): [True: 103k, False: 1.41M]
  ------------------
  372|   103k|				if (cont_level == 0) {
  ------------------
  |  Branch (372:9): [True: 0, False: 103k]
  ------------------
  373|      0|					if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (373:10): [True: 0, False: 0]
  ------------------
  374|      0|						fprintf(stderr,
  375|      0|						    "direct *zero*"
  376|      0|						    " cont_level\n");
  377|      0|					return 0;
  378|      0|				}
  379|   103k|				ms->offset +=
  380|   103k|				    ms->c.li[cont_level - 1].off;
  381|   103k|			}
  382|       |
  383|  1.52M|#ifdef ENABLE_CONDITIONALS
  384|  1.52M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  363|  3.04M|#define				COND_ELSE	3
  ------------------
  |  Branch (384:8): [True: 0, False: 1.52M]
  ------------------
  385|  1.52M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  362|  1.52M|#define				COND_ELIF	2
  ------------------
  |  Branch (385:8): [True: 0, False: 1.52M]
  ------------------
  386|      0|				if (ms->c.li[cont_level].last_match == 1)
  ------------------
  |  Branch (386:9): [True: 0, False: 0]
  ------------------
  387|      0|					continue;
  388|      0|			}
  389|  1.52M|#endif
  390|  1.52M|			switch (mget(ms, m, b, &bb, offset,
  391|  1.52M|			    cont_level, mode, text, flip, indir_count,
  392|  1.52M|			    name_count, printed_something, need_separator,
  393|  1.52M|			    firstline, returnval, found_match)) {
  394|  1.79k|			case -1:
  ------------------
  |  Branch (394:4): [True: 1.79k, False: 1.51M]
  ------------------
  395|  1.79k|				return -1;
  396|  89.7k|			case 0:
  ------------------
  |  Branch (396:4): [True: 89.7k, False: 1.43M]
  ------------------
  397|  89.7k|				if (m->reln != '!')
  ------------------
  |  Branch (397:9): [True: 88.0k, False: 1.77k]
  ------------------
  398|  88.0k|					continue;
  399|  1.77k|				flush = 1;
  400|  1.77k|				break;
  401|  1.42M|			default:
  ------------------
  |  Branch (401:4): [True: 1.42M, False: 91.5k]
  ------------------
  402|  1.42M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  286|  1.42M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (402:9): [True: 12.2k, False: 1.41M]
  ------------------
  403|  12.2k|					*found_match = 1;
  404|  12.2k|					*returnval = 1;
  405|  12.2k|				}
  406|  1.42M|				flush = 0;
  407|  1.42M|				break;
  408|  1.52M|			}
  409|       |
  410|  1.43M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (410:12): [True: 1.77k, False: 1.42M]
  ------------------
  411|      0|			case -1:
  ------------------
  |  Branch (411:4): [True: 0, False: 1.43M]
  ------------------
  412|      0|				return -1;
  413|  1.07M|			case 0:
  ------------------
  |  Branch (413:4): [True: 1.07M, False: 352k]
  ------------------
  414|  1.07M|#ifdef ENABLE_CONDITIONALS
  415|  1.07M|				ms->c.li[cont_level].last_match = 0;
  416|  1.07M|#endif
  417|  1.07M|				break;
  418|   352k|			default:
  ------------------
  |  Branch (418:4): [True: 352k, False: 1.07M]
  ------------------
  419|   352k|#ifdef ENABLE_CONDITIONALS
  420|   352k|				ms->c.li[cont_level].last_match = 1;
  421|   352k|#endif
  422|   352k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  292|   352k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (422:9): [True: 3.04k, False: 349k]
  ------------------
  423|  3.04k|					ms->c.li[cont_level].got_match = 0;
  424|   349k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (424:14): [True: 82.5k, False: 267k]
  ------------------
  425|  82.5k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  248|  82.5k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (425:10): [True: 2.17k, False: 80.3k]
  ------------------
  426|  2.17k|						break;
  427|  82.5k|				} else
  428|   267k|					ms->c.li[cont_level].got_match = 1;
  429|       |
  430|   350k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (430:9): [True: 0, False: 350k]
  ------------------
  431|   350k|				    != 0) {
  432|      0|					*found_match = 1;
  433|      0|					*need_separator = 1;
  434|      0|					*printed_something = 1;
  435|      0|					*returnval = 1;
  436|      0|					*firstline = 0;
  437|      0|					return e;
  438|      0|				}
  439|   350k|				if (*m->desc) {
  ------------------
  |  Branch (439:9): [True: 107k, False: 243k]
  ------------------
  440|   107k|					*found_match = 1;
  441|   107k|				}
  442|   350k|				if (print && *m->desc) {
  ------------------
  |  Branch (442:9): [True: 350k, False: 0]
  |  Branch (442:18): [True: 107k, False: 243k]
  ------------------
  443|   107k|					*returnval = 1;
  444|       |					/*
  445|       |					 * This continuation matched.  Print
  446|       |					 * its message, with a blank before it
  447|       |					 * if the previous item printed and
  448|       |					 * this item isn't empty.
  449|       |					 */
  450|       |					/*
  451|       |					 * If we are going to print something,
  452|       |					 * make sure that we have a separator
  453|       |					 * first.
  454|       |					 */
  455|   107k|					if (!*printed_something) {
  ------------------
  |  Branch (455:10): [True: 20.9k, False: 86.3k]
  ------------------
  456|  20.9k|						*printed_something = 1;
  457|  20.9k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (457:11): [True: 0, False: 20.9k]
  ------------------
  458|  20.9k|						    == -1)
  459|      0|							return -1;
  460|  20.9k|					}
  461|       |					/* space if previous printed */
  462|   107k|					if (*need_separator
  ------------------
  |  Branch (462:10): [True: 96.7k, False: 10.5k]
  ------------------
  463|  96.7k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  230|  96.7k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (463:13): [True: 40.1k, False: 56.6k]
  ------------------
  464|  40.1k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (464:11): [True: 0, False: 40.1k]
  ------------------
  465|      0|							return -1;
  466|  40.1k|					}
  467|   107k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (467:10): [True: 0, False: 107k]
  ------------------
  468|      0|						return -1;
  469|   107k|					*need_separator = 1;
  470|   107k|				}
  471|       |
  472|   350k|				switch (moffset(ms, m, bb.flen, offset,
  473|   350k|				    &ms->c.li[cont_level].off)) {
  474|  4.69k|				case -1:
  ------------------
  |  Branch (474:5): [True: 4.69k, False: 345k]
  ------------------
  475|  4.69k|				case 0:
  ------------------
  |  Branch (475:5): [True: 0, False: 350k]
  ------------------
  476|  4.69k|					cont_level--;
  477|  4.69k|					break;
  478|   345k|				default:
  ------------------
  |  Branch (478:5): [True: 345k, False: 4.69k]
  ------------------
  479|   345k|					break;
  480|   350k|				}
  481|       |
  482|       |				/*
  483|       |				 * If we see any continuations
  484|       |				 * at a higher level,
  485|       |				 * process them.
  486|       |				 */
  487|   350k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (487:9): [True: 0, False: 350k]
  ------------------
  488|      0|					return -1;
  489|   350k|				break;
  490|  1.43M|			}
  491|  1.43M|		}
  492|   368k|		if (*printed_something) {
  ------------------
  |  Branch (492:7): [True: 103k, False: 264k]
  ------------------
  493|   103k|			*firstline = 0;
  494|   103k|		}
  495|   368k|		if (*found_match) {
  ------------------
  |  Branch (495:7): [True: 251k, False: 116k]
  ------------------
  496|   251k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   251k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (496:8): [True: 0, False: 251k]
  ------------------
  497|      0|				return *returnval;
  498|       |			// So that we print a separator
  499|   251k|			*printed_something = 0;
  500|   251k|			*firstline = 0;
  501|   251k|		}
  502|   368k|		cont_level = 0;
  503|   368k|	}
  504|  89.5k|	return *returnval;
  505|  91.3k|}
softmagic.c:msetoffset:
 1571|  99.3M|{
 1572|  99.3M|	int32_t offset;
 1573|  99.3M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  234|  99.3M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1573:6): [True: 298k, False: 99.0M]
  ------------------
 1574|   298k|		offset = -m->offset;
 1575|   298k|		if (cont_level > 0) {
  ------------------
  |  Branch (1575:7): [True: 16.5k, False: 282k]
  ------------------
 1576|  16.5k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  227|  16.5k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  228|  16.5k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1576:8): [True: 9.19k, False: 7.39k]
  ------------------
 1577|  9.19k|				goto normal;
 1578|       |#if 0
 1579|       |			file_error(ms, 0, "negative offset %d at continuation"
 1580|       |			    "level %u", m->offset, cont_level);
 1581|       |			return -1;
 1582|       |#endif
 1583|  16.5k|		}
 1584|   289k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1584:7): [True: 0, False: 289k]
  ------------------
 1585|      0|			return -1;
 1586|   289k|		if (o != 0) {
  ------------------
  |  Branch (1586:7): [True: 52, False: 289k]
  ------------------
 1587|       |			// Not yet!
 1588|     52|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1589|     52|			    "u at level %u", o, cont_level);
 1590|     52|			return -1;
 1591|     52|		}
 1592|   289k|		if (b->fd == -1) {
  ------------------
  |  Branch (1592:7): [True: 68.7k, False: 220k]
  ------------------
 1593|  68.7k|			if (CAST(size_t, m->offset) > b->flen)
  ------------------
  |  |  452|  68.7k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1593:8): [True: 12.8k, False: 55.8k]
  ------------------
 1594|  12.8k|				return -1;
 1595|  55.8k|			ms->eoffset = ms->offset =
 1596|  55.8k|			    CAST(int32_t, b->flen - m->offset);
  ------------------
  |  |  452|  55.8k|#define CAST(T, b)	((T)(b))
  ------------------
 1597|   220k|		} else {
 1598|   220k|			if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  452|   220k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1598:8): [True: 60.2k, False: 160k]
  ------------------
 1599|  60.2k|				return -1;
 1600|   160k|			buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1601|   160k|			ms->eoffset = ms->offset =
 1602|   160k|			    CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  452|   160k|#define CAST(T, b)	((T)(b))
  ------------------
 1603|   160k|		}
 1604|  99.0M|	} else {
 1605|  99.0M|		offset = m->offset;
 1606|  99.0M|		if ((m->flag & OFFPOSITIVE) || cont_level == 0) {
  ------------------
  |  |  235|  99.0M|#define OFFPOSITIVE	0x100	/* relative to the beginning of file */
  ------------------
  |  Branch (1606:7): [True: 100, False: 99.0M]
  |  Branch (1606:34): [True: 97.5M, False: 1.50M]
  ------------------
 1607|  97.5M|normal:
 1608|       |			// XXX: Pass real fd, then who frees bb?
 1609|  97.5M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1610|  97.5M|			ms->offset = offset;
 1611|  97.5M|			ms->eoffset = 0;
 1612|  97.5M|		} else {
 1613|  1.50M|			ms->offset = ms->eoffset + offset;
 1614|  1.50M|		}
 1615|  99.0M|	}
 1616|  99.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  99.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1616:6): [True: 0, False: 99.3M]
  ------------------
 1617|       |		fprintf(stderr, "bb=[%p,%" SIZE_T_FORMAT "u,%"
 1618|      0|		    SIZE_T_FORMAT "u], %d [b=%p,%"
 1619|      0|		    SIZE_T_FORMAT "u,%" SIZE_T_FORMAT "u], [o=%#x, c=%d]\n",
 1620|      0|		    bb->fbuf, bb->flen, bb->elen, ms->offset, b->fbuf,
 1621|      0|		    b->flen, b->elen, offset, cont_level);
 1622|      0|	}
 1623|  99.3M|	return 0;
 1624|  99.3M|}
softmagic.c:mget:
 1654|  99.3M|{
 1655|  99.3M|	uint32_t eoffset, offset = ms->offset;
 1656|  99.3M|	struct buffer sbb;
 1657|  99.3M|	intmax_t lhs;
 1658|  99.3M|	file_pushbuf_t *pb;
 1659|  99.3M|	int rv, oneed_separator, in_type, nfound_match;
 1660|  99.3M|	char *rbuf;
 1661|  99.3M|	union VALUETYPE *p = &ms->ms_value;
 1662|  99.3M|	struct mlist ml, *mlp;
 1663|  99.3M|	struct cont c;
 1664|  99.3M|	const unsigned char *s = CAST(const unsigned char *, bb->fbuf);
  ------------------
  |  |  452|  99.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1665|  99.3M|	size_t nbytes = bb->flen;
 1666|       |
 1667|  99.3M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1667:6): [True: 56, False: 99.3M]
  ------------------
 1668|     56|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1669|     56|		    *indir_count);
 1670|     56|		return -1;
 1671|     56|	}
 1672|       |
 1673|  99.3M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1673:6): [True: 1, False: 99.3M]
  ------------------
 1674|      1|		file_error(ms, 0, "name use count (%hu) exceeded",
 1675|      1|		    *name_count);
 1676|      1|		return -1;
 1677|      1|	}
 1678|       |
 1679|       |
 1680|  99.3M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  226|  99.3M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1680:6): [True: 0, False: 99.3M]
  ------------------
 1681|  99.3M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  452|  99.3M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  452|  99.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1682|      0|		return -1;
 1683|       |
 1684|  99.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  99.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1684:6): [True: 0, False: 99.3M]
  ------------------
 1685|      0|		fprintf(stderr, "mget(type=%d, flag=%#x, offset=%u, o=%"
 1686|      0|		    SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
 1687|      0|		    "u, il=%hu, nc=%hu)\n",
 1688|      0|		    m->type, m->flag, offset, o, nbytes,
 1689|      0|		    *indir_count, *name_count);
 1690|      0|		mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  453|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1691|      0|		    sizeof(union VALUETYPE));
 1692|      0|#ifndef COMPILE_ONLY
 1693|      0|		file_mdump(m);
 1694|      0|#endif
 1695|      0|	}
 1696|       |
 1697|  99.3M|	if (m->flag & INDIR) {
  ------------------
  |  |  226|  99.3M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1697:6): [True: 719k, False: 98.5M]
  ------------------
 1698|   719k|		intmax_t off = m->in_offset;
 1699|   719k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  355|   719k|#define				FILE_OPSIGNED	0x20
  ------------------
 1700|   719k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  357|   719k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1700:7): [True: 1.04k, False: 718k]
  ------------------
 1701|  1.04k|			uint8_t *hb;
 1702|  1.04k|			uint16_t hs;
 1703|  1.04k|			uint32_t hl;
 1704|  1.04k|			int op;
 1705|       |
 1706|  1.04k|			if (offset_oob(nbytes, offset + off, 0))
  ------------------
  |  Branch (1706:8): [True: 187, False: 862]
  ------------------
 1707|    187|				return 0;
 1708|    862|			hb = CCAST(uint8_t *, s + offset + off);
  ------------------
  |  |  454|    862|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1709|    862|			switch (op = cvt_flip(m->in_type, flip)) {
 1710|      0|			case FILE_BYTE:
  ------------------
  |  |  246|      0|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1710:4): [True: 0, False: 862]
  ------------------
 1711|      0|				if (offset_oob(nbytes, offset + off, 1))
  ------------------
  |  Branch (1711:9): [True: 0, False: 0]
  ------------------
 1712|      0|					return 0;
 1713|      0|				off = SEXT(sgn,8,hb[0]);
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1714|      0|				break;
 1715|      0|			case FILE_SHORT:
  ------------------
  |  |  247|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1715:4): [True: 0, False: 862]
  ------------------
 1716|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1716:9): [True: 0, False: 0]
  ------------------
 1717|      0|					return 0;
 1718|      0|				memcpy(&hs, hb, sizeof(hs));
 1719|      0|				off = SEXT(sgn,16,hs);
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1720|      0|				break;
 1721|      0|			case FILE_BESHORT:
  ------------------
  |  |  252|      0|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1721:4): [True: 0, False: 862]
  ------------------
 1722|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1722:9): [True: 0, False: 0]
  ------------------
 1723|      0|					return 0;
 1724|      0|				off = SEXT(sgn,16,BE16(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1725|      0|				break;
 1726|      0|			case FILE_LESHORT:
  ------------------
  |  |  255|      0|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1726:4): [True: 0, False: 862]
  ------------------
 1727|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1727:9): [True: 0, False: 0]
  ------------------
 1728|      0|					return 0;
 1729|      0|				off = SEXT(sgn,16,LE16(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1730|      0|				break;
 1731|      0|			case FILE_LONG:
  ------------------
  |  |  249|      0|#define				FILE_LONG		4
  ------------------
  |  Branch (1731:4): [True: 0, False: 862]
  ------------------
 1732|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1732:9): [True: 0, False: 0]
  ------------------
 1733|      0|					return 0;
 1734|      0|				memcpy(&hl, hb, sizeof(hl));
 1735|      0|				off = SEXT(sgn,32,hl);
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1736|      0|				break;
 1737|      0|			case FILE_BELONG:
  ------------------
  |  |  253|      0|#define				FILE_BELONG		8
  ------------------
  |  Branch (1737:4): [True: 0, False: 862]
  ------------------
 1738|      0|			case FILE_BEID3:
  ------------------
  |  |  284|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1738:4): [True: 0, False: 862]
  ------------------
 1739|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1739:9): [True: 0, False: 0]
  ------------------
 1740|      0|					return 0;
 1741|      0|				off = SEXT(sgn,32,BE32(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1742|      0|				break;
 1743|      0|			case FILE_LEID3:
  ------------------
  |  |  285|      0|#define				FILE_LEID3		40
  ------------------
  |  Branch (1743:4): [True: 0, False: 862]
  ------------------
 1744|    862|			case FILE_LELONG:
  ------------------
  |  |  256|    862|#define				FILE_LELONG		11
  ------------------
  |  Branch (1744:4): [True: 862, False: 0]
  ------------------
 1745|    862|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1745:9): [True: 194, False: 668]
  ------------------
 1746|    194|					return 0;
 1747|    668|				off = SEXT(sgn,32,LE32(hb));
  ------------------
  |  |  108|    668|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 668]
  |  |  ------------------
  |  |  109|    668|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    668|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    668|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1748|    668|				break;
 1749|      0|			case FILE_MELONG:
  ------------------
  |  |  268|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1749:4): [True: 0, False: 862]
  ------------------
 1750|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1750:9): [True: 0, False: 0]
  ------------------
 1751|      0|					return 0;
 1752|      0|				off = SEXT(sgn,32,ME32(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1753|      0|				break;
 1754|      0|			case FILE_BEQUAD:
  ------------------
  |  |  271|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1754:4): [True: 0, False: 862]
  ------------------
 1755|      0|				if (offset_oob(nbytes, offset + off, 8))
  ------------------
  |  Branch (1755:9): [True: 0, False: 0]
  ------------------
 1756|      0|					return 0;
 1757|      0|				off = SEXT(sgn,64,BE64(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1758|      0|				break;
 1759|      0|			case FILE_LEQUAD:
  ------------------
  |  |  270|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1759:4): [True: 0, False: 862]
  ------------------
 1760|      0|				if (offset_oob(nbytes, offset + off, 8))
  ------------------
  |  Branch (1760:9): [True: 0, False: 0]
  ------------------
 1761|      0|					return 0;
 1762|      0|				off = SEXT(sgn,64,LE64(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1763|      0|				break;
 1764|      0|			case FILE_OCTAL:
  ------------------
  |  |  306|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1764:4): [True: 0, False: 862]
  ------------------
 1765|      0|				if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1765:9): [True: 0, False: 0]
  ------------------
 1766|      0|					return 0;
 1767|      0|				off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1768|      0|				break;
 1769|      0|			default:
  ------------------
  |  Branch (1769:4): [True: 0, False: 862]
  ------------------
 1770|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1770:9): [True: 0, False: 0]
  ------------------
 1771|      0|					fprintf(stderr, "bad op=%d\n", op);
 1772|      0|				return 0;
 1773|    862|			}
 1774|    668|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    668|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1774:8): [True: 0, False: 668]
  ------------------
 1775|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1776|    668|		}
 1777|   719k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1778|  22.4k|		case FILE_BYTE:
  ------------------
  |  |  246|  22.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1778:3): [True: 22.4k, False: 696k]
  ------------------
 1779|  22.4k|			if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1779:8): [True: 80, False: 22.3k]
  ------------------
 1780|     80|				return 0;
 1781|  22.3k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  108|  22.3k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 22.3k]
  |  |  ------------------
  |  |  109|  22.3k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  22.3k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  22.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1781:8): [True: 0, False: 22.3k]
  ------------------
 1782|      0|				return 0;
 1783|  22.3k|			break;
 1784|  22.3k|		case FILE_BESHORT:
  ------------------
  |  |  252|  21.7k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1784:3): [True: 21.7k, False: 697k]
  ------------------
 1785|  21.7k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1785:8): [True: 290, False: 21.5k]
  ------------------
 1786|    290|				return 0;
 1787|  21.5k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p->hs)), off))
  ------------------
  |  |  108|  21.5k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 21.5k]
  |  |  ------------------
  |  |  109|  21.5k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  21.5k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  21.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1787:8): [True: 0, False: 21.5k]
  ------------------
 1788|      0|				return 0;
 1789|  21.5k|			break;
 1790|  21.5k|		case FILE_LESHORT:
  ------------------
  |  |  255|  11.5k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1790:3): [True: 11.5k, False: 707k]
  ------------------
 1791|  11.5k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1791:8): [True: 967, False: 10.5k]
  ------------------
 1792|    967|				return 0;
 1793|  10.5k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p->hs)), off))
  ------------------
  |  |  108|  10.5k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 10.5k]
  |  |  ------------------
  |  |  109|  10.5k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  10.5k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1793:8): [True: 0, False: 10.5k]
  ------------------
 1794|      0|				return 0;
 1795|  10.5k|			break;
 1796|  10.5k|		case FILE_SHORT:
  ------------------
  |  |  247|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1796:3): [True: 0, False: 719k]
  ------------------
 1797|      0|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1797:8): [True: 0, False: 0]
  ------------------
 1798|      0|				return 0;
 1799|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,16,p->h), off))
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1799:8): [True: 0, False: 0]
  ------------------
 1800|      0|				return 0;
 1801|      0|			break;
 1802|  10.7k|		case FILE_BELONG:
  ------------------
  |  |  253|  10.7k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1802:3): [True: 10.7k, False: 708k]
  ------------------
 1803|  10.8k|		case FILE_BEID3:
  ------------------
  |  |  284|  10.8k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1803:3): [True: 106, False: 719k]
  ------------------
 1804|  10.8k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1804:8): [True: 151, False: 10.7k]
  ------------------
 1805|    151|				return 0;
 1806|  10.7k|			lhs = BE32(p->hl);
  ------------------
  |  |   95|  10.7k|#define BE32(p) ( \
  |  |   96|  10.7k|    (CAST(uint32_t, (p)[0])<<24)| \
  |  |  ------------------
  |  |  |  |  452|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|  10.7k|    (CAST(uint32_t, (p)[1])<<16)| \
  |  |  ------------------
  |  |  |  |  452|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  10.7k|    (CAST(uint32_t, (p)[2])<<8)| \
  |  |  ------------------
  |  |  |  |  452|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  10.7k|    (CAST(uint32_t, (p)[3])))
  |  |  ------------------
  |  |  |  |  452|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1807|  10.7k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  284|  10.7k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1807:8): [True: 104, False: 10.6k]
  ------------------
 1808|    104|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  452|    104|#define CAST(T, b)	((T)(b))
  ------------------
 1809|  10.7k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|  10.7k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 10.7k]
  |  |  ------------------
  |  |  109|  10.7k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  10.7k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1809:8): [True: 490, False: 10.2k]
  ------------------
 1810|    490|				return 0;
 1811|  10.2k|			break;
 1812|   648k|		case FILE_LELONG:
  ------------------
  |  |  256|   648k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1812:3): [True: 648k, False: 70.2k]
  ------------------
 1813|   648k|		case FILE_LEID3:
  ------------------
  |  |  285|   648k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1813:3): [True: 0, False: 719k]
  ------------------
 1814|   648k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1814:8): [True: 232k, False: 416k]
  ------------------
 1815|   232k|				return 0;
 1816|   416k|			lhs = LE32(p->hl);
  ------------------
  |  |   90|   416k|#define LE32(p) ( \
  |  |   91|   416k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  452|   416k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|   416k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  452|   416k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|   416k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  452|   416k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|   416k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  452|   416k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1817|   416k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  285|   416k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1817:8): [True: 0, False: 416k]
  ------------------
 1818|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1819|   416k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|   416k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 416k]
  |  |  ------------------
  |  |  109|   416k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|   416k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|   416k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1819:8): [True: 6.90k, False: 409k]
  ------------------
 1820|  6.90k|				return 0;
 1821|   409k|			break;
 1822|   409k|		case FILE_MELONG:
  ------------------
  |  |  268|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1822:3): [True: 0, False: 719k]
  ------------------
 1823|      0|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1823:8): [True: 0, False: 0]
  ------------------
 1824|      0|				return 0;
 1825|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,32,ME32(p->hl)), off))
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1825:8): [True: 0, False: 0]
  ------------------
 1826|      0|				return 0;
 1827|      0|			break;
 1828|  2.99k|		case FILE_LONG:
  ------------------
  |  |  249|  2.99k|#define				FILE_LONG		4
  ------------------
  |  Branch (1828:3): [True: 2.99k, False: 716k]
  ------------------
 1829|  2.99k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1829:8): [True: 341, False: 2.65k]
  ------------------
 1830|    341|				return 0;
 1831|  2.65k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  108|  2.65k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 2.65k]
  |  |  ------------------
  |  |  109|  2.65k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  2.65k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  2.65k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1831:8): [True: 135, False: 2.51k]
  ------------------
 1832|    135|				return 0;
 1833|  2.51k|			break;
 1834|  2.51k|		case FILE_LEQUAD:
  ------------------
  |  |  270|    207|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1834:3): [True: 207, False: 718k]
  ------------------
 1835|    207|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1835:8): [True: 0, False: 207]
  ------------------
 1836|      0|				return 0;
 1837|    207|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p->hq)), off))	
  ------------------
  |  |  108|    207|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 207]
  |  |  ------------------
  |  |  109|    207|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    207|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    207|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1837:8): [True: 140, False: 67]
  ------------------
 1838|    140|				return 0;
 1839|     67|			break;
 1840|    239|		case FILE_BEQUAD:
  ------------------
  |  |  271|    239|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1840:3): [True: 239, False: 718k]
  ------------------
 1841|    239|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1841:8): [True: 0, False: 239]
  ------------------
 1842|      0|				return 0;
 1843|    239|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p->hq)), off))
  ------------------
  |  |  108|    239|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 239]
  |  |  ------------------
  |  |  109|    239|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    239|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    239|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1843:8): [True: 132, False: 107]
  ------------------
 1844|    132|				return 0;
 1845|    107|			break;
 1846|    208|		case FILE_OCTAL:
  ------------------
  |  |  306|    208|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1846:3): [True: 208, False: 718k]
  ------------------
 1847|    208|			if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1847:8): [True: 62, False: 146]
  ------------------
 1848|     62|				return 0;
 1849|    146|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1849:7): [True: 32, False: 114]
  ------------------
 1850|    146|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  108|    146|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 146]
  |  |  ------------------
  |  |  109|    146|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    146|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    146|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1851|     32|				return 0;
 1852|    114|			break;
 1853|    114|		default:
  ------------------
  |  Branch (1853:3): [True: 0, False: 719k]
  ------------------
 1854|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1854:8): [True: 0, False: 0]
  ------------------
 1855|      0|				fprintf(stderr, "bad in_type=%d\n", in_type);
 1856|      0|			return 0;
 1857|   719k|		}
 1858|       |
 1859|   476k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  228|   476k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1859:7): [True: 2.12k, False: 474k]
  ------------------
 1860|  2.12k|			if (cont_level == 0) {
  ------------------
  |  Branch (1860:8): [True: 0, False: 2.12k]
  ------------------
 1861|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1861:9): [True: 0, False: 0]
  ------------------
 1862|      0|					fprintf(stderr,
 1863|      0|					    "indirect *zero* cont_level\n");
 1864|      0|				return 0;
 1865|      0|			}
 1866|  2.12k|			offset += ms->c.li[cont_level - 1].off;
 1867|  2.12k|			if (offset == 0) {
  ------------------
  |  Branch (1867:8): [True: 76, False: 2.04k]
  ------------------
 1868|     76|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     76|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1868:9): [True: 0, False: 76]
  ------------------
 1869|      0|					fprintf(stderr,
 1870|      0|					    "indirect *zero* offset\n");
 1871|     76|				return 0;
 1872|     76|			}
 1873|  2.04k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.04k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1873:8): [True: 0, False: 2.04k]
  ------------------
 1874|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1875|  2.04k|		}
 1876|   476k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1876:7): [True: 0, False: 476k]
  ------------------
 1877|      0|			return -1;
 1878|   476k|		ms->offset = offset;
 1879|       |
 1880|   476k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   476k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1880:7): [True: 0, False: 476k]
  ------------------
 1881|      0|			mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  453|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1882|      0|			    sizeof(union VALUETYPE));
 1883|      0|#ifndef COMPILE_ONLY
 1884|      0|			file_mdump(m);
 1885|      0|#endif
 1886|      0|		}
 1887|   476k|	}
 1888|       |
 1889|       |	/* Verify we have enough data to match magic type */
 1890|  99.0M|	switch (m->type) {
 1891|  1.70M|	case FILE_BYTE:
  ------------------
  |  |  246|  1.70M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1891:2): [True: 1.70M, False: 97.3M]
  ------------------
 1892|  1.70M|		if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1892:7): [True: 161k, False: 1.54M]
  ------------------
 1893|   161k|			return 0;
 1894|  1.54M|		break;
 1895|       |
 1896|  1.87M|	case FILE_SHORT:
  ------------------
  |  |  247|  1.87M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1896:2): [True: 1.87M, False: 97.1M]
  ------------------
 1897|  5.90M|	case FILE_BESHORT:
  ------------------
  |  |  252|  5.90M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1897:2): [True: 4.02M, False: 95.0M]
  ------------------
 1898|  9.81M|	case FILE_LESHORT:
  ------------------
  |  |  255|  9.81M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1898:2): [True: 3.91M, False: 95.1M]
  ------------------
 1899|  9.81M|		if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1899:7): [True: 801k, False: 9.01M]
  ------------------
 1900|   801k|			return 0;
 1901|  9.01M|		break;
 1902|       |
 1903|  9.01M|	case FILE_LONG:
  ------------------
  |  |  249|  1.46M|#define				FILE_LONG		4
  ------------------
  |  Branch (1903:2): [True: 1.46M, False: 97.5M]
  ------------------
 1904|  13.7M|	case FILE_BELONG:
  ------------------
  |  |  253|  13.7M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1904:2): [True: 12.3M, False: 86.7M]
  ------------------
 1905|  20.2M|	case FILE_LELONG:
  ------------------
  |  |  256|  20.2M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1905:2): [True: 6.43M, False: 92.6M]
  ------------------
 1906|  20.2M|	case FILE_MELONG:
  ------------------
  |  |  268|  20.2M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1906:2): [True: 30, False: 99.0M]
  ------------------
 1907|  20.2M|	case FILE_DATE:
  ------------------
  |  |  251|  20.2M|#define				FILE_DATE		6
  ------------------
  |  Branch (1907:2): [True: 0, False: 99.0M]
  ------------------
 1908|  20.2M|	case FILE_BEDATE:
  ------------------
  |  |  254|  20.2M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1908:2): [True: 333, False: 99.0M]
  ------------------
 1909|  20.2M|	case FILE_LEDATE:
  ------------------
  |  |  257|  20.2M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1909:2): [True: 302, False: 99.0M]
  ------------------
 1910|  20.2M|	case FILE_MEDATE:
  ------------------
  |  |  266|  20.2M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1910:2): [True: 36, False: 99.0M]
  ------------------
 1911|  20.2M|	case FILE_LDATE:
  ------------------
  |  |  259|  20.2M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1911:2): [True: 0, False: 99.0M]
  ------------------
 1912|  20.2M|	case FILE_BELDATE:
  ------------------
  |  |  260|  20.2M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1912:2): [True: 352, False: 99.0M]
  ------------------
 1913|  20.2M|	case FILE_LELDATE:
  ------------------
  |  |  261|  20.2M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1913:2): [True: 0, False: 99.0M]
  ------------------
 1914|  20.2M|	case FILE_MELDATE:
  ------------------
  |  |  267|  20.2M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1914:2): [True: 0, False: 99.0M]
  ------------------
 1915|  20.2M|	case FILE_FLOAT:
  ------------------
  |  |  278|  20.2M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1915:2): [True: 0, False: 99.0M]
  ------------------
 1916|  20.2M|	case FILE_BEFLOAT:
  ------------------
  |  |  279|  20.2M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1916:2): [True: 0, False: 99.0M]
  ------------------
 1917|  20.2M|	case FILE_LEFLOAT:
  ------------------
  |  |  280|  20.2M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1917:2): [True: 2.81k, False: 99.0M]
  ------------------
 1918|  20.2M|		if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1918:7): [True: 1.76M, False: 18.4M]
  ------------------
 1919|  1.76M|			return 0;
 1920|  18.4M|		break;
 1921|       |
 1922|  18.4M|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1922:2): [True: 0, False: 99.0M]
  ------------------
 1923|    229|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|    229|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1923:2): [True: 229, False: 99.0M]
  ------------------
 1924|  1.31k|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|  1.31k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1924:2): [True: 1.08k, False: 99.0M]
  ------------------
 1925|  1.31k|		if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1925:7): [True: 676, False: 638]
  ------------------
 1926|    676|			return 0;
 1927|    638|		break;
 1928|       |
 1929|    638|	case FILE_LEGUID:
  ------------------
  |  |  295|      0|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1929:2): [True: 0, False: 99.0M]
  ------------------
 1930|     55|	case FILE_BEGUID:
  ------------------
  |  |  296|     55|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1930:2): [True: 55, False: 99.0M]
  ------------------
 1931|   187k|	case FILE_GUID:
  ------------------
  |  |  294|   187k|#define				FILE_GUID		49
  ------------------
  |  Branch (1931:2): [True: 187k, False: 98.8M]
  ------------------
 1932|   187k|		if (offset_oob(nbytes, offset, 16))
  ------------------
  |  Branch (1932:7): [True: 18.5k, False: 168k]
  ------------------
 1933|  18.5k|			return 0;
 1934|   168k|		break;
 1935|       |
 1936|  63.5M|	case FILE_STRING:
  ------------------
  |  |  250|  63.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1936:2): [True: 63.5M, False: 35.5M]
  ------------------
 1937|  63.5M|	case FILE_PSTRING:
  ------------------
  |  |  258|  63.5M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1937:2): [True: 29.4k, False: 99.0M]
  ------------------
 1938|  64.5M|	case FILE_SEARCH:
  ------------------
  |  |  265|  64.5M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1938:2): [True: 978k, False: 98.0M]
  ------------------
 1939|  64.5M|	case FILE_OCTAL:
  ------------------
  |  |  306|  64.5M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1939:2): [True: 0, False: 99.0M]
  ------------------
 1940|  64.5M|		if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1940:7): [True: 10.6M, False: 53.9M]
  ------------------
 1941|  10.6M|			return 0;
 1942|  53.9M|		break;
 1943|       |
 1944|  53.9M|	case FILE_REGEX:
  ------------------
  |  |  262|   260k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1944:2): [True: 260k, False: 98.7M]
  ------------------
 1945|   260k|		if (nbytes < offset)
  ------------------
  |  Branch (1945:7): [True: 730, False: 260k]
  ------------------
 1946|    730|			return 0;
 1947|   260k|		break;
 1948|       |
 1949|   260k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  20.0k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1949:2): [True: 20.0k, False: 99.0M]
  ------------------
 1950|  20.0k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  382|  20.0k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  435|  20.0k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  395|  20.0k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1950:7): [True: 9.95k, False: 10.0k]
  ------------------
 1951|  9.95k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  452|  9.95k|#define CAST(T, b)	((T)(b))
  ------------------
 1952|  20.0k|		if (offset == 0)
  ------------------
  |  Branch (1952:7): [True: 1.28k, False: 18.7k]
  ------------------
 1953|  1.28k|			return 0;
 1954|       |
 1955|  18.7k|		if (nbytes < offset)
  ------------------
  |  Branch (1955:7): [True: 3.10k, False: 15.6k]
  ------------------
 1956|  3.10k|			return 0;
 1957|       |
 1958|  15.6k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1958:7): [True: 0, False: 15.6k]
  ------------------
 1959|      0|			return -1;
 1960|       |
 1961|  15.6k|		(*indir_count)++;
 1962|  15.6k|		sbb = *b;
 1963|  15.6k|		sbb.fbuf = s + offset;
 1964|  15.6k|		sbb.flen = nbytes - offset;
 1965|  15.6k|		sbb.ebuf = NULL;
 1966|  15.6k|		sbb.elen = 0;
 1967|  15.6k|		rv = -1;
 1968|  18.0k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1968:34): [True: 15.6k, False: 2.38k]
  ------------------
 1969|  15.6k|		    mlp = mlp->next)
 1970|  15.6k|		{
 1971|  15.6k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1971:8): [True: 13.2k, False: 2.38k]
  ------------------
 1972|  15.6k|			    mlp->nmagic, &sbb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  231|  15.6k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1973|  15.6k|			    name_count, printed_something, need_separator,
 1974|  15.6k|			    firstline, NULL, NULL)) != 0)
 1975|  13.2k|				break;
 1976|  15.6k|		}
 1977|  15.6k|		buffer_fini(&sbb);
 1978|       |
 1979|  15.6k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  15.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1979:7): [True: 0, False: 15.6k]
  ------------------
 1980|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1981|       |
 1982|  15.6k|		rbuf = file_pop_buffer(ms, pb);
 1983|  15.6k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|  2.66k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1983:7): [True: 2.66k, False: 12.9k]
  |  Branch (1983:23): [True: 936, False: 1.72k]
  ------------------
 1984|    936|			return -1;
 1985|       |
 1986|  14.7k|		if (rv == 1) {
  ------------------
  |  Branch (1986:7): [True: 12.3k, False: 2.38k]
  ------------------
 1987|  12.3k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  12.3k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  12.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  12.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  12.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  12.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1987:8): [True: 12.3k, False: 0]
  ------------------
 1988|  12.3k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  167|  12.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1988:8): [True: 0, False: 12.3k]
  ------------------
 1989|      0|			{
 1990|      0|				free(rbuf);
 1991|      0|				return -1;
 1992|      0|			}
 1993|  12.3k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1993:8): [True: 90, False: 12.2k]
  ------------------
 1994|     90|				free(rbuf);
 1995|     90|				return -1;
 1996|     90|			}
 1997|  12.3k|		}
 1998|  14.6k|		free(rbuf);
 1999|  14.6k|		return rv;
 2000|       |
 2001|  69.1k|	case FILE_USE:
  ------------------
  |  |  291|  69.1k|#define				FILE_USE		46
  ------------------
  |  Branch (2001:2): [True: 69.1k, False: 98.9M]
  ------------------
 2002|  69.1k|		if (nbytes < offset)
  ------------------
  |  Branch (2002:7): [True: 8.24k, False: 60.9k]
  ------------------
 2003|  8.24k|			return 0;
 2004|  60.9k|		rbuf = m->value.s;
 2005|  60.9k|		if (*rbuf == '^') {
  ------------------
  |  Branch (2005:7): [True: 451, False: 60.4k]
  ------------------
 2006|    451|			rbuf++;
 2007|    451|			flip = !flip;
 2008|    451|		}
 2009|  60.9k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (2009:7): [True: 0, False: 60.9k]
  ------------------
 2010|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 2011|      0|			return -1;
 2012|      0|		}
 2013|  60.9k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (2013:7): [True: 0, False: 60.9k]
  ------------------
 2014|      0|			file_error(ms, errno, "can't allocate continuation");
 2015|      0|			return -1;
 2016|      0|		}
 2017|       |
 2018|  60.9k|		oneed_separator = *need_separator;
 2019|  60.9k|		if (m->flag & NOSPACE)
  ------------------
  |  |  230|  60.9k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (2019:7): [True: 17.2k, False: 43.6k]
  ------------------
 2020|  17.2k|			*need_separator = 0;
 2021|       |
 2022|  60.9k|		nfound_match = 0;
 2023|  60.9k|		(*name_count)++;
 2024|  60.9k|		eoffset = ms->eoffset;
 2025|  60.9k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 2026|  60.9k|		    offset + o, mode, text, flip, indir_count, name_count,
 2027|  60.9k|		    printed_something, need_separator, firstline, returnval,
 2028|  60.9k|		    &nfound_match);
 2029|  60.9k|		ms->ms_value.q = nfound_match;
 2030|  60.9k|		(*name_count)--;
 2031|  60.9k|		*found_match |= nfound_match;
 2032|       |
 2033|  60.9k|		restore_cont(ms, &c);
 2034|       |
 2035|  60.9k|		if (rv != 1)
  ------------------
  |  Branch (2035:7): [True: 4.50k, False: 56.4k]
  ------------------
 2036|  4.50k|		    *need_separator = oneed_separator;
 2037|  60.9k|		ms->offset = offset;
 2038|  60.9k|		ms->eoffset = eoffset;
 2039|  60.9k|		return rv ? rv : *found_match;
  ------------------
  |  Branch (2039:10): [True: 57.1k, False: 3.74k]
  ------------------
 2040|       |
 2041|  60.9k|	case FILE_NAME:
  ------------------
  |  |  290|  60.9k|#define				FILE_NAME		45
  ------------------
  |  Branch (2041:2): [True: 60.9k, False: 98.9M]
  ------------------
 2042|  60.9k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  60.9k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  60.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  60.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  60.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  60.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  60.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (2042:7): [True: 0, False: 60.9k]
  ------------------
 2043|      0|			return 1;
 2044|  60.9k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (2044:7): [True: 0, False: 60.9k]
  ------------------
 2045|      0|			return -1;
 2046|  60.9k|		return 1;
 2047|   371k|	case FILE_DER:
  ------------------
  |  |  293|   371k|#define				FILE_DER		48
  ------------------
  |  Branch (2047:2): [True: 371k, False: 98.6M]
  ------------------
 2048|   383k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  248|   383k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2048:2): [True: 12.2k, False: 99.0M]
  ------------------
 2049|   386k|	case FILE_CLEAR:
  ------------------
  |  |  292|   386k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2049:2): [True: 3.04k, False: 99.0M]
  ------------------
 2050|  2.15M|	default:
  ------------------
  |  Branch (2050:2): [True: 1.77M, False: 97.2M]
  ------------------
 2051|  2.15M|		break;
 2052|  99.0M|	}
 2053|  85.5M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (2053:6): [True: 70, False: 85.5M]
  ------------------
 2054|     70|		return 0;
 2055|  85.5M|	return 1;
 2056|  85.5M|}
softmagic.c:mcopy:
 1380|  99.7M|{
 1381|  99.7M|	size_t size = sizeof(*p);
 1382|       |	/*
 1383|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1384|       |	 * anything, but setup pointers into the source
 1385|       |	 */
 1386|  99.7M|	if (indir == 0) {
  ------------------
  |  Branch (1386:6): [True: 99.0M, False: 719k]
  ------------------
 1387|  99.0M|		switch (type) {
 1388|   371k|		case FILE_DER:
  ------------------
  |  |  293|   371k|#define				FILE_DER		48
  ------------------
  |  Branch (1388:3): [True: 371k, False: 98.6M]
  ------------------
 1389|  1.34M|		case FILE_SEARCH:
  ------------------
  |  |  265|  1.34M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1389:3): [True: 978k, False: 98.0M]
  ------------------
 1390|  1.34M|			if (offset > nbytes)
  ------------------
  |  Branch (1390:8): [True: 59.0k, False: 1.29M]
  ------------------
 1391|  59.0k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  452|  59.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1392|  1.34M|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  453|  1.34M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1393|  1.34M|			ms->search.s_len = nbytes - offset;
 1394|  1.34M|			ms->search.offset = offset;
 1395|  1.34M|			return 0;
 1396|       |
 1397|   260k|		case FILE_REGEX: {
  ------------------
  |  |  262|   260k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1397:3): [True: 260k, False: 98.7M]
  ------------------
 1398|   260k|			const char *b;
 1399|   260k|			const char *c;
 1400|   260k|			const char *last;	/* end of search region */
 1401|   260k|			const char *buf;	/* start of search region */
 1402|   260k|			const char *end;
 1403|   260k|			size_t lines, linecnt, bytecnt;
 1404|       |
 1405|   260k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1405:8): [True: 0, False: 260k]
  |  Branch (1405:21): [True: 745, False: 260k]
  ------------------
 1406|    745|				ms->search.s_len = 0;
 1407|    745|				ms->search.s = NULL;
 1408|    745|				return 0;
 1409|    745|			}
 1410|       |
 1411|   260k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  382|   260k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  409|   260k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  395|   260k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1411:8): [True: 50.6k, False: 209k]
  ------------------
 1412|  50.6k|				linecnt = m->str_range;
  ------------------
  |  |  381|  50.6k|#define str_range _u._s._count
  ------------------
 1413|  50.6k|				bytecnt = linecnt * 80;
 1414|   209k|			} else {
 1415|   209k|				linecnt = 0;
 1416|   209k|				bytecnt = m->str_range;
  ------------------
  |  |  381|   209k|#define str_range _u._s._count
  ------------------
 1417|   209k|			}
 1418|       |
 1419|   260k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1419:8): [True: 188k, False: 71.6k]
  |  Branch (1419:24): [True: 62.7k, False: 8.89k]
  ------------------
 1420|   251k|				bytecnt = nbytes - offset;
 1421|   260k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1421:8): [True: 23.2k, False: 236k]
  ------------------
 1422|  23.2k|				bytecnt = ms->regex_max;
 1423|       |
 1424|   260k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  453|   260k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1425|   260k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  453|   260k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1426|       |			/* mget() guarantees buf <= last */
 1427|   413k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1427:35): [True: 202k, False: 210k]
  |  Branch (1427:44): [True: 199k, False: 3.36k]
  ------------------
 1428|   199k|			     ((b = CAST(const char *,
  ------------------
  |  |  452|   199k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1428:10): [True: 73.3k, False: 125k]
  ------------------
 1429|   199k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1430|   125k|			     || (b = CAST(const char *,
  ------------------
  |  |  452|   125k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1430:12): [True: 79.9k, False: 45.7k]
  ------------------
 1431|   125k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1432|   260k|			     lines--, b++) {
 1433|   153k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1433:9): [True: 150k, False: 2.87k]
  |  Branch (1433:24): [True: 78.7k, False: 71.6k]
  |  Branch (1433:40): [True: 0, False: 78.7k]
  ------------------
 1434|      0|					b++;
 1435|   153k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1435:9): [True: 150k, False: 2.87k]
  |  Branch (1435:24): [True: 71.6k, False: 78.7k]
  ------------------
 1436|  71.6k|					b++;
 1437|   153k|				last = b;
 1438|   153k|			}
 1439|   260k|			if (lines)
  ------------------
  |  Branch (1439:8): [True: 49.1k, False: 210k]
  ------------------
 1440|  49.1k|				last = end;
 1441|       |
 1442|   260k|			ms->search.s = buf;
 1443|   260k|			ms->search.s_len = last - buf;
 1444|   260k|			ms->search.offset = offset;
 1445|   260k|			ms->search.rm_len = 0;
 1446|   260k|			return 0;
 1447|   260k|		}
 1448|    290|		case FILE_BESTRING16:
  ------------------
  |  |  263|    290|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1448:3): [True: 290, False: 99.0M]
  ------------------
 1449|  58.0k|		case FILE_LESTRING16: {
  ------------------
  |  |  264|  58.0k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1449:3): [True: 57.7k, False: 99.0M]
  ------------------
 1450|  58.0k|			const unsigned char *src = s + offset;
 1451|  58.0k|			const unsigned char *esrc = s + nbytes;
 1452|  58.0k|			char *dst = p->s;
 1453|  58.0k|			char *edst = &p->s[sizeof(p->s) - 1];
 1454|       |
 1455|  58.0k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  263|  58.0k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1455:8): [True: 290, False: 57.7k]
  ------------------
 1456|    290|				src++;
 1457|       |
 1458|       |			/* check that offset is within range */
 1459|  58.0k|			if (offset >= nbytes)
  ------------------
  |  Branch (1459:8): [True: 1.15k, False: 56.8k]
  ------------------
 1460|  1.15k|				break;
 1461|  3.17M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1461:20): [True: 3.13M, False: 40.8k]
  ------------------
 1462|  3.13M|				if (dst < edst)
  ------------------
  |  Branch (1462:9): [True: 3.11M, False: 16.0k]
  ------------------
 1463|  3.11M|					*dst = *src;
 1464|  16.0k|				else
 1465|  16.0k|					break;
 1466|  3.11M|				if (*dst == '\0') {
  ------------------
  |  Branch (1466:9): [True: 1.41M, False: 1.70M]
  ------------------
 1467|  1.41M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  263|  1.41M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1467:10): [True: 3.73k, False: 1.41M]
  |  Branch (1467:10): [True: 530k, False: 883k]
  ------------------
 1468|  3.73k|					    *(src - 1) != '\0' :
 1469|  1.41M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1469:11): [True: 1.40M, False: 4.72k]
  ------------------
 1470|  1.40M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1470:10): [True: 529k, False: 875k]
  ------------------
 1471|   530k|						*dst = ' ';
 1472|  1.41M|				}
 1473|  3.11M|			}
 1474|  56.8k|			*edst = '\0';
 1475|  56.8k|			*dst = '\0';
 1476|  56.8k|			return 0;
 1477|  58.0k|		}
 1478|  63.5M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  250|  63.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1478:3): [True: 63.5M, False: 35.5M]
  ------------------
 1479|  63.5M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  258|  63.5M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1479:3): [True: 29.4k, False: 99.0M]
  ------------------
 1480|  63.5M|			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  381|  63.5M|#define str_range _u._s._count
  ------------------
              			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  381|  56.3k|#define str_range _u._s._count
  ------------------
  |  Branch (1480:8): [True: 56.3k, False: 63.5M]
  |  Branch (1480:29): [True: 56.3k, False: 0]
  ------------------
 1481|  56.3k|				size = m->str_range;
  ------------------
  |  |  381|  56.3k|#define str_range _u._s._count
  ------------------
 1482|  63.5M|			break;
 1483|  33.8M|		default:
  ------------------
  |  Branch (1483:3): [True: 33.8M, False: 65.2M]
  ------------------
 1484|  33.8M|			break;
 1485|  99.0M|		}
 1486|  99.0M|	}
 1487|       |
 1488|  98.1M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  297|  98.1M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1488:6): [True: 6.80k, False: 98.1M]
  ------------------
 1489|  6.80k|		(void)memset(p, '\0', sizeof(*p));
 1490|  6.80k|		p->q = offset;
 1491|  6.80k|		return 0;
 1492|  6.80k|	}
 1493|       |
 1494|  98.1M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1494:6): [True: 6.27M, False: 91.8M]
  ------------------
 1495|  6.27M|		(void)memset(p, '\0', sizeof(*p));
 1496|  6.27M|		return 0;
 1497|  6.27M|	}
 1498|  91.8M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1498:6): [True: 59.1M, False: 32.6M]
  ------------------
 1499|  59.1M|		nbytes = nbytes - offset;
 1500|  32.6M|	else
 1501|  32.6M|		nbytes = size;
 1502|       |
 1503|  91.8M|	(void)memcpy(p, s + offset, nbytes);
 1504|       |
 1505|       |	/*
 1506|       |	 * the usefulness of padding with zeroes eludes me, it
 1507|       |	 * might even cause problems
 1508|       |	 */
 1509|  91.8M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1509:6): [True: 59.2M, False: 32.6M]
  ------------------
 1510|  59.2M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  453|  59.2M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1511|  59.2M|		    sizeof(*p) - nbytes);
 1512|  91.8M|	return 0;
 1513|  98.1M|}
softmagic.c:offset_oob:
  114|  97.2M| {
  115|  97.2M|	if (o < 0)
  ------------------
  |  Branch (115:6): [True: 0, False: 97.2M]
  ------------------
  116|      0|		return 1;
  117|  97.2M|        if ((uintmax_t)o > n)
  ------------------
  |  Branch (117:13): [True: 5.46M, False: 91.7M]
  ------------------
  118|  5.46M|		return 1;
  119|  91.7M|        return i > n - (uintmax_t)o;
  120|  97.2M|}
softmagic.c:cvt_flip:
 1028|  86.2M|{
 1029|  86.2M|	if (flip == 0)
  ------------------
  |  Branch (1029:6): [True: 86.2M, False: 8.66k]
  ------------------
 1030|  86.2M|		return type;
 1031|  8.66k|	switch (type) {
 1032|      6|	case FILE_BESHORT:
  ------------------
  |  |  252|      6|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1032:2): [True: 6, False: 8.66k]
  ------------------
 1033|      6|		return FILE_LESHORT;
  ------------------
  |  |  255|      6|#define				FILE_LESHORT		10
  ------------------
 1034|  2.98k|	case FILE_BELONG:
  ------------------
  |  |  253|  2.98k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1034:2): [True: 2.98k, False: 5.68k]
  ------------------
 1035|  2.98k|		return FILE_LELONG;
  ------------------
  |  |  256|  2.98k|#define				FILE_LELONG		11
  ------------------
 1036|     34|	case FILE_BEDATE:
  ------------------
  |  |  254|     34|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1036:2): [True: 34, False: 8.63k]
  ------------------
 1037|     34|		return FILE_LEDATE;
  ------------------
  |  |  257|     34|#define				FILE_LEDATE		12
  ------------------
 1038|      0|	case FILE_BELDATE:
  ------------------
  |  |  260|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1038:2): [True: 0, False: 8.66k]
  ------------------
 1039|      0|		return FILE_LELDATE;
  ------------------
  |  |  261|      0|#define				FILE_LELDATE		16
  ------------------
 1040|      2|	case FILE_BEQUAD:
  ------------------
  |  |  271|      2|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1040:2): [True: 2, False: 8.66k]
  ------------------
 1041|      2|		return FILE_LEQUAD;
  ------------------
  |  |  270|      2|#define				FILE_LEQUAD		25
  ------------------
 1042|    356|	case FILE_BEQDATE:
  ------------------
  |  |  274|    356|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1042:2): [True: 356, False: 8.31k]
  ------------------
 1043|    356|		return FILE_LEQDATE;
  ------------------
  |  |  273|    356|#define				FILE_LEQDATE		28
  ------------------
 1044|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  277|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1044:2): [True: 0, False: 8.66k]
  ------------------
 1045|      0|		return FILE_LEQLDATE;
  ------------------
  |  |  276|      0|#define				FILE_LEQLDATE		31
  ------------------
 1046|      0|	case FILE_BEQWDATE:
  ------------------
  |  |  289|      0|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1046:2): [True: 0, False: 8.66k]
  ------------------
 1047|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  288|      0|#define				FILE_LEQWDATE		43
  ------------------
 1048|  3.84k|	case FILE_LESHORT:
  ------------------
  |  |  255|  3.84k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1048:2): [True: 3.84k, False: 4.82k]
  ------------------
 1049|  3.84k|		return FILE_BESHORT;
  ------------------
  |  |  252|  3.84k|#define				FILE_BESHORT		7
  ------------------
 1050|    183|	case FILE_LELONG:
  ------------------
  |  |  256|    183|#define				FILE_LELONG		11
  ------------------
  |  Branch (1050:2): [True: 183, False: 8.48k]
  ------------------
 1051|    183|		return FILE_BELONG;
  ------------------
  |  |  253|    183|#define				FILE_BELONG		8
  ------------------
 1052|     30|	case FILE_LEDATE:
  ------------------
  |  |  257|     30|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1052:2): [True: 30, False: 8.63k]
  ------------------
 1053|     30|		return FILE_BEDATE;
  ------------------
  |  |  254|     30|#define				FILE_BEDATE		9
  ------------------
 1054|      0|	case FILE_LELDATE:
  ------------------
  |  |  261|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1054:2): [True: 0, False: 8.66k]
  ------------------
 1055|      0|		return FILE_BELDATE;
  ------------------
  |  |  260|      0|#define				FILE_BELDATE		15
  ------------------
 1056|     32|	case FILE_LEQUAD:
  ------------------
  |  |  270|     32|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1056:2): [True: 32, False: 8.63k]
  ------------------
 1057|     32|		return FILE_BEQUAD;
  ------------------
  |  |  271|     32|#define				FILE_BEQUAD		26
  ------------------
 1058|      0|	case FILE_LEQDATE:
  ------------------
  |  |  273|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1058:2): [True: 0, False: 8.66k]
  ------------------
 1059|      0|		return FILE_BEQDATE;
  ------------------
  |  |  274|      0|#define				FILE_BEQDATE		29
  ------------------
 1060|      7|	case FILE_LEQLDATE:
  ------------------
  |  |  276|      7|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1060:2): [True: 7, False: 8.66k]
  ------------------
 1061|      7|		return FILE_BEQLDATE;
  ------------------
  |  |  277|      7|#define				FILE_BEQLDATE		32
  ------------------
 1062|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  288|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1062:2): [True: 0, False: 8.66k]
  ------------------
 1063|      0|		return FILE_BEQWDATE;
  ------------------
  |  |  289|      0|#define				FILE_BEQWDATE		44
  ------------------
 1064|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1064:2): [True: 0, False: 8.66k]
  ------------------
 1065|      0|		return FILE_LEFLOAT;
  ------------------
  |  |  280|      0|#define				FILE_LEFLOAT		35
  ------------------
 1066|      0|	case FILE_LEFLOAT:
  ------------------
  |  |  280|      0|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1066:2): [True: 0, False: 8.66k]
  ------------------
 1067|      0|		return FILE_BEFLOAT;
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
 1068|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1068:2): [True: 0, False: 8.66k]
  ------------------
 1069|      0|		return FILE_LEDOUBLE;
  ------------------
  |  |  283|      0|#define				FILE_LEDOUBLE		38
  ------------------
 1070|      0|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|      0|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1070:2): [True: 0, False: 8.66k]
  ------------------
 1071|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1072|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1072:2): [True: 0, False: 8.66k]
  ------------------
 1073|      0|		return FILE_LEMSDOSDATE;
  ------------------
  |  |  301|      0|#define				FILE_LEMSDOSDATE	56
  ------------------
 1074|      0|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|      0|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1074:2): [True: 0, False: 8.66k]
  ------------------
 1075|      0|		return FILE_BEMSDOSDATE;
  ------------------
  |  |  302|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
 1076|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1076:2): [True: 0, False: 8.66k]
  ------------------
 1077|      0|		return FILE_LEMSDOSTIME;
  ------------------
  |  |  304|      0|#define				FILE_LEMSDOSTIME	59
  ------------------
 1078|      0|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|      0|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1078:2): [True: 0, False: 8.66k]
  ------------------
 1079|      0|		return FILE_BEMSDOSTIME;
  ------------------
  |  |  305|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
 1080|  1.18k|	default:
  ------------------
  |  Branch (1080:2): [True: 1.18k, False: 7.47k]
  ------------------
 1081|  1.18k|		return type;
 1082|  8.66k|	}
 1083|  8.66k|}
softmagic.c:do_ops:
 1518|   484k|{
 1519|   484k|	intmax_t offset;
 1520|       |	// On purpose not INTMAX_MAX
 1521|   484k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1521:6): [True: 7.12k, False: 477k]
  |  Branch (1521:25): [True: 96, False: 477k]
  ------------------
 1522|   477k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1522:6): [True: 189, False: 477k]
  |  Branch (1522:25): [True: 0, False: 477k]
  ------------------
 1523|  7.40k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  7.40k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1523:7): [True: 0, False: 7.40k]
  ------------------
 1524|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1525|  7.40k|		return 1;
 1526|  7.40k|	}
 1527|       |	   
 1528|   477k|	if (off) {
  ------------------
  |  Branch (1528:6): [True: 75.5k, False: 401k]
  ------------------
 1529|  75.5k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  352|  75.5k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1529:11): [True: 75.5k, False: 0]
  ------------------
 1530|     32|		case FILE_OPAND:
  ------------------
  |  |  344|     32|#define				FILE_OPAND	0
  ------------------
  |  Branch (1530:3): [True: 32, False: 75.5k]
  ------------------
 1531|     32|			offset = lhs & off;
 1532|     32|			break;
 1533|      0|		case FILE_OPOR:
  ------------------
  |  |  345|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1533:3): [True: 0, False: 75.5k]
  ------------------
 1534|      0|			offset = lhs | off;
 1535|      0|			break;
 1536|      0|		case FILE_OPXOR:
  ------------------
  |  |  346|      0|#define				FILE_OPXOR	2
  ------------------
  |  Branch (1536:3): [True: 0, False: 75.5k]
  ------------------
 1537|      0|			offset = lhs ^ off;
 1538|      0|			break;
 1539|  64.1k|		case FILE_OPADD:
  ------------------
  |  |  347|  64.1k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1539:3): [True: 64.1k, False: 11.3k]
  ------------------
 1540|  64.1k|			offset = lhs + off;
 1541|  64.1k|			break;
 1542|  1.17k|		case FILE_OPMINUS:
  ------------------
  |  |  348|  1.17k|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1542:3): [True: 1.17k, False: 74.3k]
  ------------------
 1543|  1.17k|			offset = lhs - off;
 1544|  1.17k|			break;
 1545|  10.0k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  349|  10.0k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1545:3): [True: 10.0k, False: 65.4k]
  ------------------
 1546|  10.0k|			offset = lhs * off;
 1547|  10.0k|			break;
 1548|     75|		case FILE_OPDIVIDE:
  ------------------
  |  |  350|     75|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1548:3): [True: 75, False: 75.4k]
  ------------------
 1549|     75|			offset = lhs / off;
 1550|     75|			break;
 1551|      0|		case FILE_OPMODULO:
  ------------------
  |  |  351|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1551:3): [True: 0, False: 75.5k]
  ------------------
 1552|      0|			offset = lhs % off;
 1553|      0|			break;
 1554|  75.5k|		}
 1555|  75.5k|	} else
 1556|   401k|		offset = lhs;
 1557|   477k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  356|   477k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1557:6): [True: 0, False: 477k]
  ------------------
 1558|      0|		offset = ~offset;
 1559|   477k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1559:6): [True: 425, False: 476k]
  ------------------
 1560|    425|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    425|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1560:7): [True: 0, False: 425]
  ------------------
 1561|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1562|    425|		return 1;
 1563|    425|	}
 1564|   476k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  452|   476k|#define CAST(T, b)	((T)(b))
  ------------------
 1565|   476k|	return 0;
 1566|   477k|}
softmagic.c:cvt_id3:
 1016|    104|{
 1017|    104|	v = ((((v >>  0) & 0x7f) <<  0) |
 1018|    104|	     (((v >>  8) & 0x7f) <<  7) |
 1019|    104|	     (((v >> 16) & 0x7f) << 14) |
 1020|    104|	     (((v >> 24) & 0x7f) << 21));
 1021|    104|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    104|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1021:6): [True: 0, False: 104]
  ------------------
 1022|      0|		fprintf(stderr, "id3 offs=%u\n", v);
 1023|    104|	return v;
 1024|    104|}
softmagic.c:file_fmtcheck:
  172|   133k|{
  173|   133k|	const char *ptr;
  174|       |
  175|   133k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (175:6): [True: 92.8k, False: 40.5k]
  ------------------
  176|  92.8k|		return desc;
  177|       |
  178|  40.5k|	ptr = fmtcheck(desc, def);
  179|  40.5k|	if (ptr == def)
  ------------------
  |  Branch (179:6): [True: 0, False: 40.5k]
  ------------------
  180|      0|		file_magerror(ms,
  181|      0|		    "%s, %" SIZE_T_FORMAT "u: format `%s' does not match"
  182|      0|		    " with `%s'", file, line, desc, def);
  183|  40.5k|	return ptr;
  184|   133k|}
softmagic.c:save_cont:
 1628|  60.9k|{
 1629|  60.9k|	size_t len;
 1630|  60.9k|	*c = ms->c;
 1631|  60.9k|	len = c->len * sizeof(*c->li);
 1632|  60.9k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  452|  60.9k|#define CAST(T, b)	((T)(b))
  ------------------
 1633|  60.9k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1633:6): [True: 0, False: 60.9k]
  ------------------
 1634|      0|		ms->c = *c;
 1635|      0|		return -1;
 1636|      0|	}
 1637|  60.9k|	memcpy(ms->c.li, c->li, len);
 1638|  60.9k|	return 0;
 1639|  60.9k|}
softmagic.c:restore_cont:
 1643|  60.9k|{
 1644|  60.9k|	free(ms->c.li);
 1645|  60.9k|	ms->c = *c;
 1646|  60.9k|}
softmagic.c:mconvert:
 1205|  85.5M|{
 1206|  85.5M|	union VALUETYPE *p = &ms->ms_value;
 1207|       |
 1208|  85.5M|	switch (cvt_flip(m->type, flip)) {
 1209|  1.54M|	case FILE_BYTE:
  ------------------
  |  |  246|  1.54M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1209:2): [True: 1.54M, False: 83.9M]
  ------------------
 1210|  1.54M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1210:7): [True: 0, False: 1.54M]
  ------------------
 1211|      0|			goto out;
 1212|  1.54M|		return 1;
 1213|  1.56M|	case FILE_SHORT:
  ------------------
  |  |  247|  1.56M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1213:2): [True: 1.56M, False: 83.9M]
  ------------------
 1214|  1.56M|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|  1.56M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1214:2): [True: 0, False: 85.5M]
  ------------------
 1215|  1.56M|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|  1.56M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1215:2): [True: 0, False: 85.5M]
  ------------------
 1216|  1.56M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1216:7): [True: 0, False: 1.56M]
  ------------------
 1217|      0|			goto out;
 1218|  1.56M|		return 1;
 1219|  1.37M|	case FILE_LONG:
  ------------------
  |  |  249|  1.37M|#define				FILE_LONG		4
  ------------------
  |  Branch (1219:2): [True: 1.37M, False: 84.1M]
  ------------------
 1220|  1.37M|	case FILE_DATE:
  ------------------
  |  |  251|  1.37M|#define				FILE_DATE		6
  ------------------
  |  Branch (1220:2): [True: 0, False: 85.5M]
  ------------------
 1221|  1.37M|	case FILE_LDATE:
  ------------------
  |  |  259|  1.37M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1221:2): [True: 0, False: 85.5M]
  ------------------
 1222|  1.37M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1222:7): [True: 0, False: 1.37M]
  ------------------
 1223|      0|			goto out;
 1224|  1.37M|		return 1;
 1225|  59.5k|	case FILE_QUAD:
  ------------------
  |  |  269|  59.5k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1225:2): [True: 59.5k, False: 85.4M]
  ------------------
 1226|  59.5k|	case FILE_QDATE:
  ------------------
  |  |  272|  59.5k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1226:2): [True: 0, False: 85.5M]
  ------------------
 1227|  59.5k|	case FILE_QLDATE:
  ------------------
  |  |  275|  59.5k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1227:2): [True: 0, False: 85.5M]
  ------------------
 1228|  59.6k|	case FILE_QWDATE:
  ------------------
  |  |  287|  59.6k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1228:2): [True: 162, False: 85.5M]
  ------------------
 1229|  66.4k|	case FILE_OFFSET:
  ------------------
  |  |  297|  66.4k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1229:2): [True: 6.80k, False: 85.5M]
  ------------------
 1230|  66.4k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1230:7): [True: 0, False: 66.4k]
  ------------------
 1231|      0|			goto out;
 1232|  66.4k|		return 1;
 1233|  53.3M|	case FILE_STRING:
  ------------------
  |  |  250|  53.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1233:2): [True: 53.3M, False: 32.2M]
  ------------------
 1234|  53.3M|	case FILE_BESTRING16:
  ------------------
  |  |  263|  53.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1234:2): [True: 290, False: 85.5M]
  ------------------
 1235|  53.3M|	case FILE_LESTRING16:
  ------------------
  |  |  264|  53.3M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1235:2): [True: 57.7k, False: 85.4M]
  ------------------
 1236|  53.3M|	case FILE_OCTAL: {
  ------------------
  |  |  306|  53.3M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1236:2): [True: 0, False: 85.5M]
  ------------------
 1237|       |		/* Null terminate and eat *trailing* return */
 1238|  53.3M|		p->s[sizeof(p->s) - 1] = '\0';
 1239|  53.3M|		return 1;
 1240|  53.3M|	}
 1241|  22.6k|	case FILE_PSTRING: {
  ------------------
  |  |  258|  22.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1241:2): [True: 22.6k, False: 85.5M]
  ------------------
 1242|  22.6k|		char *ptr1, *ptr2;
 1243|  22.6k|		size_t len, sz = file_pstring_length_size(ms, m);
 1244|  22.6k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  175|  22.6k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  22.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1244:7): [True: 0, False: 22.6k]
  ------------------
 1245|      0|			return 0;
 1246|  22.6k|		ptr1 = p->s;
 1247|  22.6k|		ptr2 = ptr1 + sz;
 1248|  22.6k|		len = file_pstring_get_length(ms, m, ptr1);
 1249|  22.6k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  175|  22.6k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  22.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1249:7): [True: 70, False: 22.5k]
  ------------------
 1250|     70|			return 0;
 1251|  22.5k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1252|  22.5k|		if (len >= sz) {
  ------------------
  |  Branch (1252:7): [True: 13.5k, False: 9.00k]
  ------------------
 1253|       |			/*
 1254|       |			 * The size of the pascal string length (sz)
 1255|       |			 * is 1, 2, or 4. We need at least 1 byte for NUL
 1256|       |			 * termination, but we've already truncated the
 1257|       |			 * string by p->s, so we need to deduct sz.
 1258|       |			 * Because we can use one of the bytes of the length
 1259|       |			 * after we shifted as NUL termination.
 1260|       |			 */
 1261|  13.5k|			len = sz;
 1262|  13.5k|		}
 1263|  2.07M|		while (len--)
  ------------------
  |  Branch (1263:10): [True: 2.05M, False: 22.5k]
  ------------------
 1264|  2.05M|			*ptr1++ = *ptr2++;
 1265|  22.5k|		*ptr1 = '\0';
 1266|  22.5k|		return 1;
 1267|  22.6k|	}
 1268|  3.76M|	case FILE_BESHORT:
  ------------------
  |  |  252|  3.76M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1268:2): [True: 3.76M, False: 81.7M]
  ------------------
 1269|  3.76M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|  3.76M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1269:2): [True: 0, False: 85.5M]
  ------------------
 1270|  3.76M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|  3.76M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1270:2): [True: 0, False: 85.5M]
  ------------------
 1271|  3.76M|		p->h = CAST(short, BE16(p->hs));
  ------------------
  |  |  452|  3.76M|#define CAST(T, b)	((T)(b))
  ------------------
 1272|  3.76M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1272:7): [True: 0, False: 3.76M]
  ------------------
 1273|      0|			goto out;
 1274|  3.76M|		return 1;
 1275|  11.3M|	case FILE_BELONG:
  ------------------
  |  |  253|  11.3M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1275:2): [True: 11.3M, False: 74.1M]
  ------------------
 1276|  11.3M|	case FILE_BEDATE:
  ------------------
  |  |  254|  11.3M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1276:2): [True: 309, False: 85.5M]
  ------------------
 1277|  11.3M|	case FILE_BELDATE:
  ------------------
  |  |  260|  11.3M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1277:2): [True: 287, False: 85.5M]
  ------------------
 1278|  11.3M|		p->l = CAST(int32_t, BE32(p->hl));
  ------------------
  |  |  452|  11.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1279|  11.3M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1279:7): [True: 0, False: 11.3M]
  ------------------
 1280|      0|			goto out;
 1281|  11.3M|		return 1;
 1282|   913k|	case FILE_BEQUAD:
  ------------------
  |  |  271|   913k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1282:2): [True: 913k, False: 84.6M]
  ------------------
 1283|   913k|	case FILE_BEQDATE:
  ------------------
  |  |  274|   913k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1283:2): [True: 78, False: 85.5M]
  ------------------
 1284|   913k|	case FILE_BEQLDATE:
  ------------------
  |  |  277|   913k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1284:2): [True: 155, False: 85.5M]
  ------------------
 1285|   913k|	case FILE_BEQWDATE:
  ------------------
  |  |  289|   913k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1285:2): [True: 0, False: 85.5M]
  ------------------
 1286|   913k|		p->q = CAST(uint64_t, BE64(p->hq));
  ------------------
  |  |  452|   913k|#define CAST(T, b)	((T)(b))
  ------------------
 1287|   913k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1287:7): [True: 0, False: 913k]
  ------------------
 1288|      0|			goto out;
 1289|   913k|		return 1;
 1290|  3.67M|	case FILE_LESHORT:
  ------------------
  |  |  255|  3.67M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1290:2): [True: 3.67M, False: 81.8M]
  ------------------
 1291|  3.67M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|  3.67M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1291:2): [True: 219, False: 85.5M]
  ------------------
 1292|  3.67M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|  3.67M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1292:2): [True: 219, False: 85.5M]
  ------------------
 1293|  3.67M|		p->h = CAST(short, LE16(p->hs));
  ------------------
  |  |  452|  3.67M|#define CAST(T, b)	((T)(b))
  ------------------
 1294|  3.67M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1294:7): [True: 0, False: 3.67M]
  ------------------
 1295|      0|			goto out;
 1296|  3.67M|		return 1;
 1297|  5.72M|	case FILE_LELONG:
  ------------------
  |  |  256|  5.72M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1297:2): [True: 5.72M, False: 79.8M]
  ------------------
 1298|  5.72M|	case FILE_LEDATE:
  ------------------
  |  |  257|  5.72M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1298:2): [True: 301, False: 85.5M]
  ------------------
 1299|  5.72M|	case FILE_LELDATE:
  ------------------
  |  |  261|  5.72M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1299:2): [True: 0, False: 85.5M]
  ------------------
 1300|  5.72M|		p->l = CAST(int32_t, LE32(p->hl));
  ------------------
  |  |  452|  5.72M|#define CAST(T, b)	((T)(b))
  ------------------
 1301|  5.72M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1301:7): [True: 0, False: 5.72M]
  ------------------
 1302|      0|			goto out;
 1303|  5.72M|		return 1;
 1304|   733k|	case FILE_LEQUAD:
  ------------------
  |  |  270|   733k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1304:2): [True: 733k, False: 84.8M]
  ------------------
 1305|   733k|	case FILE_LEQDATE:
  ------------------
  |  |  273|   733k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1305:2): [True: 356, False: 85.5M]
  ------------------
 1306|   733k|	case FILE_LEQLDATE:
  ------------------
  |  |  276|   733k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1306:2): [True: 6, False: 85.5M]
  ------------------
 1307|   734k|	case FILE_LEQWDATE:
  ------------------
  |  |  288|   734k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1307:2): [True: 978, False: 85.5M]
  ------------------
 1308|   734k|		p->q = CAST(uint64_t, LE64(p->hq));
  ------------------
  |  |  452|   734k|#define CAST(T, b)	((T)(b))
  ------------------
 1309|   734k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1309:7): [True: 0, False: 734k]
  ------------------
 1310|      0|			goto out;
 1311|   734k|		return 1;
 1312|     30|	case FILE_MELONG:
  ------------------
  |  |  268|     30|#define				FILE_MELONG		23
  ------------------
  |  Branch (1312:2): [True: 30, False: 85.5M]
  ------------------
 1313|     66|	case FILE_MEDATE:
  ------------------
  |  |  266|     66|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1313:2): [True: 36, False: 85.5M]
  ------------------
 1314|     66|	case FILE_MELDATE:
  ------------------
  |  |  267|     66|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1314:2): [True: 0, False: 85.5M]
  ------------------
 1315|     66|		p->l = CAST(int32_t, ME32(p->hl));
  ------------------
  |  |  452|     66|#define CAST(T, b)	((T)(b))
  ------------------
 1316|     66|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1316:7): [True: 0, False: 66]
  ------------------
 1317|      0|			goto out;
 1318|     66|		return 1;
 1319|      0|	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1319:2): [True: 0, False: 85.5M]
  ------------------
 1320|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1320:7): [True: 0, False: 0]
  ------------------
 1321|      0|			goto out;
 1322|      0|		return 1;
 1323|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1323:2): [True: 0, False: 85.5M]
  ------------------
 1324|      0|		p->l = BE32(p->hl);
  ------------------
  |  |   95|      0|#define BE32(p) ( \
  |  |   96|      0|    (CAST(uint32_t, (p)[0])<<24)| \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|      0|    (CAST(uint32_t, (p)[1])<<16)| \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|      0|    (CAST(uint32_t, (p)[2])<<8)| \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|      0|    (CAST(uint32_t, (p)[3])))
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1325|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1325:7): [True: 0, False: 0]
  ------------------
 1326|      0|			goto out;
 1327|      0|		return 1;
 1328|  2.81k|	case FILE_LEFLOAT:
  ------------------
  |  |  280|  2.81k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1328:2): [True: 2.81k, False: 85.5M]
  ------------------
 1329|  2.81k|		p->l = LE32(p->hl);
  ------------------
  |  |   90|  2.81k|#define LE32(p) ( \
  |  |   91|  2.81k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  452|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|  2.81k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  452|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  2.81k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  452|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  2.81k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  452|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1330|  2.81k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1330:7): [True: 0, False: 2.81k]
  ------------------
 1331|      0|			goto out;
 1332|  2.81k|		return 1;
 1333|      0|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1333:2): [True: 0, False: 85.5M]
  ------------------
 1334|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1334:7): [True: 0, False: 0]
  ------------------
 1335|      0|			goto out;
 1336|      0|		return 1;
 1337|    154|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|    154|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1337:2): [True: 154, False: 85.5M]
  ------------------
 1338|    154|		p->q = BE64(p->hq);
  ------------------
  |  |   72|    154|#define BE64(p) ( \
  |  |   73|    154|    (CAST(uint64_t, (p)[0])<<56)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   74|    154|    (CAST(uint64_t, (p)[1])<<48)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    154|    (CAST(uint64_t, (p)[2])<<40)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    154|    (CAST(uint64_t, (p)[3])<<32)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    154|    (CAST(uint64_t, (p)[4])<<24)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    154|    (CAST(uint64_t, (p)[5])<<16)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    154|    (CAST(uint64_t, (p)[6])<<8)| \
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   80|    154|    (CAST(uint64_t, (p)[7])))
  |  |  ------------------
  |  |  |  |  452|    154|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1339|    154|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1339:7): [True: 0, False: 154]
  ------------------
 1340|      0|			goto out;
 1341|    154|		return 1;
 1342|    484|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    484|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1342:2): [True: 484, False: 85.5M]
  ------------------
 1343|    484|		p->q = LE64(p->hq);
  ------------------
  |  |   81|    484|#define LE64(p) ( \
  |  |   82|    484|    (CAST(uint64_t, (p)[7])<<56)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   83|    484|    (CAST(uint64_t, (p)[6])<<48)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    484|    (CAST(uint64_t, (p)[5])<<40)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    484|    (CAST(uint64_t, (p)[4])<<32)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    484|    (CAST(uint64_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    484|    (CAST(uint64_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    484|    (CAST(uint64_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    484|    (CAST(uint64_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1344|    484|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1344:7): [True: 0, False: 484]
  ------------------
 1345|      0|			goto out;
 1346|    484|		return 1;
 1347|   260k|	case FILE_REGEX:
  ------------------
  |  |  262|   260k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1347:2): [True: 260k, False: 85.2M]
  ------------------
 1348|   851k|	case FILE_SEARCH:
  ------------------
  |  |  265|   851k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1348:2): [True: 591k, False: 84.9M]
  ------------------
 1349|   863k|	case FILE_DEFAULT:
  ------------------
  |  |  248|   863k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1349:2): [True: 12.2k, False: 85.5M]
  ------------------
 1350|   866k|	case FILE_CLEAR:
  ------------------
  |  |  292|   866k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1350:2): [True: 3.04k, False: 85.5M]
  ------------------
 1351|   866k|	case FILE_NAME:
  ------------------
  |  |  290|   866k|#define				FILE_NAME		45
  ------------------
  |  Branch (1351:2): [True: 0, False: 85.5M]
  ------------------
 1352|   866k|	case FILE_USE:
  ------------------
  |  |  291|   866k|#define				FILE_USE		46
  ------------------
  |  Branch (1352:2): [True: 0, False: 85.5M]
  ------------------
 1353|  1.23M|	case FILE_DER:
  ------------------
  |  |  293|  1.23M|#define				FILE_DER		48
  ------------------
  |  Branch (1353:2): [True: 371k, False: 85.1M]
  ------------------
 1354|  1.40M|	case FILE_GUID:
  ------------------
  |  |  294|  1.40M|#define				FILE_GUID		49
  ------------------
  |  Branch (1354:2): [True: 168k, False: 85.3M]
  ------------------
 1355|  1.40M|	case FILE_LEGUID:
  ------------------
  |  |  295|  1.40M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1355:2): [True: 0, False: 85.5M]
  ------------------
 1356|  1.40M|	case FILE_BEGUID:
  ------------------
  |  |  296|  1.40M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1356:2): [True: 18, False: 85.5M]
  ------------------
 1357|  1.40M|		return 1;
 1358|      0|	default:
  ------------------
  |  Branch (1358:2): [True: 0, False: 85.5M]
  ------------------
 1359|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1360|      0|		return 0;
 1361|  85.5M|	}
 1362|      0|out:
 1363|      0|	file_magerror(ms, "zerodivide/overflow/underflow in mconvert()");
 1364|      0|	return 0;
 1365|  85.5M|}
softmagic.c:cvt_8:
 1139|  1.54M|{
 1140|  1.54M|	DO_CVT(m, b, 8);
  ------------------
  |  | 1131|  1.54M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  1.54M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 661k, False: 886k]
  |  |  ------------------
  |  | 1132|   661k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|   661k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|   661k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 82.3k, False: 579k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   661k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  82.3k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 82.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  69.1k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  69.1k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 69.1k, False: 13.2k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  69.1k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  69.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  69.1k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 82.3k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 82.3k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 82.3k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|  12.2k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  12.2k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 12.2k, False: 70.1k]
  |  |  |  |  ------------------
  |  |  |  | 1109|  12.2k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  12.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|  12.2k|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 82.3k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    528|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    528|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 528, False: 81.8k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    528|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    528|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    528|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 528]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    528|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    528|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    528|		return -1; \
  |  |  |  |  |  | 1090|    528|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    528|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 528]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    528|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    528|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    528|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    528|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    528|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 528]
  |  |  |  |  ------------------
  |  |  |  | 1117|    528|				return -1; \
  |  |  |  | 1118|    528|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    528|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    528|			break; \
  |  |  |  | 1120|    528|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    526|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 526, False: 81.8k]
  |  |  |  |  ------------------
  |  |  |  | 1121|    526|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    526|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    526|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 526]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    526|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    526|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    526|		return -1; \
  |  |  |  |  |  | 1090|    526|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    526|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 526]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    526|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    526|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    526|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    526|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    526|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 526]
  |  |  |  |  ------------------
  |  |  |  | 1123|    526|				return -1; \
  |  |  |  | 1124|    526|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    526|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    526|			break; \
  |  |  |  | 1126|  82.3k|		} \
  |  |  |  | 1127|   661k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|   661k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 661k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   661k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|   886k|	} else { \
  |  | 1134|   886k|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|   886k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|   886k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 40.8k, False: 845k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   886k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  40.8k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 40.8k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  34.2k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  34.2k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 34.2k, False: 6.57k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  34.2k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  34.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  34.2k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|  6.51k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  6.51k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 6.51k, False: 34.3k]
  |  |  |  |  ------------------
  |  |  |  | 1109|  6.51k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  6.51k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|  6.51k|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|     69|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|     69|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 69, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  | 1115|     69|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|     69|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 69]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|     69|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|     69|		return -1; \
  |  |  |  |  |  | 1090|     69|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 69]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|     69|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|     69|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|     69|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  |  | 1117|     69|				return -1; \
  |  |  |  | 1118|     69|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|     69|			break; \
  |  |  |  | 1120|     69|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|      0|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 0, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  | 1121|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      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); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|      0|			break; \
  |  |  |  | 1126|  40.8k|		} \
  |  |  |  | 1127|   886k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|   886k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 886k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   886k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|   886k|	}
  ------------------
 1141|  1.54M|	return 0;
 1142|  1.54M|}
softmagic.c:cvt_16:
 1146|  9.01M|{
 1147|  9.01M|	DO_CVT(m, h, 16);
  ------------------
  |  | 1131|  9.01M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  9.01M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 1.15M, False: 7.85M]
  |  |  ------------------
  |  | 1132|  1.15M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|  1.15M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  1.15M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 115k, False: 1.03M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.15M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   115k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 115k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   115k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   115k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 115k, False: 732]
  |  |  |  |  ------------------
  |  |  |  | 1097|   115k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   115k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   115k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     34|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     34|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 34, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     34|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     34|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     34|			break; \
  |  |  |  | 1108|    290|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    290|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 290, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1109|    290|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    290|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|    290|			break; \
  |  |  |  | 1111|     67|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|     67|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 67, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1112|     67|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     67|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|     67|			break; \
  |  |  |  | 1114|    275|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    275|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 275, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    275|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    275|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    275|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 275]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    275|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    275|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    275|		return -1; \
  |  |  |  |  |  | 1090|    275|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    275|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 275]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    275|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    275|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    275|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    275|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    275|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 275]
  |  |  |  |  ------------------
  |  |  |  | 1117|    275|				return -1; \
  |  |  |  | 1118|    275|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    275|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    275|			break; \
  |  |  |  | 1120|    275|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|     66|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 66, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1121|     66|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|     66|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 66]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|     66|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|     66|		return -1; \
  |  |  |  |  |  | 1090|     66|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 66]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|     66|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|     66|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|     66|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  |  | 1123|     66|				return -1; \
  |  |  |  | 1124|     66|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|     66|			break; \
  |  |  |  | 1126|   115k|		} \
  |  |  |  | 1127|  1.15M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  1.15M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.15M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.15M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  7.85M|	} else { \
  |  | 1134|  7.85M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  7.85M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.85M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 425k, False: 7.43M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  7.85M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   425k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 425k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   400k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   400k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 400k, False: 25.2k]
  |  |  |  |  ------------------
  |  |  |  | 1097|   400k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   400k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   400k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 425k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 425k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     73|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     73|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 73, False: 425k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     73|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     73|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     73|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 425k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 425k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 0, False: 425k]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|				return -1; \
  |  |  |  | 1118|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			break; \
  |  |  |  | 1120|  25.1k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|  25.1k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 25.1k, False: 400k]
  |  |  |  |  ------------------
  |  |  |  | 1121|  25.1k|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  25.1k|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 25.1k]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|  25.1k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|  25.1k|		return -1; \
  |  |  |  |  |  | 1090|  25.1k|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 25.1k]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|  25.1k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|  25.1k|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|  25.1k|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 25.1k]
  |  |  |  |  ------------------
  |  |  |  | 1123|  25.1k|				return -1; \
  |  |  |  | 1124|  25.1k|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|  25.1k|			break; \
  |  |  |  | 1126|   425k|		} \
  |  |  |  | 1127|  7.85M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  7.85M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 7.85M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  7.85M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  7.85M|	}
  ------------------
 1148|  9.01M|	return 0;
 1149|  9.01M|}
softmagic.c:cvt_32:
 1153|  18.4M|{
 1154|  18.4M|	DO_CVT(m, l, 32);
  ------------------
  |  | 1131|  18.4M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  18.4M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 2.72M, False: 15.7M]
  |  |  ------------------
  |  | 1132|  2.72M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|  2.72M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  2.72M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 411k, False: 2.31M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  2.72M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   411k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 411k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   410k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   410k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 410k, False: 881]
  |  |  |  |  ------------------
  |  |  |  | 1097|   410k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   410k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   410k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|     81|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|     81|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 81, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1103|     81|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     81|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|     81|			break; \
  |  |  |  | 1105|    150|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|    150|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 150, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1106|    150|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    150|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|    150|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    407|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    407|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 407, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    407|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    407|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    407|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    407|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    407|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    407|		return -1; \
  |  |  |  |  |  | 1090|    407|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    407|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 407]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    407|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    407|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    407|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    407|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    407|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 407]
  |  |  |  |  ------------------
  |  |  |  | 1117|    407|				return -1; \
  |  |  |  | 1118|    407|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    407|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    407|			break; \
  |  |  |  | 1120|    407|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    243|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 243, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1121|    243|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    243|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    243|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    243|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    243|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    243|		return -1; \
  |  |  |  |  |  | 1090|    243|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    243|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 243]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    243|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    243|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    243|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    243|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    243|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 243]
  |  |  |  |  ------------------
  |  |  |  | 1123|    243|				return -1; \
  |  |  |  | 1124|    243|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    243|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    243|			break; \
  |  |  |  | 1126|   411k|		} \
  |  |  |  | 1127|  2.72M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  2.72M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 2.72M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  2.72M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  15.7M|	} else { \
  |  | 1134|  15.7M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  15.7M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  15.7M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 2.81M, False: 12.9M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  15.7M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  2.81M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 2.81M, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  2.81M|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  2.81M|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 2.81M, False: 356]
  |  |  |  |  ------------------
  |  |  |  | 1097|  2.81M|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  2.81M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  2.81M|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|    192|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    192|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 192, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1109|    192|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    192|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|    192|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|				return -1; \
  |  |  |  | 1118|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			break; \
  |  |  |  | 1120|    164|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    164|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 164, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1121|    164|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    164|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    328|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 61, False: 103]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    164|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     61|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    225|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 61]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    164|		return -1; \
  |  |  |  |  |  | 1090|    164|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 164]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    164|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    164|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    164|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 164]
  |  |  |  |  ------------------
  |  |  |  | 1123|    164|				return -1; \
  |  |  |  | 1124|    164|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    164|			break; \
  |  |  |  | 1126|  2.81M|		} \
  |  |  |  | 1127|  15.7M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  15.7M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 15.7M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  15.7M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  15.7M|	}
  ------------------
 1155|  18.4M|	return 0;
 1156|  18.4M|}
softmagic.c:cvt_64:
 1160|  1.71M|{
 1161|  1.71M|	DO_CVT(m, q, 64);
  ------------------
  |  | 1131|  1.71M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  1.71M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 659k, False: 1.05M]
  |  |  ------------------
  |  | 1132|   659k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|   659k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|   659k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 199k, False: 460k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   659k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   199k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 199k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   198k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   198k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 198k, False: 37]
  |  |  |  |  ------------------
  |  |  |  | 1097|   198k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   198k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   198k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     37|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     37|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 37, False: 198k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     37|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     37|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     37|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|				return -1; \
  |  |  |  | 1118|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			break; \
  |  |  |  | 1120|      0|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|      0|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1121|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      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); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|      0|			break; \
  |  |  |  | 1126|   199k|		} \
  |  |  |  | 1127|   659k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|   659k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 659k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   659k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  1.05M|	} else { \
  |  | 1134|  1.05M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  1.05M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  1.05M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 1.07k, False: 1.05M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.05M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  1.07k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 1.07k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|     35|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|     35|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 35, False: 1.04k]
  |  |  |  |  ------------------
  |  |  |  | 1097|     35|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     35|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|     35|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 1.07k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 1.07k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 1.07k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 1.07k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 1.07k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    148|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    148|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 148, False: 931]
  |  |  |  |  ------------------
  |  |  |  | 1115|    148|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    148|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    148|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 148]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    148|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    148|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    148|		return -1; \
  |  |  |  |  |  | 1090|    148|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    148|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    296|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 3, False: 145]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    148|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      3|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    151|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    148|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    148|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    148|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  |  | 1117|    148|				return -1; \
  |  |  |  | 1118|    148|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    148|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    148|			break; \
  |  |  |  | 1120|    896|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    896|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 896, False: 183]
  |  |  |  |  ------------------
  |  |  |  | 1121|    896|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    896|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    896|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 896]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    896|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    896|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    896|		return -1; \
  |  |  |  |  |  | 1090|    896|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    896|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  1.79k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 896]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    896|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    896|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    896|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    896|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    896|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 896]
  |  |  |  |  ------------------
  |  |  |  | 1123|    896|				return -1; \
  |  |  |  | 1124|    896|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    896|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    896|			break; \
  |  |  |  | 1126|  1.07k|		} \
  |  |  |  | 1127|  1.05M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  1.05M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.05M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.05M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  1.05M|	}
  ------------------
 1162|  1.71M|	return 0;
 1163|  1.71M|}
softmagic.c:cvt_float:
 1186|  2.81k|{
 1187|  2.81k|	DO_CVT2(f, float);
  ------------------
  |  | 1166|  2.81k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  380|  2.81k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1166:6): [True: 0, False: 2.81k]
  |  |  ------------------
  |  | 1167|  2.81k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  352|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1167:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1168|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1168:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1169|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1170|      0|			break; \
  |  | 1171|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1171:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1172|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1173|      0|			break; \
  |  | 1174|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1174:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1175|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1176|      0|			break; \
  |  | 1177|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1177:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1178|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1178:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1179|      0|				return -1; \
  |  | 1180|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1181|      0|			break; \
  |  | 1182|      0|		} \
  ------------------
 1188|  2.81k|	return 0;
 1189|  2.81k|}
softmagic.c:cvt_double:
 1193|    638|{
 1194|    638|	DO_CVT2(d, double);
  ------------------
  |  | 1166|    638|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  380|    638|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1166:6): [True: 0, False: 638]
  |  |  ------------------
  |  | 1167|    638|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  352|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1167:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1168|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1168:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1169|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1170|      0|			break; \
  |  | 1171|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1171:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1172|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1173|      0|			break; \
  |  | 1174|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1174:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1175|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1176|      0|			break; \
  |  | 1177|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1177:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1178|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1178:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1179|      0|				return -1; \
  |  | 1180|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1181|      0|			break; \
  |  | 1182|      0|		} \
  ------------------
 1195|    638|	return 0;
 1196|    638|}
softmagic.c:magiccheck:
 2171|  85.6M|{
 2172|  85.6M|	uint64_t l = m->value.q;
 2173|  85.6M|	uint64_t v;
 2174|  85.6M|	float fl, fv;
 2175|  85.6M|	double dl, dv;
 2176|  85.6M|	int matched;
 2177|  85.6M|	union VALUETYPE *p = &ms->ms_value;
 2178|       |
 2179|  85.6M|	switch (m->type) {
 2180|  1.54M|	case FILE_BYTE:
  ------------------
  |  |  246|  1.54M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2180:2): [True: 1.54M, False: 84.1M]
  ------------------
 2181|  1.54M|		v = p->b;
 2182|  1.54M|		break;
 2183|       |
 2184|  1.56M|	case FILE_SHORT:
  ------------------
  |  |  247|  1.56M|#define				FILE_SHORT		2
  ------------------
  |  Branch (2184:2): [True: 1.56M, False: 84.0M]
  ------------------
 2185|  5.33M|	case FILE_BESHORT:
  ------------------
  |  |  252|  5.33M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2185:2): [True: 3.76M, False: 81.9M]
  ------------------
 2186|  9.01M|	case FILE_LESHORT:
  ------------------
  |  |  255|  9.01M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2186:2): [True: 3.67M, False: 81.9M]
  ------------------
 2187|  9.01M|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|  9.01M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (2187:2): [True: 0, False: 85.6M]
  ------------------
 2188|  9.01M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|  9.01M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (2188:2): [True: 219, False: 85.6M]
  ------------------
 2189|  9.01M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|  9.01M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (2189:2): [True: 0, False: 85.6M]
  ------------------
 2190|  9.01M|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|  9.01M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (2190:2): [True: 0, False: 85.6M]
  ------------------
 2191|  9.01M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|  9.01M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (2191:2): [True: 219, False: 85.6M]
  ------------------
 2192|  9.01M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|  9.01M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (2192:2): [True: 0, False: 85.6M]
  ------------------
 2193|  9.01M|		v = p->h;
 2194|  9.01M|		break;
 2195|       |
 2196|  1.37M|	case FILE_LONG:
  ------------------
  |  |  249|  1.37M|#define				FILE_LONG		4
  ------------------
  |  Branch (2196:2): [True: 1.37M, False: 84.2M]
  ------------------
 2197|  12.7M|	case FILE_BELONG:
  ------------------
  |  |  253|  12.7M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2197:2): [True: 11.3M, False: 74.3M]
  ------------------
 2198|  18.4M|	case FILE_LELONG:
  ------------------
  |  |  256|  18.4M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2198:2): [True: 5.72M, False: 79.9M]
  ------------------
 2199|  18.4M|	case FILE_MELONG:
  ------------------
  |  |  268|  18.4M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2199:2): [True: 30, False: 85.6M]
  ------------------
 2200|  18.4M|	case FILE_DATE:
  ------------------
  |  |  251|  18.4M|#define				FILE_DATE		6
  ------------------
  |  Branch (2200:2): [True: 0, False: 85.6M]
  ------------------
 2201|  18.4M|	case FILE_BEDATE:
  ------------------
  |  |  254|  18.4M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2201:2): [True: 313, False: 85.6M]
  ------------------
 2202|  18.4M|	case FILE_LEDATE:
  ------------------
  |  |  257|  18.4M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2202:2): [True: 297, False: 85.6M]
  ------------------
 2203|  18.4M|	case FILE_MEDATE:
  ------------------
  |  |  266|  18.4M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2203:2): [True: 36, False: 85.6M]
  ------------------
 2204|  18.4M|	case FILE_LDATE:
  ------------------
  |  |  259|  18.4M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2204:2): [True: 0, False: 85.6M]
  ------------------
 2205|  18.4M|	case FILE_BELDATE:
  ------------------
  |  |  260|  18.4M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2205:2): [True: 287, False: 85.6M]
  ------------------
 2206|  18.4M|	case FILE_LELDATE:
  ------------------
  |  |  261|  18.4M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2206:2): [True: 0, False: 85.6M]
  ------------------
 2207|  18.4M|	case FILE_MELDATE:
  ------------------
  |  |  267|  18.4M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2207:2): [True: 0, False: 85.6M]
  ------------------
 2208|  18.4M|		v = p->l;
 2209|  18.4M|		break;
 2210|       |
 2211|  59.5k|	case FILE_QUAD:
  ------------------
  |  |  269|  59.5k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2211:2): [True: 59.5k, False: 85.6M]
  ------------------
 2212|   792k|	case FILE_LEQUAD:
  ------------------
  |  |  270|   792k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2212:2): [True: 733k, False: 84.9M]
  ------------------
 2213|  1.70M|	case FILE_BEQUAD:
  ------------------
  |  |  271|  1.70M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2213:2): [True: 913k, False: 84.7M]
  ------------------
 2214|  1.70M|	case FILE_QDATE:
  ------------------
  |  |  272|  1.70M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2214:2): [True: 0, False: 85.6M]
  ------------------
 2215|  1.70M|	case FILE_BEQDATE:
  ------------------
  |  |  274|  1.70M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2215:2): [True: 434, False: 85.6M]
  ------------------
 2216|  1.70M|	case FILE_LEQDATE:
  ------------------
  |  |  273|  1.70M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2216:2): [True: 0, False: 85.6M]
  ------------------
 2217|  1.70M|	case FILE_QLDATE:
  ------------------
  |  |  275|  1.70M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2217:2): [True: 0, False: 85.6M]
  ------------------
 2218|  1.70M|	case FILE_BEQLDATE:
  ------------------
  |  |  277|  1.70M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2218:2): [True: 148, False: 85.6M]
  ------------------
 2219|  1.70M|	case FILE_LEQLDATE:
  ------------------
  |  |  276|  1.70M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2219:2): [True: 13, False: 85.6M]
  ------------------
 2220|  1.70M|	case FILE_QWDATE:
  ------------------
  |  |  287|  1.70M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2220:2): [True: 162, False: 85.6M]
  ------------------
 2221|  1.70M|	case FILE_BEQWDATE:
  ------------------
  |  |  289|  1.70M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2221:2): [True: 0, False: 85.6M]
  ------------------
 2222|  1.70M|	case FILE_LEQWDATE:
  ------------------
  |  |  288|  1.70M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2222:2): [True: 978, False: 85.6M]
  ------------------
 2223|  1.71M|	case FILE_OFFSET:
  ------------------
  |  |  297|  1.71M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (2223:2): [True: 6.80k, False: 85.6M]
  ------------------
 2224|  1.71M|		v = p->q;
 2225|  1.71M|		break;
 2226|       |
 2227|      0|	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2227:2): [True: 0, False: 85.6M]
  ------------------
 2228|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2228:2): [True: 0, False: 85.6M]
  ------------------
 2229|  2.81k|	case FILE_LEFLOAT:
  ------------------
  |  |  280|  2.81k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2229:2): [True: 2.81k, False: 85.6M]
  ------------------
 2230|  2.81k|		fl = m->value.f;
 2231|  2.81k|		fv = p->f;
 2232|  2.81k|		switch (m->reln) {
 2233|    402|		case 'x':
  ------------------
  |  Branch (2233:3): [True: 402, False: 2.41k]
  ------------------
 2234|    402|			matched = 1;
 2235|    402|			break;
 2236|       |
 2237|      0|		case '!':
  ------------------
  |  Branch (2237:3): [True: 0, False: 2.81k]
  ------------------
 2238|      0|			matched = isunordered(fl, fv) ? 1 : fv != fl;
  ------------------
  |  Branch (2238:14): [True: 0, False: 0]
  ------------------
 2239|      0|			break;
 2240|       |
 2241|      0|		case '=':
  ------------------
  |  Branch (2241:3): [True: 0, False: 2.81k]
  ------------------
 2242|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
  ------------------
  |  Branch (2242:14): [True: 0, False: 0]
  ------------------
 2243|      0|			break;
 2244|       |
 2245|  2.41k|		case '>':
  ------------------
  |  Branch (2245:3): [True: 2.41k, False: 402]
  ------------------
 2246|  2.41k|			matched = isgreater(fv, fl);
 2247|  2.41k|			break;
 2248|       |
 2249|      0|		case '<':
  ------------------
  |  Branch (2249:3): [True: 0, False: 2.81k]
  ------------------
 2250|      0|			matched = isless(fv, fl);
 2251|      0|			break;
 2252|       |
 2253|      0|		default:
  ------------------
  |  Branch (2253:3): [True: 0, False: 2.81k]
  ------------------
 2254|      0|			file_magerror(ms, "cannot happen with float: "
 2255|      0|			    "invalid relation `%c'", m->reln);
 2256|      0|			return -1;
 2257|  2.81k|		}
 2258|  2.81k|		return matched;
 2259|       |
 2260|      0|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2260:2): [True: 0, False: 85.6M]
  ------------------
 2261|    154|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|    154|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2261:2): [True: 154, False: 85.6M]
  ------------------
 2262|    638|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    638|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2262:2): [True: 484, False: 85.6M]
  ------------------
 2263|    638|		dl = m->value.d;
 2264|    638|		dv = p->d;
 2265|    638|		switch (m->reln) {
 2266|    370|		case 'x':
  ------------------
  |  Branch (2266:3): [True: 370, False: 268]
  ------------------
 2267|    370|			matched = 1;
 2268|    370|			break;
 2269|       |
 2270|      0|		case '!':
  ------------------
  |  Branch (2270:3): [True: 0, False: 638]
  ------------------
 2271|      0|			matched = isunordered(dv, dl) ? 1 : dv != dl;
  ------------------
  |  Branch (2271:14): [True: 0, False: 0]
  ------------------
 2272|      0|			break;
 2273|       |
 2274|    268|		case '=':
  ------------------
  |  Branch (2274:3): [True: 268, False: 370]
  ------------------
 2275|    268|			matched = isunordered(dv, dl) ? 0 : dv == dl;
  ------------------
  |  Branch (2275:14): [True: 110, False: 158]
  ------------------
 2276|    268|			break;
 2277|       |
 2278|      0|		case '>':
  ------------------
  |  Branch (2278:3): [True: 0, False: 638]
  ------------------
 2279|      0|			matched = isgreater(dv, dl);
 2280|      0|			break;
 2281|       |
 2282|      0|		case '<':
  ------------------
  |  Branch (2282:3): [True: 0, False: 638]
  ------------------
 2283|      0|			matched = isless(dv, dl);
 2284|      0|			break;
 2285|       |
 2286|      0|		default:
  ------------------
  |  Branch (2286:3): [True: 0, False: 638]
  ------------------
 2287|      0|			file_magerror(ms, "cannot happen with double: "
 2288|      0|			    "invalid relation `%c'", m->reln);
 2289|      0|			return -1;
 2290|    638|		}
 2291|    638|		return matched;
 2292|       |
 2293|  12.2k|	case FILE_DEFAULT:
  ------------------
  |  |  248|  12.2k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2293:2): [True: 12.2k, False: 85.6M]
  ------------------
 2294|  15.2k|	case FILE_CLEAR:
  ------------------
  |  |  292|  15.2k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2294:2): [True: 3.04k, False: 85.6M]
  ------------------
 2295|  15.2k|		l = 0;
 2296|  15.2k|		v = 0;
 2297|  15.2k|		break;
 2298|       |
 2299|  53.3M|	case FILE_STRING:
  ------------------
  |  |  250|  53.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (2299:2): [True: 53.3M, False: 32.3M]
  ------------------
 2300|  53.3M|	case FILE_PSTRING:
  ------------------
  |  |  258|  53.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2300:2): [True: 22.5k, False: 85.6M]
  ------------------
 2301|  53.3M|	case FILE_OCTAL:
  ------------------
  |  |  306|  53.3M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (2301:2): [True: 0, False: 85.6M]
  ------------------
 2302|  53.3M|		l = 0;
 2303|  53.3M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  452|  53.3M|#define CAST(T, b)	((T)(b))
  ------------------
 2304|  53.3M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  382|  53.3M|#define str_flags _u._s._flags
  ------------------
 2305|  53.3M|		break;
 2306|       |
 2307|    290|	case FILE_BESTRING16:
  ------------------
  |  |  263|    290|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2307:2): [True: 290, False: 85.6M]
  ------------------
 2308|  58.0k|	case FILE_LESTRING16:
  ------------------
  |  |  264|  58.0k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2308:2): [True: 57.7k, False: 85.6M]
  ------------------
 2309|  58.0k|		l = 0;
 2310|  58.0k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  452|  58.0k|#define CAST(T, b)	((T)(b))
  ------------------
 2311|  58.0k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  382|  58.0k|#define str_flags _u._s._flags
  ------------------
 2312|  58.0k|		break;
 2313|       |
 2314|   591k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  265|   591k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2314:2): [True: 591k, False: 85.0M]
  ------------------
 2315|   591k|		size_t slen;
 2316|   591k|		size_t idx;
 2317|       |
 2318|   591k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2318:7): [True: 0, False: 591k]
  ------------------
 2319|      0|			return 0;
 2320|       |
 2321|   591k|		slen = MIN(m->vallen, sizeof(m->value.s));
  ------------------
  |  Branch (2321:10): [True: 591k, False: 0]
  ------------------
 2322|   591k|		l = 0;
 2323|   591k|		v = 0;
 2324|   591k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   591k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2324:7): [True: 0, False: 591k]
  ------------------
 2325|      0|			size_t xlen = ms->search.s_len > 100 ? 100
  ------------------
  |  Branch (2325:18): [True: 0, False: 0]
  ------------------
 2326|      0|			    : ms->search.s_len;
 2327|       |
 2328|      0|			fprintf(stderr, "search: [");
 2329|      0|			file_showstr(stderr, ms->search.s, xlen);
 2330|      0|			fprintf(stderr, "%s] for [", ms->search.s_len == xlen
  ------------------
  |  Branch (2330:33): [True: 0, False: 0]
  ------------------
 2331|      0|			    ? "" : "...");
 2332|      0|			file_showstr(stderr, m->value.s, slen);
 2333|      0|		}
 2334|   591k|#ifdef HAVE_MEMMEM
 2335|   591k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  382|   591k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2335:7): [True: 591k, False: 0]
  |  Branch (2335:19): [True: 270k, False: 320k]
  ------------------
 2336|   270k|			const char *found;
 2337|   270k|			idx = m->str_range + slen;
  ------------------
  |  |  381|   270k|#define str_range _u._s._count
  ------------------
 2338|   270k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  381|   270k|#define str_range _u._s._count
  ------------------
  |  Branch (2338:8): [True: 3.32k, False: 267k]
  |  Branch (2338:29): [True: 95.2k, False: 171k]
  ------------------
 2339|  98.6k|				idx = ms->search.s_len;
 2340|   270k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  452|   270k|#define CAST(T, b)	((T)(b))
  ------------------
 2341|   270k|			    m->value.s, slen));
 2342|   270k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   270k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2342:8): [True: 0, False: 270k]
  ------------------
 2343|      0|				fprintf(stderr, "] %sfound\n",
 2344|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2344:9): [True: 0, False: 0]
  ------------------
 2345|      0|			}
 2346|   270k|			if (!found) {
  ------------------
  |  Branch (2346:8): [True: 268k, False: 2.10k]
  ------------------
 2347|   268k|				v = 1;
 2348|   268k|				break;
 2349|   268k|			}
 2350|  2.10k|			idx = found - ms->search.s;
 2351|  2.10k|			ms->search.offset += idx;
 2352|  2.10k|			ms->search.rm_len = ms->search.s_len - idx;
 2353|  2.10k|			break;
 2354|   270k|		}
 2355|   320k|#endif
 2356|       |
 2357|  4.28G|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  381|  4.28G|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  381|  4.28G|#define str_range _u._s._count
  ------------------
  |  Branch (2357:17): [True: 0, False: 4.28G]
  |  Branch (2357:38): [True: 4.27G, False: 186k]
  ------------------
 2358|  4.27G|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2358:8): [True: 133k, False: 4.27G]
  ------------------
 2359|   133k|				v = 1;
 2360|   133k|				break;
 2361|   133k|			}
 2362|       |
 2363|  4.27G|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2364|  4.27G|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  382|  4.27G|#define str_flags _u._s._flags
  ------------------
 2365|  4.27G|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2365:8): [True: 744, False: 4.27G]
  ------------------
 2366|    744|				ms->search.offset += idx;
 2367|    744|				ms->search.rm_len = ms->search.s_len - idx;
 2368|    744|				break;
 2369|    744|			}
 2370|  4.27G|		}
 2371|   320k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   320k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2371:7): [True: 0, False: 320k]
  ------------------
 2372|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2372:35): [True: 0, False: 0]
  ------------------
 2373|      0|		}
 2374|   320k|		break;
 2375|   591k|	}
 2376|   260k|	case FILE_REGEX: {
  ------------------
  |  |  262|   260k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2376:2): [True: 260k, False: 85.4M]
  ------------------
 2377|   260k|		int rc;
 2378|   260k|		file_regex_t *rx = *m_cache;
 2379|   260k|		const char *search;
 2380|   260k|		regmatch_t pmatch;
 2381|   260k|		size_t slen = ms->search.s_len;
 2382|   260k|		char *copy;
 2383|       |
 2384|   260k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2384:7): [True: 15, False: 260k]
  ------------------
 2385|     15|			return 0;
 2386|       |
 2387|   260k|		if (rx == NULL) {
  ------------------
  |  Branch (2387:7): [True: 156, False: 259k]
  ------------------
 2388|    156|			rx = *m_cache = alloc_regex(ms, m);
 2389|    156|			if (rx == NULL)
  ------------------
  |  Branch (2389:8): [True: 0, False: 156]
  ------------------
 2390|      0|				return -1;
 2391|    156|		}
 2392|   260k|		l = 0;
 2393|   260k|		if (slen != 0) {
  ------------------
  |  Branch (2393:7): [True: 258k, False: 1.86k]
  ------------------
 2394|   258k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  452|   258k|#define CAST(T, b)	((T)(b))
  ------------------
 2395|   258k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2395:11): [True: 0, False: 258k]
  ------------------
 2396|      0|			file_error(ms, errno,
 2397|      0|			    "can't allocate %" SIZE_T_FORMAT "u bytes",
 2398|      0|			    slen);
 2399|      0|			return -1;
 2400|      0|		    }
 2401|   258k|		    memcpy(copy, ms->search.s, slen);
 2402|   258k|		    copy[--slen] = '\0';
 2403|   258k|		    search = copy;
 2404|   258k|		} else {
 2405|  1.86k|		    search = CCAST(char *, "");
  ------------------
  |  |  454|  1.86k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2406|  1.86k|		    copy = NULL;
 2407|  1.86k|		}
 2408|   260k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  453|   260k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2409|   260k|		    1, &pmatch, 0);
 2410|   260k|		free(copy);
 2411|   260k|		switch (rc) {
 2412|  2.74k|		case 0:
  ------------------
  |  Branch (2412:3): [True: 2.74k, False: 257k]
  ------------------
 2413|  2.74k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  452|  2.74k|#define CAST(T, b)	((T)(b))
  ------------------
 2414|  2.74k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  452|  2.74k|#define CAST(T, b)	((T)(b))
  ------------------
 2415|  2.74k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  452|  2.74k|#define CAST(T, b)	((T)(b))
  ------------------
 2416|  2.74k|			    pmatch.rm_eo - pmatch.rm_so);
 2417|  2.74k|			v = 0;
 2418|  2.74k|			break;
 2419|       |
 2420|   257k|		case REG_NOMATCH:
  ------------------
  |  Branch (2420:3): [True: 257k, False: 2.74k]
  ------------------
 2421|   257k|			v = 1;
 2422|   257k|			break;
 2423|       |
 2424|      0|		default:
  ------------------
  |  Branch (2424:3): [True: 0, False: 260k]
  ------------------
 2425|      0|			return -1;
 2426|   260k|		}
 2427|   260k|		break;
 2428|   260k|	}
 2429|   260k|	case FILE_USE:
  ------------------
  |  |  291|  56.4k|#define				FILE_USE		46
  ------------------
  |  Branch (2429:2): [True: 56.4k, False: 85.6M]
  ------------------
 2430|  56.4k|		return ms->ms_value.q != 0;
 2431|  60.9k|	case FILE_NAME:
  ------------------
  |  |  290|  60.9k|#define				FILE_NAME		45
  ------------------
  |  Branch (2431:2): [True: 60.9k, False: 85.6M]
  ------------------
 2432|  73.1k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  73.1k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2432:2): [True: 12.2k, False: 85.6M]
  ------------------
 2433|  73.1k|		return 1;
 2434|   371k|	case FILE_DER:
  ------------------
  |  |  293|   371k|#define				FILE_DER		48
  ------------------
  |  Branch (2434:2): [True: 371k, False: 85.2M]
  ------------------
 2435|   371k|		matched = der_cmp(ms, m);
 2436|   371k|		if (matched == -1) {
  ------------------
  |  Branch (2436:7): [True: 130k, False: 240k]
  ------------------
 2437|   130k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   130k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2437:8): [True: 0, False: 130k]
  ------------------
 2438|      0|				(void) fprintf(stderr,
 2439|      0|				    "EOF comparing DER entries\n");
 2440|      0|			}
 2441|   130k|			return 0;
 2442|   130k|		}
 2443|   240k|		return matched;
 2444|     18|	case FILE_BEGUID:
  ------------------
  |  |  296|     18|#define				FILE_BEGUID		51
  ------------------
  |  Branch (2444:2): [True: 18, False: 85.6M]
  ------------------
 2445|     18|	case FILE_LEGUID:
  ------------------
  |  |  295|     18|#define				FILE_LEGUID		50
  ------------------
  |  Branch (2445:2): [True: 0, False: 85.6M]
  ------------------
 2446|   168k|	case FILE_GUID:
  ------------------
  |  |  294|   168k|#define				FILE_GUID		49
  ------------------
  |  Branch (2446:2): [True: 168k, False: 85.4M]
  ------------------
 2447|   168k|		l = 0;
 2448|   168k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2449|   168k|		break;
 2450|      0|	default:
  ------------------
  |  Branch (2450:2): [True: 0, False: 85.6M]
  ------------------
 2451|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2452|      0|		return -1;
 2453|  85.6M|	}
 2454|       |
 2455|  85.1M|	v = file_signextend(ms, m, v);
 2456|       |
 2457|  85.1M|	switch (m->reln) {
 2458|  90.8k|	case 'x':
  ------------------
  |  Branch (2458:2): [True: 90.8k, False: 85.0M]
  ------------------
 2459|  90.8k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  90.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2459:7): [True: 0, False: 90.8k]
  ------------------
 2460|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT
 2461|      0|			    "u == *any* = 1", CAST(unsigned long long, v));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2462|  90.8k|		matched = 1;
 2463|  90.8k|		break;
 2464|       |
 2465|  62.3k|	case '!':
  ------------------
  |  Branch (2465:2): [True: 62.3k, False: 85.0M]
  ------------------
 2466|  62.3k|		matched = v != l;
 2467|  62.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  62.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2467:7): [True: 0, False: 62.3k]
  ------------------
 2468|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u != %"
 2469|      0|			    INT64_T_FORMAT "u = %d",
 2470|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2471|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2472|  62.3k|		break;
 2473|       |
 2474|  84.4M|	case '=':
  ------------------
  |  Branch (2474:2): [True: 84.4M, False: 714k]
  ------------------
 2475|  84.4M|		matched = v == l;
 2476|  84.4M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  84.4M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2476:7): [True: 0, False: 84.4M]
  ------------------
 2477|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u == %"
 2478|      0|			    INT64_T_FORMAT "u = %d",
 2479|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2480|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2481|  84.4M|		break;
 2482|       |
 2483|   235k|	case '>':
  ------------------
  |  Branch (2483:2): [True: 235k, False: 84.9M]
  ------------------
 2484|   235k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  229|   235k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2484:7): [True: 167k, False: 67.4k]
  ------------------
 2485|   167k|			matched = v > l;
 2486|   167k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   167k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2486:8): [True: 0, False: 167k]
  ------------------
 2487|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2488|      0|				    "u > %" INT64_T_FORMAT "u = %d",
 2489|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2490|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2491|   167k|		}
 2492|  67.4k|		else {
 2493|  67.4k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  452|  67.4k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  452|  67.4k|#define CAST(T, b)	((T)(b))
  ------------------
 2494|  67.4k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  67.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2494:8): [True: 0, False: 67.4k]
  ------------------
 2495|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2496|      0|				    "d > %" INT64_T_FORMAT "d = %d",
 2497|      0|				    CAST(long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2498|      0|				    CAST(long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2499|  67.4k|		}
 2500|   235k|		break;
 2501|       |
 2502|   292k|	case '<':
  ------------------
  |  Branch (2502:2): [True: 292k, False: 84.8M]
  ------------------
 2503|   292k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  229|   292k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2503:7): [True: 248k, False: 44.1k]
  ------------------
 2504|   248k|			matched = v < l;
 2505|   248k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   248k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2505:8): [True: 0, False: 248k]
  ------------------
 2506|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2507|      0|				    "u < %" INT64_T_FORMAT "u = %d",
 2508|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2509|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2510|   248k|		}
 2511|  44.1k|		else {
 2512|  44.1k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  452|  44.1k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  452|  44.1k|#define CAST(T, b)	((T)(b))
  ------------------
 2513|  44.1k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  44.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2513:8): [True: 0, False: 44.1k]
  ------------------
 2514|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2515|      0|				    "d < %" INT64_T_FORMAT "d = %d",
 2516|      0|				     CAST(long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2517|      0|				     CAST(long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2518|  44.1k|		}
 2519|   292k|		break;
 2520|       |
 2521|  32.1k|	case '&':
  ------------------
  |  Branch (2521:2): [True: 32.1k, False: 85.1M]
  ------------------
 2522|  32.1k|		matched = (v & l) == l;
 2523|  32.1k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  32.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2523:7): [True: 0, False: 32.1k]
  ------------------
 2524|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2525|      0|			    INT64_T_FORMAT "x) == %" INT64_T_FORMAT
 2526|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2527|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2528|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2529|      0|			    matched);
 2530|  32.1k|		break;
 2531|       |
 2532|  1.02k|	case '^':
  ------------------
  |  Branch (2532:2): [True: 1.02k, False: 85.1M]
  ------------------
 2533|  1.02k|		matched = (v & l) != l;
 2534|  1.02k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.02k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2534:7): [True: 0, False: 1.02k]
  ------------------
 2535|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2536|      0|			    INT64_T_FORMAT "x) != %" INT64_T_FORMAT
 2537|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2538|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2539|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2540|  1.02k|		break;
 2541|       |
 2542|      0|	default:
  ------------------
  |  Branch (2542:2): [True: 0, False: 85.1M]
  ------------------
 2543|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2544|      0|		    m->reln);
 2545|      0|		return -1;
 2546|  85.1M|	}
 2547|  85.1M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  85.1M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2547:6): [True: 0, False: 85.1M]
  ------------------
 2548|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2549|      0|		    file_magic_strength(m, 1));
 2550|      0|	}
 2551|       |
 2552|  85.1M|	return matched;
 2553|  85.1M|}
softmagic.c:file_strncmp:
 2061|  4.33G|{
 2062|       |	/*
 2063|       |	 * Convert the source args to unsigned here so that (1) the
 2064|       |	 * compare will be unsigned as it is in strncmp() and (2) so
 2065|       |	 * the ctype functions will work correctly without extra
 2066|       |	 * casting.
 2067|       |	 */
 2068|  4.33G|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  453|  4.33G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2069|  4.33G|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  453|  4.33G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2070|  4.33G|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  396|  4.33G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  395|  4.33G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2071|  4.33G|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  397|  4.33G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  395|  4.33G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2072|  4.33G|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (2072:33): [True: 36.5M, False: 4.29G]
  ------------------
 2073|  4.33G|	uint64_t v;
 2074|       |
 2075|       |	/*
 2076|       |	 * What we want here is v = strncmp(s1, s2, len),
 2077|       |	 * but ignoring any nulls.
 2078|       |	 */
 2079|  4.33G|	v = 0;
 2080|  4.33G|	len++;
 2081|  4.33G|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2081:6): [True: 50.6M, False: 4.28G]
  ------------------
 2082|  51.3M|		while (--len > 0)
  ------------------
  |  Branch (2082:10): [True: 51.3M, False: 40.9k]
  ------------------
 2083|  51.3M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2083:8): [True: 50.5M, False: 787k]
  ------------------
 2084|  50.5M|				break;
 2085|  50.6M|	}
 2086|  4.28G|	else { /* combine the others */
 2087|  4.28G|		while (--len > 0) {
  ------------------
  |  Branch (2087:10): [True: 4.28G, False: 30.0k]
  ------------------
 2088|  4.28G|			if (b >= eb) {
  ------------------
  |  Branch (2088:8): [True: 214k, False: 4.28G]
  ------------------
 2089|   214k|				v = 1;
 2090|   214k|				break;
 2091|   214k|			}
 2092|  4.28G|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  398|  4.28G|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  395|  4.28G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2092:8): [True: 37.2M, False: 4.24G]
  ------------------
 2093|  4.28G|			    islower(*a)) {
  ------------------
  |  Branch (2093:8): [True: 2.90M, False: 34.3M]
  ------------------
 2094|  2.90M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2094:9): [True: 2.87M, False: 32.1k]
  |  Branch (2094:14): [True: 0, False: 0]
  |  Branch (2094:14): [Folded, False: 0]
  |  Branch (2094:14): [Folded, False: 2.90M]
  ------------------
 2095|  2.87M|					break;
 2096|  2.90M|			}
 2097|  4.28G|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  399|  4.28G|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  395|  4.28G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2097:13): [True: 29.7k, False: 4.28G]
  ------------------
 2098|  4.28G|			    isupper(*a)) {
  ------------------
  |  Branch (2098:8): [True: 11.1k, False: 18.5k]
  ------------------
 2099|  11.1k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2099:9): [True: 11.0k, False: 159]
  |  Branch (2099:14): [True: 0, False: 0]
  |  Branch (2099:14): [Folded, False: 0]
  |  Branch (2099:14): [Folded, False: 11.1k]
  ------------------
 2100|  11.0k|					break;
 2101|  11.1k|			}
 2102|  4.28G|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  396|  4.28G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  395|  4.28G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2102:13): [True: 28.4M, False: 4.25G]
  ------------------
 2103|  4.28G|			    isspace(*a)) {
  ------------------
  |  Branch (2103:8): [True: 956k, False: 27.4M]
  ------------------
 2104|   956k|				a++;
 2105|   956k|				if (isspace(*b)) {
  ------------------
  |  Branch (2105:9): [True: 223k, False: 732k]
  ------------------
 2106|   223k|					b++;
 2107|   223k|					if (!isspace(*a))
  ------------------
  |  Branch (2107:10): [True: 223k, False: 0]
  ------------------
 2108|  8.86G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2108:14): [True: 8.86G, False: 214k]
  |  Branch (2108:24): [True: 8.86G, False: 8.60k]
  ------------------
 2109|  8.86G|							b++;
 2110|   223k|				}
 2111|   732k|				else {
 2112|   732k|					v = 1;
 2113|   732k|					break;
 2114|   732k|				}
 2115|   956k|			}
 2116|  4.27G|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  397|  4.27G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  395|  4.27G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2116:13): [True: 8.18M, False: 4.27G]
  ------------------
 2117|  4.27G|			    isspace(*a)) {
  ------------------
  |  Branch (2117:8): [True: 2.04k, False: 8.18M]
  ------------------
 2118|  2.04k|				a++;
 2119|  8.37k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2119:12): [True: 8.31k, False: 60]
  |  Branch (2119:22): [True: 6.32k, False: 1.98k]
  ------------------
 2120|  6.32k|					b++;
 2121|  2.04k|			}
 2122|  4.27G|			else {
 2123|  4.27G|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2123:9): [True: 4.27G, False: 575k]
  ------------------
 2124|  4.27G|					break;
 2125|  4.27G|			}
 2126|  4.28G|		}
 2127|  4.28G|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  414|  30.0k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  395|  30.0k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2127:7): [True: 30.0k, False: 4.28G]
  |  Branch (2127:19): [True: 30.0k, False: 0]
  |  Branch (2127:29): [True: 98, False: 29.9k]
  ------------------
 2128|     98|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2128:8): [True: 64, False: 34]
  |  Branch (2128:14): [True: 32, False: 32]
  ------------------
 2129|     32|				v = 1;
 2130|     98|		}
 2131|  4.28G|	}
 2132|  4.33G|	return v;
 2133|  4.33G|}
softmagic.c:file_strncmp16:
 2138|  58.0k|{
 2139|       |	/*
 2140|       |	 * XXX - The 16-bit string compare probably needs to be done
 2141|       |	 * differently, especially if the flags are to be supported.
 2142|       |	 * At the moment, I am unsure.
 2143|       |	 */
 2144|  58.0k|	flags = 0;
 2145|  58.0k|	return file_strncmp(a, b, len, maxlen, flags);
 2146|  58.0k|}
softmagic.c:alloc_regex:
 2150|    156|{
 2151|    156|	int rc;
 2152|    156|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  452|    156|#define CAST(T, b)	((T)(b))
  ------------------
 2153|       |
 2154|    156|	if (rx == NULL) {
  ------------------
  |  Branch (2154:6): [True: 0, False: 156]
  ------------------
 2155|      0|		file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT
 2156|      0|		    "u bytes", sizeof(*rx));
 2157|      0|		return NULL;
 2158|      0|	}
 2159|       |
 2160|    156|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2161|    156|	    REGEX_ICASE(m));
  ------------------
  |  |  432|    156|#define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  382|    156|#define str_flags _u._s._flags
  |  |  ------------------
  |  |               #define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  431|    156|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  398|    156|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  395|    156|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    156|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  395|    156|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (432:25): [True: 19, False: 137]
  |  |  ------------------
  ------------------
 2162|    156|	if (rc == 0)
  ------------------
  |  Branch (2162:6): [True: 156, False: 0]
  ------------------
 2163|    156|		return rx;
 2164|       |
 2165|      0|	free(rx);
 2166|       |	return NULL;
 2167|    156|}
softmagic.c:handle_annotation:
 2557|   743k|{
 2558|   743k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   743k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2558:6): [True: 0, False: 743k]
  |  Branch (2558:35): [True: 0, False: 0]
  ------------------
 2559|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2559:7): [True: 0, False: 0]
  |  Branch (2559:21): [True: 0, False: 0]
  ------------------
 2560|      0|			return 1;
 2561|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2561:7): [True: 0, False: 0]
  ------------------
 2562|      0|			return -1;
 2563|      0|		if (file_printf(ms, "%.8s", m->apple) == -1)
  ------------------
  |  Branch (2563:7): [True: 0, False: 0]
  ------------------
 2564|      0|			return -1;
 2565|      0|		return 1;
 2566|      0|	}
 2567|   743k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   743k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2567:6): [True: 0, False: 743k]
  |  Branch (2567:39): [True: 0, False: 0]
  ------------------
 2568|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2568:7): [True: 0, False: 0]
  |  Branch (2568:21): [True: 0, False: 0]
  ------------------
 2569|      0|			return 1;
 2570|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2570:7): [True: 0, False: 0]
  ------------------
 2571|      0|			return -1;
 2572|      0|		if (file_printf(ms, "%s", m->ext) == -1)
  ------------------
  |  Branch (2572:7): [True: 0, False: 0]
  ------------------
 2573|      0|			return -1;
 2574|      0|		return 1;
 2575|      0|	}
 2576|   743k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   743k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2576:6): [True: 0, False: 743k]
  |  Branch (2576:39): [True: 0, False: 0]
  ------------------
 2577|      0|		char buf[1024];
 2578|      0|		const char *p;
 2579|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2579:7): [True: 0, False: 0]
  |  Branch (2579:21): [True: 0, False: 0]
  ------------------
 2580|      0|			return 1;
 2581|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2581:7): [True: 0, False: 0]
  ------------------
 2582|      0|			return -1;
 2583|      0|		if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
  ------------------
  |  Branch (2583:7): [True: 0, False: 0]
  ------------------
 2584|      0|			p = m->mimetype;
 2585|      0|		else
 2586|      0|			p = buf;
 2587|      0|		if (file_printf(ms, "%s", p) == -1)
  ------------------
  |  Branch (2587:7): [True: 0, False: 0]
  ------------------
 2588|      0|			return -1;
 2589|      0|		return 1;
 2590|      0|	}
 2591|   743k|	return 0;
 2592|   743k|}
softmagic.c:varexpand:
  549|   135k|{
  550|   135k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  551|   135k|	size_t l;
  552|       |
  553|   136k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (553:19): [True: 403, False: 135k]
  ------------------
  554|    403|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  452|    403|#define CAST(T, b)	((T)(b))
  ------------------
  555|    403|		if (l >= len)
  ------------------
  |  Branch (555:7): [True: 0, False: 403]
  ------------------
  556|      0|			return -1;
  557|    403|		memcpy(buf, sptr, l);
  558|    403|		buf += l;
  559|    403|		len -= l;
  560|    403|		ptr += 2;
  561|    403|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (561:7): [True: 0, False: 403]
  |  Branch (561:16): [True: 0, False: 403]
  ------------------
  562|      0|			return -1;
  563|  6.04k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (563:26): [True: 6.04k, False: 0]
  |  Branch (563:33): [True: 5.64k, False: 403]
  ------------------
  564|  5.64k|			continue;
  565|    403|		if (*et != ':')
  ------------------
  |  Branch (565:7): [True: 0, False: 403]
  ------------------
  566|      0|			return -1;
  567|  5.64k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (567:25): [True: 5.64k, False: 0]
  |  Branch (567:32): [True: 5.23k, False: 403]
  ------------------
  568|  5.23k|			continue;
  569|    403|		if (*ee != '}')
  ------------------
  |  Branch (569:7): [True: 0, False: 403]
  ------------------
  570|      0|			return -1;
  571|    403|		switch (*ptr) {
  572|    403|		case 'x':
  ------------------
  |  Branch (572:3): [True: 403, False: 0]
  ------------------
  573|    403|			if (ms->mode & 0111) {
  ------------------
  |  Branch (573:8): [True: 0, False: 403]
  ------------------
  574|      0|				ptr = t;
  575|      0|				l = et - t;
  576|    403|			} else {
  577|    403|				ptr = e;
  578|    403|				l = ee - e;
  579|    403|			}
  580|    403|			break;
  581|      0|		default:
  ------------------
  |  Branch (581:3): [True: 0, False: 403]
  ------------------
  582|      0|			return -1;
  583|    403|		}
  584|    403|		if (l >= len)
  ------------------
  |  Branch (584:7): [True: 0, False: 403]
  ------------------
  585|      0|			return -1;
  586|    403|		memcpy(buf, ptr, l);
  587|    403|		buf += l;
  588|    403|		len -= l;
  589|    403|		sptr = ee + 1;
  590|    403|	}
  591|       |
  592|   135k|	l = strlen(sptr);
  593|   135k|	if (l >= len)
  ------------------
  |  Branch (593:6): [True: 0, False: 135k]
  ------------------
  594|      0|		return -1;
  595|       |
  596|   135k|	memcpy(buf, sptr, l);
  597|   135k|	buf[l] = '\0';
  598|   135k|	return 0;
  599|   135k|}
softmagic.c:print_sep:
 2596|  49.5k|{
 2597|  49.5k|	if (firstline)
  ------------------
  |  Branch (2597:6): [True: 11.7k, False: 37.8k]
  ------------------
 2598|  11.7k|		return 0;
 2599|       |	/*
 2600|       |	 * we found another match
 2601|       |	 * put a newline and '-' to do some simple formatting
 2602|       |	 */
 2603|  37.8k|	return file_separator(ms);
 2604|  49.5k|}
softmagic.c:mprint:
  604|   135k|{
  605|   135k|	uint64_t v;
  606|   135k|	float vf;
  607|   135k|	double vd;
  608|   135k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  609|   135k|	const char *desc;
  610|   135k|	union VALUETYPE *p = &ms->ms_value;
  611|       |
  612|   135k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (612:6): [True: 0, False: 135k]
  ------------------
  613|      0|		desc = m->desc;
  614|   135k|	else
  615|   135k|		desc = ebuf;
  616|       |
  617|   135k|#define	PRINTER(value, format, stype, utype)	\
  618|   135k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  619|   135k|	switch (check_fmt(ms, desc)) { \
  620|   135k|	case -1: \
  621|   135k|		return -1; \
  622|   135k|	case 1: \
  623|   135k|		if (m->flag & UNSIGNED) { \
  624|   135k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  625|   135k|			    CAST(utype, v)); \
  626|   135k|		} else { \
  627|   135k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  628|   135k|			    CAST(stype, v)); \
  629|   135k|		} \
  630|   135k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  631|   135k|			return -1; \
  632|   135k|		break; \
  633|   135k|	default: \
  634|   135k|		if (m->flag & UNSIGNED) { \
  635|   135k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  636|   135k|			   CAST(utype, v)) == -1) \
  637|   135k|			   return -1; \
  638|   135k|		} else { \
  639|   135k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  640|   135k|			   CAST(stype, v)) == -1) \
  641|   135k|			   return -1; \
  642|   135k|		} \
  643|   135k|		break; \
  644|   135k|	} \
  645|   135k|	break
  646|       |
  647|   135k|  	switch (m->type) {
  648|  18.7k|  	case FILE_BYTE:
  ------------------
  |  |  246|  18.7k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (648:4): [True: 18.7k, False: 117k]
  ------------------
  649|  18.7k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  618|  18.7k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  18.7k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 18.7k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 18.7k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  18.7k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 18.7k, False: 0]
  |  |  ------------------
  |  |  634|  18.7k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  18.7k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 7.70k, False: 11.0k]
  |  |  ------------------
  |  |  635|  7.70k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  7.70k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 7.70k]
  |  |  ------------------
  |  |  636|  7.70k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  7.70k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  7.70k|			   return -1; \
  |  |  638|  11.0k|		} else { \
  |  |  639|  11.0k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  11.0k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 11.0k]
  |  |  ------------------
  |  |  640|  11.0k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  11.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  11.0k|			   return -1; \
  |  |  642|  11.0k|		} \
  |  |  643|  18.7k|		break; \
  |  |  644|  18.7k|	} \
  |  |  645|  18.7k|	break
  ------------------
  650|       |
  651|  18.7k|  	case FILE_SHORT:
  ------------------
  |  |  247|  1.75k|#define				FILE_SHORT		2
  ------------------
  |  Branch (651:4): [True: 1.75k, False: 134k]
  ------------------
  652|  10.3k|  	case FILE_BESHORT:
  ------------------
  |  |  252|  10.3k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (652:4): [True: 8.62k, False: 127k]
  ------------------
  653|  24.5k|  	case FILE_LESHORT:
  ------------------
  |  |  255|  24.5k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (653:4): [True: 14.1k, False: 121k]
  ------------------
  654|  24.5k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  618|  24.5k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  24.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  24.5k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 24.5k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 24.5k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  24.5k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 24.5k, False: 0]
  |  |  ------------------
  |  |  634|  24.5k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  24.5k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 14.3k, False: 10.1k]
  |  |  ------------------
  |  |  635|  14.3k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  14.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 14.3k]
  |  |  ------------------
  |  |  636|  14.3k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  14.3k|			   return -1; \
  |  |  638|  14.3k|		} else { \
  |  |  639|  10.1k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  10.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 10.1k]
  |  |  ------------------
  |  |  640|  10.1k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  10.1k|			   return -1; \
  |  |  642|  10.1k|		} \
  |  |  643|  24.5k|		break; \
  |  |  644|  24.5k|	} \
  |  |  645|  24.5k|	break
  ------------------
  655|       |
  656|  24.5k|  	case FILE_LONG:
  ------------------
  |  |  249|    328|#define				FILE_LONG		4
  ------------------
  |  Branch (656:4): [True: 328, False: 135k]
  ------------------
  657|  24.7k|  	case FILE_BELONG:
  ------------------
  |  |  253|  24.7k|#define				FILE_BELONG		8
  ------------------
  |  Branch (657:4): [True: 24.4k, False: 111k]
  ------------------
  658|  33.1k|  	case FILE_LELONG:
  ------------------
  |  |  256|  33.1k|#define				FILE_LELONG		11
  ------------------
  |  Branch (658:4): [True: 8.41k, False: 127k]
  ------------------
  659|  33.2k|  	case FILE_MELONG:
  ------------------
  |  |  268|  33.2k|#define				FILE_MELONG		23
  ------------------
  |  Branch (659:4): [True: 30, False: 135k]
  ------------------
  660|  33.2k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  618|  33.2k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  33.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  33.2k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 33.2k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 33.2k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  33.2k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 33.2k, False: 0]
  |  |  ------------------
  |  |  634|  33.2k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  33.2k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 7.71k, False: 25.5k]
  |  |  ------------------
  |  |  635|  7.71k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  7.71k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 7.71k]
  |  |  ------------------
  |  |  636|  7.71k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  7.71k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  7.71k|			   return -1; \
  |  |  638|  25.5k|		} else { \
  |  |  639|  25.5k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  25.5k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 25.5k]
  |  |  ------------------
  |  |  640|  25.5k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  25.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  25.5k|			   return -1; \
  |  |  642|  25.5k|		} \
  |  |  643|  33.2k|		break; \
  |  |  644|  33.2k|	} \
  |  |  645|  33.2k|	break
  ------------------
  661|       |
  662|  33.2k|  	case FILE_QUAD:
  ------------------
  |  |  269|    264|#define				FILE_QUAD		24
  ------------------
  |  Branch (662:4): [True: 264, False: 135k]
  ------------------
  663|  1.19k|  	case FILE_BEQUAD:
  ------------------
  |  |  271|  1.19k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (663:4): [True: 933, False: 134k]
  ------------------
  664|  1.35k|  	case FILE_LEQUAD:
  ------------------
  |  |  270|  1.35k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (664:4): [True: 153, False: 135k]
  ------------------
  665|  2.14k|	case FILE_OFFSET:
  ------------------
  |  |  297|  2.14k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (665:2): [True: 796, False: 135k]
  ------------------
  666|  2.14k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  618|  2.14k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  2.14k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  2.14k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 2.14k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 2.14k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  2.14k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 2.14k, False: 0]
  |  |  ------------------
  |  |  634|  2.14k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  2.14k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 983, False: 1.16k]
  |  |  ------------------
  |  |  635|    983|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|    983|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 983]
  |  |  ------------------
  |  |  636|    983|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|    983|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|    983|			   return -1; \
  |  |  638|  1.16k|		} else { \
  |  |  639|  1.16k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  1.16k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 1.16k]
  |  |  ------------------
  |  |  640|  1.16k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  1.16k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  1.16k|			   return -1; \
  |  |  642|  1.16k|		} \
  |  |  643|  2.14k|		break; \
  |  |  644|  2.14k|	} \
  |  |  645|  2.14k|	break
  ------------------
  667|       |
  668|  35.6k|  	case FILE_STRING:
  ------------------
  |  |  250|  35.6k|#define				FILE_STRING		5
  ------------------
  |  Branch (668:4): [True: 35.6k, False: 100k]
  ------------------
  669|  36.7k|  	case FILE_PSTRING:
  ------------------
  |  |  258|  36.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (669:4): [True: 1.11k, False: 134k]
  ------------------
  670|  37.0k|  	case FILE_BESTRING16:
  ------------------
  |  |  263|  37.0k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (670:4): [True: 290, False: 135k]
  ------------------
  671|  37.6k|  	case FILE_LESTRING16:
  ------------------
  |  |  264|  37.6k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (671:4): [True: 538, False: 135k]
  ------------------
  672|  37.6k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (672:7): [True: 19.4k, False: 18.1k]
  |  Branch (672:25): [True: 338, False: 17.7k]
  ------------------
  673|  19.8k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  19.8k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (673:8): [True: 0, False: 19.8k]
  ------------------
  674|  19.8k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  675|  19.8k|			    sizeof(m->value.s))) == -1)
  676|      0|				return -1;
  677|  19.8k|		}
  678|  17.7k|		else {
  679|  17.7k|			char *str = p->s;
  680|       |
  681|       |			/* compute t before we mangle the string? */
  682|       |
  683|  17.7k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (683:8): [True: 17.6k, False: 116]
  ------------------
  684|  17.6k|				str[strcspn(str, "\r\n")] = '\0';
  685|       |
  686|  17.7k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  382|  17.7k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  413|  17.7k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  395|  17.7k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (686:8): [True: 358, False: 17.4k]
  ------------------
  687|    358|				str = file_strtrim(str);
  688|       |
  689|  17.7k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  17.7k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (689:8): [True: 0, False: 17.7k]
  ------------------
  690|  17.7k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  691|  17.7k|				sizeof(p->s) - (str - p->s))) == -1)
  692|      0|				return -1;
  693|       |
  694|  17.7k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  258|  17.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (694:8): [True: 1.11k, False: 16.6k]
  ------------------
  695|  1.11k|				size_t l = file_pstring_length_size(ms, m);
  696|  1.11k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.11k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  1.11k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (696:9): [True: 0, False: 1.11k]
  ------------------
  697|      0|					return -1;
  698|  1.11k|			}
  699|  17.7k|		}
  700|  37.6k|		break;
  701|       |
  702|  37.6k|	case FILE_DATE:
  ------------------
  |  |  251|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (702:2): [True: 0, False: 135k]
  ------------------
  703|    228|	case FILE_BEDATE:
  ------------------
  |  |  254|    228|#define				FILE_BEDATE		9
  ------------------
  |  Branch (703:2): [True: 228, False: 135k]
  ------------------
  704|    405|	case FILE_LEDATE:
  ------------------
  |  |  257|    405|#define				FILE_LEDATE		12
  ------------------
  |  Branch (704:2): [True: 177, False: 135k]
  ------------------
  705|    441|	case FILE_MEDATE:
  ------------------
  |  |  266|    441|#define				FILE_MEDATE		21
  ------------------
  |  Branch (705:2): [True: 36, False: 135k]
  ------------------
  706|    441|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    441|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (706:7): [True: 0, False: 441]
  ------------------
  707|    441|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  708|      0|			return -1;
  709|    441|		break;
  710|       |
  711|    441|	case FILE_LDATE:
  ------------------
  |  |  259|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (711:2): [True: 0, False: 135k]
  ------------------
  712|    287|	case FILE_BELDATE:
  ------------------
  |  |  260|    287|#define				FILE_BELDATE		15
  ------------------
  |  Branch (712:2): [True: 287, False: 135k]
  ------------------
  713|    287|	case FILE_LELDATE:
  ------------------
  |  |  261|    287|#define				FILE_LELDATE		16
  ------------------
  |  Branch (713:2): [True: 0, False: 135k]
  ------------------
  714|    287|	case FILE_MELDATE:
  ------------------
  |  |  267|    287|#define				FILE_MELDATE		22
  ------------------
  |  Branch (714:2): [True: 0, False: 135k]
  ------------------
  715|    287|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    287|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (715:7): [True: 0, False: 287]
  ------------------
  716|    287|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  540|    287|#define FILE_T_LOCAL	1
  ------------------
  717|    287|			== -1)
  718|      0|			return -1;
  719|    287|		break;
  720|       |
  721|    287|	case FILE_QDATE:
  ------------------
  |  |  272|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (721:2): [True: 0, False: 135k]
  ------------------
  722|    434|	case FILE_BEQDATE:
  ------------------
  |  |  274|    434|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (722:2): [True: 434, False: 135k]
  ------------------
  723|    434|	case FILE_LEQDATE:
  ------------------
  |  |  273|    434|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (723:2): [True: 0, False: 135k]
  ------------------
  724|    434|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    434|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (724:7): [True: 0, False: 434]
  ------------------
  725|    434|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  726|      0|			return -1;
  727|    434|		break;
  728|       |
  729|    434|	case FILE_QLDATE:
  ------------------
  |  |  275|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (729:2): [True: 0, False: 135k]
  ------------------
  730|    148|	case FILE_BEQLDATE:
  ------------------
  |  |  277|    148|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (730:2): [True: 148, False: 135k]
  ------------------
  731|    161|	case FILE_LEQLDATE:
  ------------------
  |  |  276|    161|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (731:2): [True: 13, False: 135k]
  ------------------
  732|    161|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    161|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (732:7): [True: 0, False: 161]
  ------------------
  733|    161|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  540|    161|#define FILE_T_LOCAL	1
  ------------------
  734|      0|			return -1;
  735|    161|		break;
  736|       |
  737|    162|	case FILE_QWDATE:
  ------------------
  |  |  287|    162|#define				FILE_QWDATE		42
  ------------------
  |  Branch (737:2): [True: 162, False: 135k]
  ------------------
  738|    162|	case FILE_BEQWDATE:
  ------------------
  |  |  289|    162|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (738:2): [True: 0, False: 135k]
  ------------------
  739|    956|	case FILE_LEQWDATE:
  ------------------
  |  |  288|    956|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (739:2): [True: 794, False: 135k]
  ------------------
  740|    956|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    956|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (740:7): [True: 0, False: 956]
  ------------------
  741|    956|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  541|    956|#define FILE_T_WINDOWS	2
  ------------------
  742|    956|		    == -1)
  743|      0|			return -1;
  744|    956|		break;
  745|       |
  746|    956|	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (746:2): [True: 0, False: 135k]
  ------------------
  747|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (747:2): [True: 0, False: 135k]
  ------------------
  748|    536|	case FILE_LEFLOAT:
  ------------------
  |  |  280|    536|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (748:2): [True: 536, False: 135k]
  ------------------
  749|    536|		vf = p->f;
  750|    536|		switch (check_fmt(ms, desc)) {
  751|      0|		case -1:
  ------------------
  |  Branch (751:3): [True: 0, False: 536]
  ------------------
  752|      0|			return -1;
  753|      0|		case 1:
  ------------------
  |  Branch (753:3): [True: 0, False: 536]
  ------------------
  754|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  755|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (755:8): [True: 0, False: 0]
  ------------------
  756|      0|				return -1;
  757|      0|			break;
  758|    536|		default:
  ------------------
  |  Branch (758:3): [True: 536, False: 0]
  ------------------
  759|    536|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  167|    536|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (759:8): [True: 0, False: 536]
  ------------------
  760|      0|				return -1;
  761|    536|			break;
  762|    536|		}
  763|    536|  		break;
  764|       |
  765|    536|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (765:2): [True: 0, False: 135k]
  ------------------
  766|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (766:2): [True: 0, False: 135k]
  ------------------
  767|    370|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    370|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (767:2): [True: 370, False: 135k]
  ------------------
  768|    370|		vd = p->d;
  769|    370|		switch (check_fmt(ms, desc)) {
  770|      0|		case -1:
  ------------------
  |  Branch (770:3): [True: 0, False: 370]
  ------------------
  771|      0|			return -1;
  772|      0|		case 1:
  ------------------
  |  Branch (772:3): [True: 0, False: 370]
  ------------------
  773|      0|			(void)snprintf(buf, sizeof(buf), "%g", vd);
  774|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (774:8): [True: 0, False: 0]
  ------------------
  775|      0|				return -1;
  776|      0|			break;
  777|    370|		default:
  ------------------
  |  Branch (777:3): [True: 370, False: 0]
  ------------------
  778|    370|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  167|    370|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (778:8): [True: 0, False: 370]
  ------------------
  779|      0|				return -1;
  780|    370|			break;
  781|    370|		}
  782|    370|  		break;
  783|       |
  784|    370|	case FILE_SEARCH:
  ------------------
  |  |  265|    296|#define				FILE_SEARCH		20
  ------------------
  |  Branch (784:2): [True: 296, False: 135k]
  ------------------
  785|    716|	case FILE_REGEX: {
  ------------------
  |  |  262|    716|#define				FILE_REGEX		17
  ------------------
  |  Branch (785:2): [True: 420, False: 135k]
  ------------------
  786|    716|		char *cp, *scp;
  787|    716|		int rval;
  788|       |
  789|    716|		if (ms->search.s == NULL)
  ------------------
  |  Branch (789:7): [True: 0, False: 716]
  ------------------
  790|      0|			break;
  791|       |
  792|    716|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  453|    716|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  793|    716|		    ms->search.rm_len);
  794|    716|		if (cp == NULL) {
  ------------------
  |  Branch (794:7): [True: 0, False: 716]
  ------------------
  795|      0|			file_oomem(ms, ms->search.rm_len);
  796|      0|			return -1;
  797|      0|		}
  798|    716|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  382|    716|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  413|    716|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  395|    716|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (798:9): [True: 32, False: 684]
  ------------------
  799|       |
  800|    716|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  167|    716|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  801|    716|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  802|    716|		free(cp);
  803|       |
  804|    716|		if (rval == -1)
  ------------------
  |  Branch (804:7): [True: 0, False: 716]
  ------------------
  805|      0|			return -1;
  806|    716|		break;
  807|    716|	}
  808|       |
  809|  1.75k|	case FILE_DEFAULT:
  ------------------
  |  |  248|  1.75k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (809:2): [True: 1.75k, False: 134k]
  ------------------
  810|  2.15k|	case FILE_CLEAR:
  ------------------
  |  |  292|  2.15k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (810:2): [True: 403, False: 135k]
  ------------------
  811|  2.15k|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (811:9): [True: 0, False: 2.15k]
  ------------------
  812|      0|			return -1;
  813|  2.15k|		break;
  814|       |
  815|  3.67k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  3.67k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (815:2): [True: 3.67k, False: 132k]
  ------------------
  816|  3.75k|	case FILE_USE:
  ------------------
  |  |  291|  3.75k|#define				FILE_USE		46
  ------------------
  |  Branch (816:2): [True: 80, False: 135k]
  ------------------
  817|  12.6k|	case FILE_NAME:
  ------------------
  |  |  290|  12.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (817:2): [True: 8.88k, False: 126k]
  ------------------
  818|  12.6k|		break;
  819|    166|	case FILE_DER:
  ------------------
  |  |  293|    166|#define				FILE_DER		48
  ------------------
  |  Branch (819:2): [True: 166, False: 135k]
  ------------------
  820|    166|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    166|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (820:7): [True: 0, False: 166]
  ------------------
  821|    166|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  822|    166|			sizeof(ms->ms_value.s))) == -1)
  823|      0|			return -1;
  824|    166|		break;
  825|    337|	case FILE_GUID:
  ------------------
  |  |  294|    337|#define				FILE_GUID		49
  ------------------
  |  Branch (825:2): [True: 337, False: 135k]
  ------------------
  826|    337|	case FILE_LEGUID:
  ------------------
  |  |  295|    337|#define				FILE_LEGUID		50
  ------------------
  |  Branch (826:2): [True: 0, False: 135k]
  ------------------
  827|    337|		(void) file_print_leguid(buf, sizeof(buf), ms->ms_value.guid);
  828|    337|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|    337|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (828:7): [True: 0, False: 337]
  ------------------
  829|      0|			return -1;
  830|    337|		break;
  831|    337|	case FILE_BEGUID:
  ------------------
  |  |  296|     18|#define				FILE_BEGUID		51
  ------------------
  |  Branch (831:2): [True: 18, False: 135k]
  ------------------
  832|     18|		(void) file_print_beguid(buf, sizeof(buf), ms->ms_value.guid);
  833|     18|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|     18|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (833:7): [True: 0, False: 18]
  ------------------
  834|      0|			return -1;
  835|     18|		break;
  836|     18|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|      0|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (836:2): [True: 0, False: 135k]
  ------------------
  837|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (837:2): [True: 0, False: 135k]
  ------------------
  838|    219|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|    219|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (838:2): [True: 219, False: 135k]
  ------------------
  839|    219|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    219|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (839:7): [True: 0, False: 219]
  ------------------
  840|    219|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  841|      0|			return -1;
  842|    219|		break;
  843|    219|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|      0|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (843:2): [True: 0, False: 135k]
  ------------------
  844|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (844:2): [True: 0, False: 135k]
  ------------------
  845|    219|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|    219|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (845:2): [True: 219, False: 135k]
  ------------------
  846|    219|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    219|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (846:7): [True: 0, False: 219]
  ------------------
  847|    219|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  848|      0|			return -1;
  849|    219|		break;
  850|    219|	case FILE_OCTAL:
  ------------------
  |  |  306|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (850:2): [True: 0, False: 135k]
  ------------------
  851|      0|		file_fmtnum(buf, sizeof(buf), m->value.s, 8);
  852|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (852:7): [True: 0, False: 0]
  ------------------
  853|      0|			return -1;
  854|      0|		break;
  855|      0|	default:
  ------------------
  |  Branch (855:2): [True: 0, False: 135k]
  ------------------
  856|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  857|      0|		return -1;
  858|   135k|	}
  859|   135k|	return 0;
  860|   135k|}
softmagic.c:check_fmt:
  509|  79.5k|{
  510|  79.5k|	file_regex_t rx;
  511|  79.5k|	int rc;
  512|  79.5k|        const char* pat = "%[-0-9\\.]*s";
  513|       |
  514|  79.5k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (514:6): [True: 50.2k, False: 29.2k]
  ------------------
  515|  50.2k|		return 0;
  516|       |
  517|  29.2k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  518|  29.2k|	if (rc != 0)
  ------------------
  |  Branch (518:6): [True: 0, False: 29.2k]
  ------------------
  519|      0|		return -1;
  520|  29.2k|	rc = !file_regexec(ms, &rx, fmt, 0, 0, 0);
  521|  29.2k|	file_regfree(&rx);
  522|  29.2k|	return rc;
  523|  29.2k|}
softmagic.c:moffset:
  865|   743k|{
  866|   743k|	int32_t o;
  867|   743k|	size_t vlen;
  868|       |
  869|   743k|  	switch (m->type) {
  870|   212k|  	case FILE_BYTE:
  ------------------
  |  |  246|   212k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (870:4): [True: 212k, False: 530k]
  ------------------
  871|   212k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  452|   212k|#define CAST(T, b)	((T)(b))
  ------------------
  872|   212k|		break;
  873|       |
  874|  16.3k|  	case FILE_SHORT:
  ------------------
  |  |  247|  16.3k|#define				FILE_SHORT		2
  ------------------
  |  Branch (874:4): [True: 16.3k, False: 726k]
  ------------------
  875|  67.4k|  	case FILE_BESHORT:
  ------------------
  |  |  252|  67.4k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (875:4): [True: 51.0k, False: 692k]
  ------------------
  876|   121k|  	case FILE_LESHORT:
  ------------------
  |  |  255|   121k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (876:4): [True: 54.1k, False: 689k]
  ------------------
  877|   121k|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|   121k|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (877:2): [True: 0, False: 743k]
  ------------------
  878|   121k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|   121k|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (878:2): [True: 219, False: 742k]
  ------------------
  879|   121k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|   121k|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (879:2): [True: 0, False: 743k]
  ------------------
  880|   121k|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|   121k|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (880:2): [True: 0, False: 743k]
  ------------------
  881|   122k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|   122k|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (881:2): [True: 219, False: 742k]
  ------------------
  882|   122k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|   122k|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (882:2): [True: 0, False: 743k]
  ------------------
  883|   122k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  452|   122k|#define CAST(T, b)	((T)(b))
  ------------------
  884|   122k|		break;
  885|       |
  886|  4.20k|  	case FILE_LONG:
  ------------------
  |  |  249|  4.20k|#define				FILE_LONG		4
  ------------------
  |  Branch (886:4): [True: 4.20k, False: 738k]
  ------------------
  887|  93.2k|  	case FILE_BELONG:
  ------------------
  |  |  253|  93.2k|#define				FILE_BELONG		8
  ------------------
  |  Branch (887:4): [True: 89.0k, False: 654k]
  ------------------
  888|   131k|  	case FILE_LELONG:
  ------------------
  |  |  256|   131k|#define				FILE_LELONG		11
  ------------------
  |  Branch (888:4): [True: 37.9k, False: 705k]
  ------------------
  889|   131k|  	case FILE_MELONG:
  ------------------
  |  |  268|   131k|#define				FILE_MELONG		23
  ------------------
  |  Branch (889:4): [True: 30, False: 743k]
  ------------------
  890|   131k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  452|   131k|#define CAST(T, b)	((T)(b))
  ------------------
  891|   131k|		break;
  892|       |
  893|  26.5k|  	case FILE_QUAD:
  ------------------
  |  |  269|  26.5k|#define				FILE_QUAD		24
  ------------------
  |  Branch (893:4): [True: 26.5k, False: 716k]
  ------------------
  894|  33.3k|  	case FILE_BEQUAD:
  ------------------
  |  |  271|  33.3k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (894:4): [True: 6.73k, False: 736k]
  ------------------
  895|  34.2k|  	case FILE_LEQUAD:
  ------------------
  |  |  270|  34.2k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (895:4): [True: 957, False: 742k]
  ------------------
  896|  34.2k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  452|  34.2k|#define CAST(T, b)	((T)(b))
  ------------------
  897|  34.2k|		break;
  898|       |
  899|  79.2k|  	case FILE_STRING:
  ------------------
  |  |  250|  79.2k|#define				FILE_STRING		5
  ------------------
  |  Branch (899:4): [True: 79.2k, False: 663k]
  ------------------
  900|  80.3k|  	case FILE_PSTRING:
  ------------------
  |  |  258|  80.3k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (900:4): [True: 1.11k, False: 742k]
  ------------------
  901|  80.6k|  	case FILE_BESTRING16:
  ------------------
  |  |  263|  80.6k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (901:4): [True: 290, False: 742k]
  ------------------
  902|  81.2k|  	case FILE_LESTRING16:
  ------------------
  |  |  264|  81.2k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (902:4): [True: 539, False: 742k]
  ------------------
  903|  81.2k|	case FILE_OCTAL:
  ------------------
  |  |  306|  81.2k|#define				FILE_OCTAL		61
  ------------------
  |  Branch (903:2): [True: 0, False: 743k]
  ------------------
  904|  81.2k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (904:7): [True: 29.0k, False: 52.2k]
  |  Branch (904:25): [True: 1.78k, False: 50.4k]
  ------------------
  905|  30.8k|			o = ms->offset + m->vallen;
  906|  50.4k|		} else {
  907|  50.4k|			union VALUETYPE *p = &ms->ms_value;
  908|       |
  909|  50.4k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (909:8): [True: 43.0k, False: 7.40k]
  ------------------
  910|  43.0k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  911|  50.4k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  452|  50.4k|#define CAST(T, b)	((T)(b))
  ------------------
  912|  50.4k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  258|  50.4k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (912:8): [True: 1.11k, False: 49.3k]
  ------------------
  913|  1.11k|				size_t l = file_pstring_length_size(ms, m);
  914|  1.11k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.11k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  1.11k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (914:9): [True: 0, False: 1.11k]
  ------------------
  915|      0|					return -1;
  916|  1.11k|				o += CAST(uint32_t, l);
  ------------------
  |  |  452|  1.11k|#define CAST(T, b)	((T)(b))
  ------------------
  917|  1.11k|			}
  918|  50.4k|		}
  919|  81.2k|		break;
  920|       |
  921|  81.2k|	case FILE_DATE:
  ------------------
  |  |  251|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (921:2): [True: 0, False: 743k]
  ------------------
  922|    228|	case FILE_BEDATE:
  ------------------
  |  |  254|    228|#define				FILE_BEDATE		9
  ------------------
  |  Branch (922:2): [True: 228, False: 742k]
  ------------------
  923|    405|	case FILE_LEDATE:
  ------------------
  |  |  257|    405|#define				FILE_LEDATE		12
  ------------------
  |  Branch (923:2): [True: 177, False: 742k]
  ------------------
  924|    441|	case FILE_MEDATE:
  ------------------
  |  |  266|    441|#define				FILE_MEDATE		21
  ------------------
  |  Branch (924:2): [True: 36, False: 743k]
  ------------------
  925|    441|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  452|    441|#define CAST(T, b)	((T)(b))
  ------------------
  926|    441|		break;
  927|       |
  928|      0|	case FILE_LDATE:
  ------------------
  |  |  259|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (928:2): [True: 0, False: 743k]
  ------------------
  929|    287|	case FILE_BELDATE:
  ------------------
  |  |  260|    287|#define				FILE_BELDATE		15
  ------------------
  |  Branch (929:2): [True: 287, False: 742k]
  ------------------
  930|    287|	case FILE_LELDATE:
  ------------------
  |  |  261|    287|#define				FILE_LELDATE		16
  ------------------
  |  Branch (930:2): [True: 0, False: 743k]
  ------------------
  931|    287|	case FILE_MELDATE:
  ------------------
  |  |  267|    287|#define				FILE_MELDATE		22
  ------------------
  |  Branch (931:2): [True: 0, False: 743k]
  ------------------
  932|    287|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  452|    287|#define CAST(T, b)	((T)(b))
  ------------------
  933|    287|		break;
  934|       |
  935|      0|	case FILE_QDATE:
  ------------------
  |  |  272|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (935:2): [True: 0, False: 743k]
  ------------------
  936|    434|	case FILE_BEQDATE:
  ------------------
  |  |  274|    434|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (936:2): [True: 434, False: 742k]
  ------------------
  937|    434|	case FILE_LEQDATE:
  ------------------
  |  |  273|    434|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (937:2): [True: 0, False: 743k]
  ------------------
  938|    434|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  452|    434|#define CAST(T, b)	((T)(b))
  ------------------
  939|    434|		break;
  940|       |
  941|      0|	case FILE_QLDATE:
  ------------------
  |  |  275|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (941:2): [True: 0, False: 743k]
  ------------------
  942|    148|	case FILE_BEQLDATE:
  ------------------
  |  |  277|    148|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (942:2): [True: 148, False: 743k]
  ------------------
  943|    161|	case FILE_LEQLDATE:
  ------------------
  |  |  276|    161|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (943:2): [True: 13, False: 743k]
  ------------------
  944|    161|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  452|    161|#define CAST(T, b)	((T)(b))
  ------------------
  945|    161|		break;
  946|       |
  947|      0|  	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (947:4): [True: 0, False: 743k]
  ------------------
  948|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (948:4): [True: 0, False: 743k]
  ------------------
  949|    536|  	case FILE_LEFLOAT:
  ------------------
  |  |  280|    536|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (949:4): [True: 536, False: 742k]
  ------------------
  950|    536|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  452|    536|#define CAST(T, b)	((T)(b))
  ------------------
  951|    536|		break;
  952|       |
  953|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (953:4): [True: 0, False: 743k]
  ------------------
  954|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (954:4): [True: 0, False: 743k]
  ------------------
  955|    370|  	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    370|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (955:4): [True: 370, False: 742k]
  ------------------
  956|    370|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  452|    370|#define CAST(T, b)	((T)(b))
  ------------------
  957|    370|		break;
  958|       |
  959|  1.04k|	case FILE_REGEX:
  ------------------
  |  |  262|  1.04k|#define				FILE_REGEX		17
  ------------------
  |  Branch (959:2): [True: 1.04k, False: 742k]
  ------------------
  960|       |		/* Why is regex and search different? */
  961|  1.04k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  382|  1.04k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  400|  1.04k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  395|  1.04k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (961:10): [True: 973, False: 69]
  ------------------
  962|    973|		    ms->search.rm_len : 0;
  963|  1.04k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  452|  1.04k|#define CAST(T, b)	((T)(b))
  ------------------
  964|  1.04k|		break;
  965|       |
  966|  6.69k|	case FILE_SEARCH:
  ------------------
  |  |  265|  6.69k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (966:2): [True: 6.69k, False: 736k]
  ------------------
  967|  6.69k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  382|  6.69k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  400|  6.69k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  395|  6.69k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (967:10): [True: 6.46k, False: 231]
  ------------------
  968|  6.69k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  452|  6.69k|#define CAST(T, b)	((T)(b))
  ------------------
  969|  6.69k|		break;
  970|       |
  971|  3.04k|	case FILE_CLEAR:
  ------------------
  |  |  292|  3.04k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (971:2): [True: 3.04k, False: 740k]
  ------------------
  972|  13.0k|	case FILE_DEFAULT:
  ------------------
  |  |  248|  13.0k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (972:2): [True: 10.0k, False: 733k]
  ------------------
  973|  25.2k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  25.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (973:2): [True: 12.2k, False: 730k]
  ------------------
  974|  26.1k|	case FILE_OFFSET:
  ------------------
  |  |  297|  26.1k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (974:2): [True: 852, False: 742k]
  ------------------
  975|  61.1k|	case FILE_USE:
  ------------------
  |  |  291|  61.1k|#define				FILE_USE		46
  ------------------
  |  Branch (975:2): [True: 35.0k, False: 708k]
  ------------------
  976|  61.1k|		o = ms->offset;
  977|  61.1k|		break;
  978|       |
  979|  28.8k|	case FILE_DER:
  ------------------
  |  |  293|  28.8k|#define				FILE_DER		48
  ------------------
  |  Branch (979:2): [True: 28.8k, False: 714k]
  ------------------
  980|  28.8k|		o = der_offs(ms, m, nbytes);
  981|  28.8k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  452|  28.8k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (981:7): [True: 0, False: 28.8k]
  |  Branch (981:18): [True: 0, False: 28.8k]
  ------------------
  982|      0|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (982:8): [True: 0, False: 0]
  ------------------
  983|      0|				(void)fprintf(stderr,
  984|      0|				    "Bad DER offset %d nbytes=%"
  985|      0|				    SIZE_T_FORMAT "u", o, nbytes);
  986|      0|			}
  987|      0|			*op = 0;
  988|      0|			return 0;
  989|      0|		}
  990|  28.8k|		break;
  991|       |
  992|  28.8k|	case FILE_BEGUID:
  ------------------
  |  |  296|     18|#define				FILE_BEGUID		51
  ------------------
  |  Branch (992:2): [True: 18, False: 743k]
  ------------------
  993|     18|	case FILE_LEGUID:
  ------------------
  |  |  295|     18|#define				FILE_LEGUID		50
  ------------------
  |  Branch (993:2): [True: 0, False: 743k]
  ------------------
  994|    355|	case FILE_GUID:
  ------------------
  |  |  294|    355|#define				FILE_GUID		49
  ------------------
  |  Branch (994:2): [True: 337, False: 742k]
  ------------------
  995|    355|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  452|    355|#define CAST(T, b)	((T)(b))
  ------------------
  996|    355|		break;
  997|       |
  998|  61.8k|	default:
  ------------------
  |  Branch (998:2): [True: 61.8k, False: 681k]
  ------------------
  999|  61.8k|		o = 0;
 1000|  61.8k|		break;
 1001|   743k|	}
 1002|       |
 1003|   743k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  452|   743k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1003:6): [True: 27.1k, False: 716k]
  ------------------
 1004|       |#if 0
 1005|       |		file_error(ms, 0, "Offset out of range %" SIZE_T_FORMAT
 1006|       |		    "u > %" SIZE_T_FORMAT "u", (size_t)o, nbytes);
 1007|       |#endif
 1008|  27.1k|		return -1;
 1009|  27.1k|	}
 1010|   716k|	*op = o;
 1011|   716k|	return 1;
 1012|   743k|}

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

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

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

