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|  84.5M|{
 1654|  84.5M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  229|  84.5M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1654:6): [True: 79.4M, False: 5.17M]
  ------------------
 1655|  79.4M|		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|   909k|		case FILE_BYTE:
  ------------------
  |  |  246|   909k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1661:3): [True: 909k, False: 78.5M]
  ------------------
 1662|   909k|			v = CAST(signed char,  v);
  ------------------
  |  |  452|   909k|#define CAST(T, b)	((T)(b))
  ------------------
 1663|   909k|			break;
 1664|  1.52M|		case FILE_SHORT:
  ------------------
  |  |  247|  1.52M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1664:3): [True: 1.52M, False: 77.8M]
  ------------------
 1665|  4.90M|		case FILE_BESHORT:
  ------------------
  |  |  252|  4.90M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1665:3): [True: 3.38M, False: 76.0M]
  ------------------
 1666|  7.87M|		case FILE_LESHORT:
  ------------------
  |  |  255|  7.87M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1666:3): [True: 2.96M, False: 76.4M]
  ------------------
 1667|  7.87M|			v = CAST(short, v);
  ------------------
  |  |  452|  7.87M|#define CAST(T, b)	((T)(b))
  ------------------
 1668|  7.87M|			break;
 1669|      0|		case FILE_DATE:
  ------------------
  |  |  251|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1669:3): [True: 0, False: 79.4M]
  ------------------
 1670|    184|		case FILE_BEDATE:
  ------------------
  |  |  254|    184|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1670:3): [True: 184, False: 79.4M]
  ------------------
 1671|    430|		case FILE_LEDATE:
  ------------------
  |  |  257|    430|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1671:3): [True: 246, False: 79.4M]
  ------------------
 1672|    455|		case FILE_MEDATE:
  ------------------
  |  |  266|    455|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1672:3): [True: 25, False: 79.4M]
  ------------------
 1673|    455|		case FILE_LDATE:
  ------------------
  |  |  259|    455|#define				FILE_LDATE		14
  ------------------
  |  Branch (1673:3): [True: 0, False: 79.4M]
  ------------------
 1674|    718|		case FILE_BELDATE:
  ------------------
  |  |  260|    718|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1674:3): [True: 263, False: 79.4M]
  ------------------
 1675|    718|		case FILE_LELDATE:
  ------------------
  |  |  261|    718|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1675:3): [True: 0, False: 79.4M]
  ------------------
 1676|    718|		case FILE_MELDATE:
  ------------------
  |  |  267|    718|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1676:3): [True: 0, False: 79.4M]
  ------------------
 1677|  1.31M|		case FILE_LONG:
  ------------------
  |  |  249|  1.31M|#define				FILE_LONG		4
  ------------------
  |  Branch (1677:3): [True: 1.31M, False: 78.0M]
  ------------------
 1678|  11.5M|		case FILE_BELONG:
  ------------------
  |  |  253|  11.5M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1678:3): [True: 10.2M, False: 69.1M]
  ------------------
 1679|  15.4M|		case FILE_LELONG:
  ------------------
  |  |  256|  15.4M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1679:3): [True: 3.92M, False: 75.4M]
  ------------------
 1680|  15.4M|		case FILE_MELONG:
  ------------------
  |  |  268|  15.4M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1680:3): [True: 42, False: 79.4M]
  ------------------
 1681|  15.4M|		case FILE_FLOAT:
  ------------------
  |  |  278|  15.4M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1681:3): [True: 0, False: 79.4M]
  ------------------
 1682|  15.4M|		case FILE_BEFLOAT:
  ------------------
  |  |  279|  15.4M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1682:3): [True: 0, False: 79.4M]
  ------------------
 1683|  15.4M|		case FILE_LEFLOAT:
  ------------------
  |  |  280|  15.4M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1683:3): [True: 0, False: 79.4M]
  ------------------
 1684|  15.4M|		case FILE_MSDOSDATE:
  ------------------
  |  |  300|  15.4M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1684:3): [True: 0, False: 79.4M]
  ------------------
 1685|  15.4M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|  15.4M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1685:3): [True: 0, False: 79.4M]
  ------------------
 1686|  15.4M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|  15.4M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1686:3): [True: 236, False: 79.4M]
  ------------------
 1687|  15.4M|		case FILE_MSDOSTIME:
  ------------------
  |  |  303|  15.4M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1687:3): [True: 0, False: 79.4M]
  ------------------
 1688|  15.4M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|  15.4M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1688:3): [True: 0, False: 79.4M]
  ------------------
 1689|  15.4M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|  15.4M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1689:3): [True: 236, False: 79.4M]
  ------------------
 1690|  15.4M|			v = CAST(int32_t, v);
  ------------------
  |  |  452|  15.4M|#define CAST(T, b)	((T)(b))
  ------------------
 1691|  15.4M|			break;
 1692|  59.8k|		case FILE_QUAD:
  ------------------
  |  |  269|  59.8k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1692:3): [True: 59.8k, False: 79.3M]
  ------------------
 1693|   712k|		case FILE_BEQUAD:
  ------------------
  |  |  271|   712k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1693:3): [True: 652k, False: 78.7M]
  ------------------
 1694|  1.04M|		case FILE_LEQUAD:
  ------------------
  |  |  270|  1.04M|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1694:3): [True: 336k, False: 79.0M]
  ------------------
 1695|  1.04M|		case FILE_QDATE:
  ------------------
  |  |  272|  1.04M|#define				FILE_QDATE		27
  ------------------
  |  Branch (1695:3): [True: 0, False: 79.4M]
  ------------------
 1696|  1.04M|		case FILE_QLDATE:
  ------------------
  |  |  275|  1.04M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1696:3): [True: 0, False: 79.4M]
  ------------------
 1697|  1.04M|		case FILE_QWDATE:
  ------------------
  |  |  287|  1.04M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1697:3): [True: 160, False: 79.4M]
  ------------------
 1698|  1.05M|		case FILE_BEQDATE:
  ------------------
  |  |  274|  1.05M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1698:3): [True: 556, False: 79.4M]
  ------------------
 1699|  1.05M|		case FILE_BEQLDATE:
  ------------------
  |  |  277|  1.05M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1699:3): [True: 0, False: 79.4M]
  ------------------
 1700|  1.05M|		case FILE_BEQWDATE:
  ------------------
  |  |  289|  1.05M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1700:3): [True: 0, False: 79.4M]
  ------------------
 1701|  1.05M|		case FILE_LEQDATE:
  ------------------
  |  |  273|  1.05M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1701:3): [True: 0, False: 79.4M]
  ------------------
 1702|  1.05M|		case FILE_LEQLDATE:
  ------------------
  |  |  276|  1.05M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1702:3): [True: 13, False: 79.4M]
  ------------------
 1703|  1.05M|		case FILE_LEQWDATE:
  ------------------
  |  |  288|  1.05M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1703:3): [True: 1.02k, False: 79.4M]
  ------------------
 1704|  1.05M|		case FILE_DOUBLE:
  ------------------
  |  |  281|  1.05M|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1704:3): [True: 0, False: 79.4M]
  ------------------
 1705|  1.05M|		case FILE_BEDOUBLE:
  ------------------
  |  |  282|  1.05M|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1705:3): [True: 0, False: 79.4M]
  ------------------
 1706|  1.05M|		case FILE_LEDOUBLE:
  ------------------
  |  |  283|  1.05M|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1706:3): [True: 0, False: 79.4M]
  ------------------
 1707|  1.05M|		case FILE_OFFSET:
  ------------------
  |  |  297|  1.05M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1707:3): [True: 7.20k, False: 79.4M]
  ------------------
 1708|  1.05M|		case FILE_BEVARINT:
  ------------------
  |  |  298|  1.05M|#define				FILE_BEVARINT		53
  ------------------
  |  Branch (1708:3): [True: 0, False: 79.4M]
  ------------------
 1709|  1.05M|		case FILE_LEVARINT:
  ------------------
  |  |  299|  1.05M|#define				FILE_LEVARINT		54
  ------------------
  |  Branch (1709:3): [True: 0, False: 79.4M]
  ------------------
 1710|  1.05M|			v = CAST(int64_t, v);
  ------------------
  |  |  452|  1.05M|#define CAST(T, b)	((T)(b))
  ------------------
 1711|  1.05M|			break;
 1712|  53.0M|		case FILE_STRING:
  ------------------
  |  |  250|  53.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (1712:3): [True: 53.0M, False: 26.3M]
  ------------------
 1713|  53.0M|		case FILE_PSTRING:
  ------------------
  |  |  258|  53.0M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1713:3): [True: 22.6k, False: 79.3M]
  ------------------
 1714|  53.0M|		case FILE_BESTRING16:
  ------------------
  |  |  263|  53.0M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1714:3): [True: 299, False: 79.4M]
  ------------------
 1715|  53.1M|		case FILE_LESTRING16:
  ------------------
  |  |  264|  53.1M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1715:3): [True: 57.3k, False: 79.3M]
  ------------------
 1716|  53.3M|		case FILE_REGEX:
  ------------------
  |  |  262|  53.3M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1716:3): [True: 262k, False: 79.1M]
  ------------------
 1717|  53.9M|		case FILE_SEARCH:
  ------------------
  |  |  265|  53.9M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1717:3): [True: 515k, False: 78.9M]
  ------------------
 1718|  53.9M|		case FILE_DEFAULT:
  ------------------
  |  |  248|  53.9M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1718:3): [True: 12.1k, False: 79.4M]
  ------------------
 1719|  53.9M|		case FILE_INDIRECT:
  ------------------
  |  |  286|  53.9M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1719:3): [True: 0, False: 79.4M]
  ------------------
 1720|  53.9M|		case FILE_NAME:
  ------------------
  |  |  290|  53.9M|#define				FILE_NAME		45
  ------------------
  |  Branch (1720:3): [True: 0, False: 79.4M]
  ------------------
 1721|  53.9M|		case FILE_USE:
  ------------------
  |  |  291|  53.9M|#define				FILE_USE		46
  ------------------
  |  Branch (1721:3): [True: 0, False: 79.4M]
  ------------------
 1722|  53.9M|		case FILE_CLEAR:
  ------------------
  |  |  292|  53.9M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1722:3): [True: 3.22k, False: 79.4M]
  ------------------
 1723|  53.9M|		case FILE_DER:
  ------------------
  |  |  293|  53.9M|#define				FILE_DER		48
  ------------------
  |  Branch (1723:3): [True: 0, False: 79.4M]
  ------------------
 1724|  54.0M|		case FILE_GUID:
  ------------------
  |  |  294|  54.0M|#define				FILE_GUID		49
  ------------------
  |  Branch (1724:3): [True: 164k, False: 79.2M]
  ------------------
 1725|  54.0M|		case FILE_LEGUID:
  ------------------
  |  |  295|  54.0M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1725:3): [True: 0, False: 79.4M]
  ------------------
 1726|  54.0M|		case FILE_BEGUID:
  ------------------
  |  |  296|  54.0M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1726:3): [True: 0, False: 79.4M]
  ------------------
 1727|  54.0M|		case FILE_OCTAL:
  ------------------
  |  |  306|  54.0M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1727:3): [True: 0, False: 79.4M]
  ------------------
 1728|  54.0M|			break;
 1729|      0|		default:
  ------------------
  |  Branch (1729:3): [True: 0, False: 79.4M]
  ------------------
 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.4M|		}
 1735|  79.4M|	}
 1736|  84.5M|	return v;
 1737|  84.5M|}
file_pstring_length_size:
 3630|  26.1k|{
 3631|  26.1k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  382|  26.1k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  411|  26.1k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  403|  26.1k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  26.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  406|  26.1k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  26.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  405|  26.1k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  26.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  408|  26.1k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  26.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  407|  26.1k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  26.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3632|  21.7k|	case PSTRING_1_LE:
  ------------------
  |  |  404|  21.7k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  395|  21.7k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3632:2): [True: 21.7k, False: 4.33k]
  ------------------
 3633|  21.7k|		return 1;
 3634|    348|	case PSTRING_2_LE:
  ------------------
  |  |  406|    348|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  395|    348|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3634:2): [True: 348, False: 25.7k]
  ------------------
 3635|  3.90k|	case PSTRING_2_BE:
  ------------------
  |  |  405|  3.90k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  395|  3.90k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3635:2): [True: 3.56k, False: 22.5k]
  ------------------
 3636|  3.90k|		return 2;
 3637|    105|	case PSTRING_4_LE:
  ------------------
  |  |  408|    105|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  395|    105|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3637:2): [True: 105, False: 26.0k]
  ------------------
 3638|    426|	case PSTRING_4_BE:
  ------------------
  |  |  407|    426|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  395|    426|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3638:2): [True: 321, False: 25.7k]
  ------------------
 3639|    426|		return 4;
 3640|      0|	default:
  ------------------
  |  Branch (3640:2): [True: 0, False: 26.1k]
  ------------------
 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|  26.1k|	}
 3646|  26.1k|}
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.4k|	case PSTRING_1_LE:
  ------------------
  |  |  404|  21.4k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  395|  21.4k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3657:2): [True: 21.4k, False: 1.20k]
  ------------------
 3658|  21.4k|		len = *s;
 3659|  21.4k|		break;
 3660|    116|	case PSTRING_2_LE:
  ------------------
  |  |  406|    116|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  395|    116|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3660:2): [True: 116, False: 22.5k]
  ------------------
 3661|    116|		s0 = s[0];
 3662|    116|		s1 = s[1];
 3663|    116|		len = (s1 << 8) | s0;
 3664|    116|		break;
 3665|    944|	case PSTRING_2_BE:
  ------------------
  |  |  405|    944|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  395|    944|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3665:2): [True: 944, False: 21.7k]
  ------------------
 3666|    944|		s0 = s[0];
 3667|    944|		s1 = s[1];
 3668|    944|		len = (s0 << 8) | s1;
 3669|    944|		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|    107|	case PSTRING_4_BE:
  ------------------
  |  |  407|    107|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  395|    107|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3677:2): [True: 107, False: 22.5k]
  ------------------
 3678|    107|		s0 = s[0];
 3679|    107|		s1 = s[1];
 3680|    107|		s2 = s[2];
 3681|    107|		s3 = s[3];
 3682|    107|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3683|    107|		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: 892, False: 21.7k]
  ------------------
 3692|    892|		size_t l = file_pstring_length_size(ms, m);
 3693|    892|		if (l == FILE_BADSIZE)
  ------------------
  |  |  175|    892|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|    892|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3693:7): [True: 0, False: 892]
  ------------------
 3694|      0|			return l;
 3695|    892|		len -= l;
 3696|    892|	}
 3697|       |
 3698|  22.6k|	return len;
 3699|  22.6k|}
file_magicfind:
 3703|  61.2k|{
 3704|  61.2k|	uint32_t i, j;
 3705|  61.2k|	struct mlist *mlist, *ml;
 3706|       |
 3707|  61.2k|	mlist = ms->mlist[1];
 3708|       |
 3709|  61.2k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3709:25): [True: 61.2k, False: 0]
  ------------------
 3710|  61.2k|		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: 254M, False: 12.6M]
  ------------------
 3713|   254M|				continue;
 3714|  12.6M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3714:8): [True: 61.2k, False: 12.5M]
  ------------------
 3715|  61.2k|				v->magic = &ma[i];
 3716|  61.2k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3717|  2.89M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3717:21): [True: 2.89M, False: 26]
  ------------------
 3718|  2.89M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3718:13): [True: 61.1k, False: 2.83M]
  ------------------
 3719|  61.1k|					    break;
 3720|  61.2k|				v->nmagic = j - i;
 3721|  61.2k|				return 0;
 3722|  61.2k|			}
 3723|  12.6M|		}
 3724|  61.2k|	}
 3725|      0|	return -1;
 3726|  61.2k|}
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)
  ------------------
  |  |  727|      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,
  ------------------
  |  |  371|      0|#define VERSION "5.47"
  ------------------
 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|  13.0k|{
   73|  13.0k|	file_unichar_t *ubuf = NULL;
   74|  13.0k|	size_t ulen = 0;
   75|  13.0k|	int rv = 1;
   76|  13.0k|	struct buffer bb;
   77|       |
   78|  13.0k|	const char *code = NULL;
   79|  13.0k|	const char *code_mime = NULL;
   80|  13.0k|	const char *type = NULL;
   81|       |
   82|  13.0k|	bb = *b;
   83|  13.0k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  452|  13.0k|#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|  13.0k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 5.96k, False: 7.04k]
  |  Branch (88:23): [True: 1.78k, False: 4.17k]
  ------------------
   89|  1.78k|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  13.0k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 10.8k, False: 2.12k]
  ------------------
   93|  13.0k|	    &type) == 0)
   94|  10.8k|		rv = 0;
   95|  2.12k|        else
   96|  2.12k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  2.12k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  13.0k|	free(ubuf);
  100|       |
  101|  13.0k|	return rv;
  102|  13.0k|}
file_ascmagic_with_encoding:
  108|  2.12k|{
  109|  2.12k|	struct buffer bb;
  110|  2.12k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  2.12k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  2.12k|	size_t nbytes = b->flen;
  112|  2.12k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  2.12k|	size_t mlen, i, len;
  114|  2.12k|	int rv = -1;
  115|  2.12k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  2.12k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.12k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.12k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  2.12k|	int need_separator = 0;
  117|       |
  118|  2.12k|	const char *subtype = NULL;
  119|       |
  120|  2.12k|	int has_escapes = 0;
  121|  2.12k|	int has_backspace = 0;
  122|  2.12k|	int seen_cr = 0;
  123|       |
  124|  2.12k|	size_t n_crlf = 0;
  125|  2.12k|	size_t n_lf = 0;
  126|  2.12k|	size_t n_cr = 0;
  127|  2.12k|	size_t n_nel = 0;
  128|  2.12k|	int executable = 0;
  129|       |
  130|  2.12k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  452|  2.12k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  2.12k|	size_t has_long_lines = 0;
  132|       |
  133|  2.12k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  2.12k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 25, False: 2.09k]
  ------------------
  137|     25|		rv = 0;
  138|     25|		goto done;
  139|     25|	}
  140|       |
  141|  2.09k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  2.02k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 2.02k, False: 75]
  |  Branch (141:18): [True: 2.02k, False: 0]
  ------------------
  142|       |		/* Convert ubuf to UTF-8 and try text soft magic */
  143|       |		/* malloc size is a conservative overestimate; could be
  144|       |		   improved, or at least realloced after conversion. */
  145|  2.02k|		if (ulen > SIZE_MAX / 6) {
  ------------------
  |  Branch (145:7): [True: 0, False: 2.02k]
  ------------------
  146|      0|			goto done;
  147|      0|		}
  148|  2.02k|		mlen = ulen * 6;
  149|  2.02k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  452|  2.02k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (149:7): [True: 0, False: 2.02k]
  ------------------
  150|      0|			file_oomem(ms, mlen);
  151|      0|			goto done;
  152|      0|		}
  153|  2.02k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (153:7): [True: 68, False: 1.95k]
  ------------------
  154|  2.02k|		    == NULL) {
  155|     68|			rv = 0;
  156|     68|			goto done;
  157|     68|		}
  158|  1.95k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  159|  1.95k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  452|  1.95k|#define CAST(T, b)	((T)(b))
  ------------------
  160|       |
  161|  1.95k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (161:7): [True: 1.85k, False: 100]
  ------------------
  162|  1.95k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  233|  1.95k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  163|  1.85k|			rv = -1;
  164|    100|		else
  165|    100|			need_separator = 1;
  166|  1.95k|		buffer_fini(&bb);
  167|  1.95k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.95k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.95k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (167:7): [True: 0, False: 1.95k]
  ------------------
  168|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (168:9): [True: 0, False: 0]
  ------------------
  169|      0|			goto done;
  170|      0|		}
  171|  1.95k|	}
  172|       |
  173|  2.02k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.02k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.02k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (173:6): [True: 0, False: 2.02k]
  ------------------
  174|      0|		rv = 0;
  175|      0|		goto done;
  176|      0|	}
  177|       |
  178|       |	/* Now try to discover other details about the file. */
  179|  8.38M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (179:14): [True: 8.38M, False: 2.02k]
  ------------------
  180|  8.38M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (180:7): [True: 940k, False: 7.44M]
  ------------------
  181|   940k|			if (seen_cr)
  ------------------
  |  Branch (181:8): [True: 14.1k, False: 926k]
  ------------------
  182|  14.1k|				n_crlf++;
  183|   926k|			else
  184|   926k|				n_lf++;
  185|   940k|			last_line_end = i;
  186|  7.44M|		} else if (seen_cr)
  ------------------
  |  Branch (186:14): [True: 541k, False: 6.90M]
  ------------------
  187|   541k|			n_cr++;
  188|       |
  189|  8.38M|		seen_cr = (ubuf[i] == '\r');
  190|  8.38M|		if (seen_cr)
  ------------------
  |  Branch (190:7): [True: 556k, False: 7.82M]
  ------------------
  191|   556k|			last_line_end = i;
  192|       |
  193|  8.38M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (193:7): [True: 729k, False: 7.65M]
  ------------------
  194|   729k|			n_nel++;
  195|   729k|			last_line_end = i;
  196|   729k|		}
  197|       |
  198|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  199|  8.38M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  8.38M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (199:7): [True: 5.95M, False: 2.43M]
  ------------------
  200|  5.95M|			size_t ll = i - last_line_end;
  201|  5.95M|			if (ll > has_long_lines)
  ------------------
  |  Branch (201:8): [True: 5.87M, False: 75.6k]
  ------------------
  202|  5.87M|				has_long_lines = ll;
  203|  5.95M|		}
  204|       |
  205|  8.38M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (205:7): [True: 28.4k, False: 8.35M]
  ------------------
  206|  28.4k|			has_escapes = 1;
  207|  8.38M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (207:7): [True: 130k, False: 8.25M]
  ------------------
  208|   130k|			has_backspace = 1;
  209|  8.38M|	}
  210|       |
  211|  2.02k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (211:6): [True: 0, False: 2.02k]
  ------------------
  212|      0|		rv = 0;
  213|      0|		goto done;
  214|      0|	}
  215|  2.02k|	len = file_printedlen(ms);
  216|  2.02k|	if (mime) {
  ------------------
  |  Branch (216:6): [True: 0, False: 2.02k]
  ------------------
  217|      0|		if ((mime & MAGIC_MIME_TYPE) != 0) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (217:7): [True: 0, False: 0]
  ------------------
  218|      0|			if (len) {
  ------------------
  |  Branch (218:8): [True: 0, False: 0]
  ------------------
  219|       |				/*
  220|       |				 * Softmagic printed something, we
  221|       |				 * are either done, or we need a separator
  222|       |				 */
  223|      0|				if ((ms->flags & MAGIC_CONTINUE) == 0) {
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|					rv = 1;
  225|      0|					goto done;
  226|      0|				}
  227|      0|				if (need_separator && file_separator(ms) == -1)
  ------------------
  |  Branch (227:9): [True: 0, False: 0]
  |  Branch (227:27): [True: 0, False: 0]
  ------------------
  228|      0|					goto done;
  229|      0|			}
  230|      0|			if (file_printf(ms, "text/plain") == -1)
  ------------------
  |  Branch (230:8): [True: 0, False: 0]
  ------------------
  231|      0|				goto done;
  232|      0|		}
  233|  2.02k|	} else {
  234|  2.02k|		if (len) {
  ------------------
  |  Branch (234:7): [True: 660, False: 1.36k]
  ------------------
  235|    660|			switch (file_replace(ms, " text$", ", ")) {
  236|    631|			case 0:
  ------------------
  |  Branch (236:4): [True: 631, False: 29]
  ------------------
  237|    631|				switch (file_replace(ms, " text executable$",
  238|    631|				    ", ")) {
  239|    571|				case 0:
  ------------------
  |  Branch (239:5): [True: 571, False: 60]
  ------------------
  240|    571|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (240:10): [True: 0, False: 571]
  ------------------
  241|      0|						goto done;
  242|    571|					break;
  243|    571|				case -1:
  ------------------
  |  Branch (243:5): [True: 0, False: 631]
  ------------------
  244|      0|					goto done;
  245|     60|				default:
  ------------------
  |  Branch (245:5): [True: 60, False: 571]
  ------------------
  246|     60|					executable = 1;
  247|     60|					break;
  248|    631|				}
  249|    631|				break;
  250|    631|			case -1:
  ------------------
  |  Branch (250:4): [True: 0, False: 660]
  ------------------
  251|      0|				goto done;
  252|     29|			default:
  ------------------
  |  Branch (252:4): [True: 29, False: 631]
  ------------------
  253|     29|				break;
  254|    660|			}
  255|    660|		}
  256|       |
  257|  2.02k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (257:7): [True: 0, False: 2.02k]
  ------------------
  258|      0|			goto done;
  259|       |
  260|  2.02k|		if (subtype) {
  ------------------
  |  Branch (260:7): [True: 0, False: 2.02k]
  ------------------
  261|      0|			if (file_printf(ms, " %s", subtype) == -1)
  ------------------
  |  Branch (261:8): [True: 0, False: 0]
  ------------------
  262|      0|				goto done;
  263|      0|		}
  264|       |
  265|  2.02k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (265:7): [True: 0, False: 2.02k]
  ------------------
  266|      0|			goto done;
  267|       |
  268|  2.02k|		if (executable)
  ------------------
  |  Branch (268:7): [True: 60, False: 1.96k]
  ------------------
  269|     60|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (269:8): [True: 0, False: 60]
  ------------------
  270|      0|				goto done;
  271|       |
  272|  2.02k|		if (has_long_lines)
  ------------------
  |  Branch (272:7): [True: 172, False: 1.85k]
  ------------------
  273|    172|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (273:8): [True: 0, False: 172]
  ------------------
  274|    172|			    SIZE_T_FORMAT "u)", has_long_lines) == -1)
  275|      0|				goto done;
  276|       |
  277|       |		/*
  278|       |		 * Only report line terminators if we find one other than LF,
  279|       |		 * or if we find none at all.
  280|       |		 */
  281|  2.02k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (281:8): [True: 1.99k, False: 33]
  |  Branch (281:23): [True: 1.93k, False: 64]
  |  Branch (281:36): [True: 1.87k, False: 54]
  |  Branch (281:50): [True: 1.76k, False: 109]
  ------------------
  282|  1.91k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (282:8): [True: 33, False: 227]
  |  Branch (282:23): [True: 64, False: 163]
  |  Branch (282:36): [True: 54, False: 109]
  ------------------
  283|  1.91k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (283:8): [True: 0, False: 1.91k]
  ------------------
  284|      0|				goto done;
  285|       |
  286|  1.91k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (286:8): [True: 1.88k, False: 33]
  |  Branch (286:23): [True: 1.82k, False: 64]
  ------------------
  287|  1.82k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (287:8): [True: 1.76k, False: 54]
  |  Branch (287:22): [True: 1.76k, False: 0]
  ------------------
  288|  1.76k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (288:9): [True: 0, False: 1.76k]
  ------------------
  289|      0|					goto done;
  290|  1.76k|			} else {
  291|    151|				if (n_crlf) {
  ------------------
  |  Branch (291:9): [True: 33, False: 118]
  ------------------
  292|     33|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (292:10): [True: 0, False: 33]
  ------------------
  293|      0|						goto done;
  294|     33|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (294:10): [True: 15, False: 18]
  |  Branch (294:18): [True: 4, False: 14]
  |  Branch (294:26): [True: 3, False: 11]
  ------------------
  295|     22|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (295:11): [True: 0, False: 22]
  ------------------
  296|      0|							goto done;
  297|     33|				}
  298|    151|				if (n_cr) {
  ------------------
  |  Branch (298:9): [True: 79, False: 72]
  ------------------
  299|     79|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (299:10): [True: 0, False: 79]
  ------------------
  300|      0|						goto done;
  301|     79|					if (n_lf || n_nel)
  ------------------
  |  Branch (301:10): [True: 16, False: 63]
  |  Branch (301:18): [True: 5, False: 58]
  ------------------
  302|     21|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (302:11): [True: 0, False: 21]
  ------------------
  303|      0|							goto done;
  304|     79|				}
  305|    151|				if (n_lf) {
  ------------------
  |  Branch (305:9): [True: 25, False: 126]
  ------------------
  306|     25|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (306:10): [True: 0, False: 25]
  ------------------
  307|      0|						goto done;
  308|     25|					if (n_nel)
  ------------------
  |  Branch (308:10): [True: 5, False: 20]
  ------------------
  309|      5|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (309:11): [True: 0, False: 5]
  ------------------
  310|      0|							goto done;
  311|     25|				}
  312|    151|				if (n_nel)
  ------------------
  |  Branch (312:9): [True: 62, False: 89]
  ------------------
  313|     62|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (313:10): [True: 0, False: 62]
  ------------------
  314|      0|						goto done;
  315|    151|			}
  316|       |
  317|  1.91k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (317:8): [True: 0, False: 1.91k]
  ------------------
  318|      0|				goto done;
  319|  1.91k|		}
  320|       |
  321|  2.02k|		if (has_escapes)
  ------------------
  |  Branch (321:7): [True: 21, False: 2.00k]
  ------------------
  322|     21|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (322:8): [True: 0, False: 21]
  ------------------
  323|      0|				goto done;
  324|  2.02k|		if (has_backspace)
  ------------------
  |  Branch (324:7): [True: 34, False: 1.99k]
  ------------------
  325|     34|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (325:8): [True: 0, False: 34]
  ------------------
  326|      0|				goto done;
  327|  2.02k|	}
  328|  2.02k|	rv = 1;
  329|  2.12k|done:
  330|  2.12k|	free(utf8_buf);
  331|       |
  332|  2.12k|	return rv;
  333|  2.02k|}
ascmagic.c:trim_nuls:
   63|  15.1k|{
   64|   154M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 154M, False: 206]
  |  Branch (64:23): [True: 154M, False: 14.9k]
  ------------------
   65|   154M|		nbytes--;
   66|       |
   67|  15.1k|	return nbytes;
   68|  15.1k|}
ascmagic.c:encode_utf8:
  341|  2.02k|{
  342|  2.02k|	size_t i;
  343|  2.02k|	unsigned char *end = buf + len;
  344|       |
  345|  8.38M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (345:14): [True: 8.38M, False: 1.95k]
  ------------------
  346|  8.38M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (346:7): [True: 5.08M, False: 3.29M]
  ------------------
  347|  5.08M|			if (end - buf < 1)
  ------------------
  |  Branch (347:8): [True: 0, False: 5.08M]
  ------------------
  348|      0|				return NULL;
  349|  5.08M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  452|  5.08M|#define CAST(T, b)	((T)(b))
  ------------------
  350|  5.08M|			continue;
  351|  5.08M|		} 
  352|  3.29M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (352:7): [True: 3.05M, False: 244k]
  ------------------
  353|  3.05M|			if (end - buf < 2)
  ------------------
  |  Branch (353:8): [True: 0, False: 3.05M]
  ------------------
  354|      0|				return NULL;
  355|  3.05M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  452|  3.05M|#define CAST(T, b)	((T)(b))
  ------------------
  356|  3.05M|			goto out1;
  357|  3.05M|		}
  358|   244k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (358:7): [True: 148k, False: 96.8k]
  ------------------
  359|   148k|			if (end - buf < 3)
  ------------------
  |  Branch (359:8): [True: 0, False: 148k]
  ------------------
  360|      0|				return NULL;
  361|   148k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  452|   148k|#define CAST(T, b)	((T)(b))
  ------------------
  362|   148k|			goto out2;
  363|   148k|		}
  364|  96.8k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (364:7): [True: 7.88k, False: 88.9k]
  ------------------
  365|  7.88k|			if (end - buf < 4)
  ------------------
  |  Branch (365:8): [True: 0, False: 7.88k]
  ------------------
  366|      0|				return NULL;
  367|  7.88k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  452|  7.88k|#define CAST(T, b)	((T)(b))
  ------------------
  368|  7.88k|			goto out3;
  369|  7.88k|		}
  370|  88.9k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (370:7): [True: 58.5k, False: 30.3k]
  ------------------
  371|  58.5k|			if (end - buf < 5)
  ------------------
  |  Branch (371:8): [True: 0, False: 58.5k]
  ------------------
  372|      0|				return NULL;
  373|  58.5k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  452|  58.5k|#define CAST(T, b)	((T)(b))
  ------------------
  374|  58.5k|			goto out4;
  375|  58.5k|		} 
  376|  30.3k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (376:7): [True: 30.2k, False: 68]
  ------------------
  377|  30.2k|			if (end - buf < 6)
  ------------------
  |  Branch (377:8): [True: 0, False: 30.2k]
  ------------------
  378|      0|				return NULL;
  379|  30.2k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  452|  30.2k|#define CAST(T, b)	((T)(b))
  ------------------
  380|  30.2k|			goto out5;
  381|  30.2k|		} 
  382|       |		/* Invalid character */
  383|     68|		return NULL;
  384|  30.2k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  452|  30.2k|#define CAST(T, b)	((T)(b))
  ------------------
  385|  88.8k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  452|  88.8k|#define CAST(T, b)	((T)(b))
  ------------------
  386|  96.7k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  452|  96.7k|#define CAST(T, b)	((T)(b))
  ------------------
  387|   244k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  452|   244k|#define CAST(T, b)	((T)(b))
  ------------------
  388|  3.29M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  452|  3.29M|#define CAST(T, b)	((T)(b))
  ------------------
  389|  3.29M|	}
  390|       |
  391|  1.95k|	return buf;
  392|  2.02k|}

buffer_init:
   42|  97.3M|{
   43|  97.3M|	b->fd = fd;
   44|  97.3M|	if (st)
  ------------------
  |  Branch (44:6): [True: 12.4k, False: 97.3M]
  ------------------
   45|  12.4k|		memcpy(&b->st, st, sizeof(b->st));
   46|  97.3M|	else if (b->fd == -1 || fstat(b->fd, &b->st) == -1)
  ------------------
  |  Branch (46:11): [True: 97.3M, False: 0]
  |  Branch (46:26): [True: 0, False: 0]
  ------------------
   47|  97.3M|		memset(&b->st, 0, sizeof(b->st));
   48|  97.3M|	b->fbuf = data;
   49|  97.3M|	b->flen = len;
   50|  97.3M|	b->eoff = 0;
   51|       |	b->ebuf = NULL;
   52|  97.3M|	b->elen = 0;
   53|  97.3M|}
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|   290k|{
   66|   290k|	struct buffer *b = CCAST(struct buffer *, bb);
  ------------------
  |  |  454|   290k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
   67|       |
   68|   290k|	if (b->elen != 0)
  ------------------
  |  Branch (68:6): [True: 206k, False: 83.7k]
  ------------------
   69|   206k|		return b->elen == FILE_BADSIZE ? -1 : 0;
  ------------------
  |  |  175|   206k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|   206k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (69:10): [True: 0, False: 206k]
  ------------------
   70|       |
   71|       |	// Nothing to refill, everything is in memory
   72|  83.7k|	if (b->fd == -1)
  ------------------
  |  Branch (72:6): [True: 59.7k, False: 24.0k]
  ------------------
   73|  59.7k|		return 0;
   74|       |
   75|  24.0k|	if (!S_ISREG(b->st.st_mode))
  ------------------
  |  Branch (75:6): [True: 0, False: 24.0k]
  ------------------
   76|      0|		goto out;
   77|       |
   78|  24.0k|	b->elen = CAST(size_t, b->st.st_size) < b->flen ?
  ------------------
  |  |  452|  24.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (78:12): [True: 0, False: 24.0k]
  ------------------
   79|  24.0k|	    CAST(size_t, b->st.st_size) : b->flen;
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
   80|  24.0k|	if (b->elen == 0) {
  ------------------
  |  Branch (80:6): [True: 1.48k, False: 22.5k]
  ------------------
   81|  1.48k|		free(b->ebuf);
   82|  1.48k|		b->ebuf = NULL;
   83|  1.48k|		return 0;
   84|  1.48k|	}
   85|  22.5k|	if ((b->ebuf = malloc(b->elen)) == NULL)
  ------------------
  |  Branch (85:6): [True: 0, False: 22.5k]
  ------------------
   86|      0|		goto out;
   87|       |
   88|  22.5k|	b->eoff = b->st.st_size - b->elen;
   89|  22.5k|	if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
  ------------------
  |  Branch (89:6): [True: 0, False: 22.5k]
  ------------------
   90|      0|		free(b->ebuf);
   91|      0|		b->ebuf = NULL;
   92|      0|		goto out;
   93|      0|	}
   94|       |
   95|  22.5k|	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|  22.5k|}

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

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

file_zmagic:
  284|  15.1k|{
  285|  15.1k|	unsigned char *newbuf = NULL;
  286|  15.1k|	size_t i, nsz;
  287|  15.1k|	char *rbuf;
  288|  15.1k|	file_pushbuf_t *pb;
  289|  15.1k|	int urv, prv, rv = 0;
  290|  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 */
  |  |  ------------------
  ------------------
  291|  15.1k|	int fd = b->fd;
  292|  15.1k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  15.1k|#define CAST(T, b)	((T)(b))
  ------------------
  293|  15.1k|	size_t nbytes = b->flen;
  294|  15.1k|	int sa_saved = 0;
  295|  15.1k|	struct sigaction sig_act;
  296|       |
  297|  15.1k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  15.1k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (297:6): [True: 4.62k, False: 10.5k]
  ------------------
  298|  4.62k|		return 0;
  299|       |
  300|   168k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (300:14): [True: 157k, False: 10.5k]
  ------------------
  301|   157k|		int zm;
  302|   157k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  452|   157k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (302:7): [True: 6.63k, False: 151k]
  ------------------
  303|  6.63k|			continue;
  304|   151k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (304:7): [True: 18.3k, False: 132k]
  ------------------
  305|  18.3k|			zm = (*compr[i].u.func)(buf);
  306|   132k|		} else {
  307|   132k|			zm = memcmp(buf, compr[i].u.magic,
  308|   132k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  452|   132k|#define CAST(T, b)	((T)(b))
  ------------------
  309|   132k|		}
  310|       |
  311|   151k|		if (!zm)
  ------------------
  |  Branch (311:7): [True: 148k, False: 2.43k]
  ------------------
  312|   148k|			continue;
  313|       |
  314|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  315|  2.43k|		if (!sa_saved) {
  ------------------
  |  Branch (315:7): [True: 2.09k, False: 345]
  ------------------
  316|       |			//We can use sig_act for both new and old, but
  317|  2.09k|			struct sigaction new_act;
  318|  2.09k|			memset(&new_act, 0, sizeof(new_act));
  319|  2.09k|			new_act.sa_handler = SIG_IGN;
  320|  2.09k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  321|  2.09k|		}
  322|       |
  323|  2.43k|		nsz = nbytes;
  324|  2.43k|		free(newbuf);
  325|  2.43k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  326|  2.43k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  2.43k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  327|  2.43k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  328|  2.43k|		    (char *)newbuf, nsz);
  329|  2.43k|		switch (urv) {
  330|  2.25k|		case OKDATA:
  ------------------
  |  |  224|  2.25k|#define OKDATA 	0
  ------------------
  |  Branch (330:3): [True: 2.25k, False: 181]
  ------------------
  331|  2.43k|		case ERRDATA:
  ------------------
  |  |  226|  2.43k|#define ERRDATA	2
  ------------------
  |  Branch (331:3): [True: 181, False: 2.25k]
  ------------------
  332|  2.43k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  2.43k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  333|  2.43k|			if (urv == ERRDATA)
  ------------------
  |  |  226|  2.43k|#define ERRDATA	2
  ------------------
  |  Branch (333:8): [True: 181, False: 2.25k]
  ------------------
  334|    181|				prv = format_decompression_error(ms, i, newbuf);
  335|  2.25k|			else
  336|  2.25k|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  337|  2.25k|				    nsz);
  338|  2.43k|			if (prv == -1)
  ------------------
  |  Branch (338:8): [True: 0, False: 2.43k]
  ------------------
  339|      0|				goto error;
  340|  2.43k|			rv = 1;
  341|  2.43k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  2.43k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (341:8): [True: 0, False: 2.43k]
  ------------------
  342|      0|				goto out;
  343|  2.43k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  4.87k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.43k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.43k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (343:8): [True: 2.43k, False: 0]
  |  Branch (343:30): [True: 0, False: 2.43k]
  ------------------
  344|      0|				goto out;
  345|  2.43k|			if ((file_printf(ms,
  ------------------
  |  Branch (345:8): [True: 0, False: 2.43k]
  ------------------
  346|  2.43k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (346:8): [True: 0, False: 2.43k]
  ------------------
  347|      0|				goto error;
  348|  2.43k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (348:8): [True: 44, False: 2.39k]
  ------------------
  349|     44|				goto error;
  350|       |			/*
  351|       |			 * XXX: If file_buffer fails here, we overwrite
  352|       |			 * the compressed text. FIXME.
  353|       |			 */
  354|  2.39k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (354:8): [True: 0, False: 2.39k]
  ------------------
  355|      0|			{
  356|      0|				if (file_pop_buffer(ms, pb) != NULL)
  ------------------
  |  Branch (356:9): [True: 0, False: 0]
  ------------------
  357|      0|					abort();
  358|      0|				goto error;
  359|      0|			}
  360|  2.39k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (360:8): [True: 2.39k, False: 0]
  ------------------
  361|  2.39k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (361:9): [True: 3, False: 2.39k]
  ------------------
  362|      3|					free(rbuf);
  363|      3|					goto error;
  364|      3|				}
  365|  2.39k|				free(rbuf);
  366|  2.39k|			}
  367|  2.39k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (367:8): [True: 2.39k, False: 0]
  |  Branch (367:17): [True: 0, False: 2.39k]
  ------------------
  368|      0|				goto error;
  369|       |			/*FALLTHROUGH*/
  370|  2.39k|		case NODATA:
  ------------------
  |  |  225|  2.39k|#define NODATA	1
  ------------------
  |  Branch (370:3): [True: 0, False: 2.43k]
  ------------------
  371|  2.39k|			break;
  372|      0|		default:
  ------------------
  |  Branch (372:3): [True: 0, False: 2.43k]
  ------------------
  373|      0|			abort();
  374|       |			/*NOTREACHED*/
  375|     47|		error:
  376|     47|			rv = -1;
  377|     47|			break;
  378|  2.43k|		}
  379|  2.43k|	}
  380|  10.5k|out:
  381|  10.5k|	DPRINTF("rv = %d\n", rv);
  382|       |
  383|  10.5k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (383:6): [True: 2.09k, False: 8.42k]
  |  Branch (383:18): [True: 2.09k, False: 0]
  ------------------
  384|  2.09k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  385|       |
  386|  10.5k|	free(newbuf);
  387|  10.5k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  10.5k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  388|  10.5k|	DPRINTF("Zmagic returns %d\n", rv);
  389|  10.5k|	return rv;
  390|  10.5k|}
sread:
  422|  4.65k|{
  423|  4.65k|	ssize_t rv;
  424|  4.65k|#if defined(FIONREAD) && !defined(__MINGW32__)
  425|  4.65k|	int t = 0;
  426|  4.65k|#endif
  427|  4.65k|	size_t rn = n;
  428|       |
  429|  4.65k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (429:6): [True: 0, False: 4.65k]
  ------------------
  430|      0|		goto nocheck;
  431|       |
  432|  4.65k|#if defined(FIONREAD) && !defined(__MINGW32__)
  433|  4.65k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (433:6): [True: 0, False: 4.65k]
  |  Branch (433:20): [True: 0, False: 0]
  |  Branch (433:53): [True: 0, False: 0]
  ------------------
  434|      0|#ifdef FD_ZERO
  435|      0|		ssize_t cnt;
  436|      0|		for (cnt = 0;; cnt++) {
  437|      0|			fd_set check;
  438|      0|			struct timeval tout = {0, 100 * 1000};
  439|      0|			int selrv;
  440|       |
  441|      0|			FD_ZERO(&check);
  ------------------
  |  Branch (441:4): [Folded, False: 0]
  ------------------
  442|      0|			FD_SET(fd, &check);
  443|       |
  444|       |			/*
  445|       |			 * Avoid soft deadlock: do not read if there
  446|       |			 * is nothing to read from sockets and pipes.
  447|       |			 */
  448|      0|			selrv = select(fd + 1, &check, NULL, NULL, &tout);
  449|      0|			if (selrv == -1) {
  ------------------
  |  Branch (449:8): [True: 0, False: 0]
  ------------------
  450|      0|				if (errno == EINTR || errno == EAGAIN)
  ------------------
  |  Branch (450:9): [True: 0, False: 0]
  |  Branch (450:27): [True: 0, False: 0]
  ------------------
  451|      0|					continue;
  452|      0|			} else if (selrv == 0 && cnt >= 5) {
  ------------------
  |  Branch (452:15): [True: 0, False: 0]
  |  Branch (452:29): [True: 0, False: 0]
  ------------------
  453|      0|				return 0;
  454|      0|			} else
  455|      0|				break;
  456|      0|		}
  457|      0|#endif
  458|      0|		(void)ioctl(fd, FIONREAD, &t);
  459|      0|	}
  460|       |
  461|  4.65k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (461:6): [True: 0, False: 4.65k]
  |  Branch (461:15): [True: 0, False: 0]
  ------------------
  462|      0|		n = t;
  463|      0|		rn = n;
  464|      0|	}
  465|  4.65k|#endif
  466|       |
  467|  4.65k|nocheck:
  468|  4.65k|	do
  469|   107k|		switch ((rv = read(fd, buf, n))) {
  470|      0|		case -1:
  ------------------
  |  Branch (470:3): [True: 0, False: 107k]
  ------------------
  471|      0|			if (errno == EINTR)
  ------------------
  |  Branch (471:8): [True: 0, False: 0]
  ------------------
  472|      0|				continue;
  473|      0|			return -1;
  474|  4.58k|		case 0:
  ------------------
  |  Branch (474:3): [True: 4.58k, False: 103k]
  ------------------
  475|  4.58k|			return rn - n;
  476|   103k|		default:
  ------------------
  |  Branch (476:3): [True: 103k, False: 4.58k]
  ------------------
  477|   103k|			n -= rv;
  478|   103k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  452|   103k|#define CAST(T, b)	((T)(b))
  ------------------
  479|   103k|			break;
  480|   107k|		}
  481|   103k|	while (n > 0);
  ------------------
  |  Branch (481:9): [True: 103k, False: 70]
  ------------------
  482|     70|	return rn;
  483|  4.65k|}
compress.c:lzmacmp:
  145|  7.86k|{
  146|  7.86k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (146:6): [True: 7.84k, False: 19]
  |  Branch (146:24): [True: 7, False: 12]
  |  Branch (146:34): [True: 1, False: 11]
  ------------------
  147|  7.85k|		return 0;
  148|     11|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (148:6): [True: 10, False: 1]
  |  Branch (148:17): [True: 8, False: 2]
  ------------------
  149|      8|		return 0;
  150|      3|	return 1;
  151|     11|}
compress.c:zlibcmp:
  127|  10.5k|{
  128|  10.5k|	unsigned short x = 1;
  129|  10.5k|	unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  130|       |
  131|  10.5k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (131:6): [True: 10.3k, False: 188]
  |  Branch (131:29): [True: 24, False: 164]
  ------------------
  132|  10.3k|		return 0;
  133|    164|	if (s[0] != 1)	/* endianness test */
  ------------------
  |  Branch (133:6): [True: 0, False: 164]
  ------------------
  134|      0|		x = buf[0] | (buf[1] << 8);
  135|    164|	else
  136|    164|		x = buf[1] | (buf[0] << 8);
  137|    164|	if (x % 31)
  ------------------
  |  Branch (137:6): [True: 143, False: 21]
  ------------------
  138|    143|		return 0;
  139|     21|	return 1;
  140|    164|}
compress.c:format_decompression_error:
  267|    181|{
  268|    181|	unsigned char *p;
  269|    181|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    181|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    181|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    181|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  270|       |
  271|    181|	if (!mime)
  ------------------
  |  Branch (271:6): [True: 181, False: 0]
  ------------------
  272|    181|		return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
  273|       |
  274|      0|	for (p = buf; *p; p++)
  ------------------
  |  Branch (274:16): [True: 0, False: 0]
  ------------------
  275|      0|		if (!isalnum(*p))
  ------------------
  |  Branch (275:7): [True: 0, False: 0]
  ------------------
  276|      0|			*p = '-';
  277|       |
  278|      0|	return file_printf(ms, "application/x-decompression-error-%s-%s",
  279|      0|	    methodname(i), buf);
  280|    181|}
compress.c:methodname:
 1054|    181|{
 1055|    181|	switch (method) {
 1056|      0|#ifdef BUILTIN_DECOMPRESS
 1057|     24|	case METH_FROZEN:
  ------------------
  |  |  193|     24|#define METH_FROZEN	2
  ------------------
  |  Branch (1057:2): [True: 24, False: 157]
  ------------------
 1058|     45|	case METH_ZLIB:
  ------------------
  |  |  200|     45|#define METH_ZLIB	14
  ------------------
  |  Branch (1058:2): [True: 21, False: 160]
  ------------------
 1059|     45|		return "zlib";
 1060|      0|#endif
 1061|      0|#ifdef BUILTIN_BZLIB
 1062|      9|	case METH_BZIP:
  ------------------
  |  |  194|      9|#define METH_BZIP	7
  ------------------
  |  Branch (1062:2): [True: 9, False: 172]
  ------------------
 1063|      9|		return "bzlib";
 1064|      0|#endif
 1065|      0|#ifdef BUILTIN_XZLIB
 1066|      1|	case METH_XZ:
  ------------------
  |  |  195|      1|#define METH_XZ		9
  ------------------
  |  Branch (1066:2): [True: 1, False: 180]
  ------------------
 1067|      4|	case METH_LZMA:
  ------------------
  |  |  199|      4|#define METH_LZMA	13
  ------------------
  |  Branch (1067:2): [True: 3, False: 178]
  ------------------
 1068|      4|		return "xzlib";
 1069|      0|#endif
 1070|      0|#ifdef BUILTIN_ZSTDLIB
 1071|      3|	case METH_ZSTD:
  ------------------
  |  |  198|      3|#define METH_ZSTD	12
  ------------------
  |  Branch (1071:2): [True: 3, False: 178]
  ------------------
 1072|      3|		return "zstd";
 1073|      0|#endif
 1074|       |#ifdef BUILTIN_LZLIB
 1075|       |	case METH_LZIP:
 1076|       |		return "lzlib";
 1077|       |#endif
 1078|       |#ifdef BUILTIN_LRZIP
 1079|       |	case METH_LRZIP:
 1080|       |		return "lrzip";
 1081|       |#endif
 1082|    120|	default:
  ------------------
  |  Branch (1082:2): [True: 120, False: 61]
  ------------------
 1083|    120|		return compr[method].argv[0];
 1084|    181|	}
 1085|    181|}
compress.c:uncompressbuf:
 1127|  2.43k|{
 1128|  2.43k|	int fdp[3][2];
 1129|  2.43k|	int status, rv, w;
 1130|  2.43k|	pid_t pid;
 1131|  2.43k|	pid_t writepid = -1;
 1132|  2.43k|	size_t i;
 1133|  2.43k|	ssize_t r, re;
 1134|  2.43k|	char *const *args;
 1135|  2.43k|#ifdef HAVE_POSIX_SPAWNP
 1136|  2.43k|	posix_spawn_file_actions_t fa;
 1137|  2.43k|#endif
 1138|  2.43k|	int (*decompress)(const unsigned char *, unsigned char **,
 1139|  2.43k|	    size_t, size_t *, int) = getdecompressor(method);
 1140|       |
 1141|  2.43k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  452|  2.43k|#define CAST(T, b)	((T)(b))
  ------------------
 1142|  2.43k|	if (*newch == NULL)
  ------------------
  |  Branch (1142:6): [True: 0, False: 2.43k]
  ------------------
 1143|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1144|       |
 1145|  2.43k|	if (decompress) {
  ------------------
  |  Branch (1145:6): [True: 61, False: 2.37k]
  ------------------
 1146|     61|		if (nofork) {
  ------------------
  |  Branch (1146:7): [True: 61, False: 0]
  ------------------
 1147|     61|			return makeerror(newch, n,
 1148|     61|			    "Fork is required to uncompress, but disabled");
 1149|     61|		}
 1150|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1151|     61|	}
 1152|       |
 1153|  2.37k|	(void)fflush(stdout);
 1154|  2.37k|	(void)fflush(stderr);
 1155|       |
 1156|  9.50k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  9.50k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1156:14): [True: 7.12k, False: 2.37k]
  ------------------
 1157|  7.12k|		fdp[i][0] = fdp[i][1] = -1;
 1158|       |
 1159|       |	/*
 1160|       |	 * There are multithreaded users who run magic_file()
 1161|       |	 * from dozens of threads. If two parallel magic_file() calls
 1162|       |	 * analyze two large compressed files, both will spawn
 1163|       |	 * an uncompressing child here, which writes out uncompressed data.
 1164|       |	 * We read some portion, then close the pipe, then waitpid() the child.
 1165|       |	 * If uncompressed data is larger, child should get EPIPE and exit.
 1166|       |	 * However, with *parallel* calls OTHER child may unintentionally
 1167|       |	 * inherit pipe fds, thus keeping pipe open and making writes in
 1168|       |	 * our child block instead of failing with EPIPE!
 1169|       |	 * (For the bug to occur, two threads must mutually inherit their pipes,
 1170|       |	 * and both must have large outputs. Thus it happens not that often).
 1171|       |	 * To avoid this, be sure to create pipes with O_CLOEXEC.
 1172|       |	 */
 1173|  2.37k|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1173:7): [True: 0, False: 2.37k]
  |  Branch (1173:19): [True: 0, False: 0]
  ------------------
 1174|  2.37k|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1174:6): [True: 0, False: 2.37k]
  ------------------
 1175|  2.37k|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1175:6): [True: 0, False: 2.37k]
  ------------------
 1176|      0|		closep(fdp[STDIN_FILENO]);
 1177|      0|		closep(fdp[STDOUT_FILENO]);
 1178|      0|		return makeerror(newch, n, "Cannot create pipe, %s",
 1179|      0|		    strerror(errno));
 1180|      0|	}
 1181|       |
 1182|  2.37k|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  453|  2.37k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1183|  2.37k|#ifdef HAVE_POSIX_SPAWNP
 1184|  2.37k|	posix_spawn_file_actions_init(&fa);
 1185|       |
 1186|  2.37k|	handledesc(&fa, fd, fdp);
 1187|       |
 1188|  2.37k|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1189|  2.37k|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1190|  2.37k|	    args, NULL);
 1191|       |
 1192|  2.37k|	posix_spawn_file_actions_destroy(&fa);
 1193|       |
 1194|  2.37k|	if (status != 0) {
  ------------------
  |  Branch (1194:6): [True: 13, False: 2.36k]
  ------------------
 1195|     13|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1196|     13|		    compr[method].argv[0], strerror(status));
 1197|     13|	}
 1198|       |#else
 1199|       |	/* For processes with large mapped virtual sizes, vfork
 1200|       |	 * may be _much_ faster (10-100 times) than fork.
 1201|       |	 */
 1202|       |	pid = vfork();
 1203|       |	if (pid == -1) {
 1204|       |		return makeerror(newch, n, "Cannot vfork, %s",
 1205|       |		    strerror(errno));
 1206|       |	}
 1207|       |	if (pid == 0) {
 1208|       |		/* child */
 1209|       |		/* Note: we are after vfork, do not modify memory
 1210|       |		 * in a way which confuses parent. In particular,
 1211|       |		 * do not modify fdp[i][j].
 1212|       |		 */
 1213|       |		handledesc(NULL, fd, fdp);
 1214|       |		DPRINTF("Executing %s\n", compr[method].argv[0]);
 1215|       |
 1216|       |		(void)execvp(compr[method].argv[0], args);
 1217|       |		dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 1218|       |		    compr[method].argv[0], strerror(errno));
 1219|       |		_exit(EXIT_FAILURE); /* _exit(), not exit(), because of vfork */
 1220|       |	}
 1221|       |#endif
 1222|       |	/* parent */
 1223|       |	/* Close write sides of child stdout/err pipes */
 1224|  7.08k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  7.08k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1224:14): [True: 4.72k, False: 2.36k]
  ------------------
 1225|  4.72k|		closefd(fdp[i], 1);
 1226|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1227|  2.36k|	if (fd == -1) {
  ------------------
  |  Branch (1227:6): [True: 0, False: 2.36k]
  ------------------
 1228|      0|		closefd(fdp[STDIN_FILENO], 0);
 1229|      0|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1230|      0|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1230:7): [True: 0, False: 0]
  ------------------
 1231|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1232|      0|			    strerror(errno));
 1233|      0|			DPRINTF("Write to child failed\n");
 1234|      0|			goto err;
 1235|      0|		}
 1236|      0|		closefd(fdp[STDIN_FILENO], 1);
 1237|      0|	}
 1238|       |
 1239|  2.36k|	rv = OKDATA;
  ------------------
  |  |  224|  2.36k|#define OKDATA 	0
  ------------------
 1240|  2.36k|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1241|  2.36k|	DPRINTF("read got %zd\n", r);
 1242|  2.36k|	if (r < 0) {
  ------------------
  |  Branch (1242:6): [True: 0, False: 2.36k]
  ------------------
 1243|      0|		rv = ERRDATA;
  ------------------
  |  |  226|      0|#define ERRDATA	2
  ------------------
 1244|      0|		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
 1245|      0|		        strerror(errno));
 1246|      0|		goto err;
 1247|      0|	} 
 1248|  2.36k|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  452|  2.36k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1248:6): [True: 70, False: 2.29k]
  ------------------
 1249|       |		/*
 1250|       |		 * close fd so that the child exits with sigpipe and ignore
 1251|       |		 * errors, otherwise we risk the child blocking and never
 1252|       |		 * exiting.
 1253|       |		 */
 1254|     70|		DPRINTF("Closing stdout for bytes_max\n");
 1255|     70|		closefd(fdp[STDOUT_FILENO], 0);
 1256|     70|		goto ok;
 1257|     70|	}
 1258|  2.29k|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1258:6): [True: 107, False: 2.18k]
  ------------------
 1259|    107|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1260|    107|		rv = ERRDATA;
  ------------------
  |  |  226|    107|#define ERRDATA	2
  ------------------
 1261|    107|		r = filter_error(*newch, r);
 1262|    107|		goto ok;
 1263|    107|	}
 1264|  2.18k|	if  (re == 0)
  ------------------
  |  Branch (1264:7): [True: 2.18k, False: 0]
  ------------------
 1265|  2.18k|		goto ok;
 1266|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1267|      0|	    strerror(errno));
 1268|      0|	goto err;
 1269|  2.36k|ok:
 1270|  2.36k|	*n = r;
 1271|       |	/* NUL terminate, as every buffer is handled here. */
 1272|  2.36k|	(*newch)[*n] = '\0';
 1273|  2.36k|err:
 1274|  2.36k|	closefd(fdp[STDIN_FILENO], 1);
 1275|  2.36k|	closefd(fdp[STDOUT_FILENO], 0);
 1276|  2.36k|	closefd(fdp[STDERR_FILENO], 0);
 1277|       |
 1278|  2.36k|	w = waitpid(pid, &status, 0);
 1279|  2.36k|wait_err:
 1280|  2.36k|	if (w == -1) {
  ------------------
  |  Branch (1280:6): [True: 0, False: 2.36k]
  ------------------
 1281|      0|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1282|      0|		DPRINTF("Child wait return %#x\n", status);
 1283|  2.36k|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1283:13): [True: 0, False: 2.36k]
  ------------------
 1284|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1285|  2.36k|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1285:13): [True: 177, False: 2.18k]
  ------------------
 1286|    177|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1287|    177|	}
 1288|  2.36k|	if (writepid > 0) {
  ------------------
  |  Branch (1288:6): [True: 0, False: 2.36k]
  ------------------
 1289|       |		/* _After_ we know decompressor has exited, our input writer
 1290|       |		 * definitely will exit now (at worst, writing fails in it,
 1291|       |		 * since output fd is closed now on the reading size).
 1292|       |		 */
 1293|      0|		w = waitpid(writepid, &status, 0);
 1294|      0|		writepid = -1;
 1295|      0|		goto wait_err;
 1296|      0|	}
 1297|       |
 1298|  2.36k|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1299|  2.36k|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1300|       |
 1301|  2.36k|	return rv;
 1302|  2.36k|}
compress.c:getdecompressor:
 1090|  2.43k|{
 1091|  2.43k|	switch (method) {
 1092|      0|#ifdef BUILTIN_DECOMPRESS
 1093|     24|	case METH_FROZEN:
  ------------------
  |  |  193|     24|#define METH_FROZEN	2
  ------------------
  |  Branch (1093:2): [True: 24, False: 2.41k]
  ------------------
 1094|     24|		return uncompressgzipped;
 1095|     21|	case METH_ZLIB:
  ------------------
  |  |  200|     21|#define METH_ZLIB	14
  ------------------
  |  Branch (1095:2): [True: 21, False: 2.41k]
  ------------------
 1096|     21|		return uncompresszlib;
 1097|      0|#endif
 1098|      0|#ifdef BUILTIN_BZLIB
 1099|      9|	case METH_BZIP:
  ------------------
  |  |  194|      9|#define METH_BZIP	7
  ------------------
  |  Branch (1099:2): [True: 9, False: 2.42k]
  ------------------
 1100|      9|		return uncompressbzlib;
 1101|      0|#endif
 1102|      0|#ifdef BUILTIN_XZLIB
 1103|      1|	case METH_XZ:
  ------------------
  |  |  195|      1|#define METH_XZ		9
  ------------------
  |  Branch (1103:2): [True: 1, False: 2.43k]
  ------------------
 1104|      4|	case METH_LZMA:
  ------------------
  |  |  199|      4|#define METH_LZMA	13
  ------------------
  |  Branch (1104:2): [True: 3, False: 2.43k]
  ------------------
 1105|      4|		return uncompressxzlib;
 1106|      0|#endif
 1107|      0|#ifdef BUILTIN_ZSTDLIB
 1108|      3|	case METH_ZSTD:
  ------------------
  |  |  198|      3|#define METH_ZSTD	12
  ------------------
  |  Branch (1108:2): [True: 3, False: 2.43k]
  ------------------
 1109|      3|		return uncompresszstd;
 1110|      0|#endif
 1111|       |#ifdef BUILTIN_LZLIB
 1112|       |	case METH_LZIP:
 1113|       |		return uncompresslzlib;
 1114|       |#endif
 1115|       |#ifdef BUILTIN_LRZIP
 1116|       |	case METH_LRZIP:
 1117|       |		return uncompresslrzip;
 1118|       |#endif
 1119|  2.37k|	default:
  ------------------
  |  Branch (1119:2): [True: 2.37k, False: 61]
  ------------------
 1120|       |		return NULL;
 1121|  2.43k|	}
 1122|  2.43k|}
compress.c:makeerror:
  903|     74|{
  904|     74|	char *msg;
  905|     74|	va_list ap;
  906|     74|	int rv;
  907|       |
  908|     74|	DPRINTF("Makeerror %s\n", fmt);
  909|     74|	free(*buf);
  910|     74|	va_start(ap, fmt);
  911|     74|	rv = vasprintf(&msg, fmt, ap);
  912|     74|	va_end(ap);
  913|     74|	if (rv < 0) {
  ------------------
  |  Branch (913:6): [True: 0, False: 74]
  ------------------
  914|      0|		DPRINTF("Makeerror failed");
  915|      0|		*buf = NULL;
  916|      0|		*len = 0;
  917|      0|		return NODATA;
  ------------------
  |  |  225|      0|#define NODATA	1
  ------------------
  918|      0|	}
  919|     74|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  453|     74|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  920|     74|	*len = strlen(msg);
  921|     74|	return ERRDATA;
  ------------------
  |  |  226|     74|#define ERRDATA	2
  ------------------
  922|     74|}
compress.c:handledesc:
  972|  2.37k|{
  973|  2.37k|	if (fd != -1) {
  ------------------
  |  Branch (973:6): [True: 2.37k, False: 0]
  ------------------
  974|  2.37k|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  452|  2.37k|#define CAST(T, b)	((T)(b))
  ------------------
  975|  2.37k|		movedesc(v, STDIN_FILENO, fd);
  976|  2.37k|	} else {
  977|      0|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
  978|      0|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (978:7): [True: 0, False: 0]
  ------------------
  979|      0|		    closedesc(v, fdp[STDIN_FILENO][1]);
  980|      0|	}
  981|       |
  982|  2.37k|	file_clear_closexec(STDIN_FILENO);
  983|       |
  984|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
  985|  2.37k|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
  986|  2.37k|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (986:6): [True: 2.37k, False: 0]
  ------------------
  987|  2.37k|		closedesc(v, fdp[STDOUT_FILENO][0]);
  988|       |
  989|  2.37k|	file_clear_closexec(STDOUT_FILENO);
  990|       |
  991|  2.37k|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
  992|  2.37k|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (992:6): [True: 2.37k, False: 0]
  ------------------
  993|  2.37k|		closedesc(v, fdp[STDERR_FILENO][0]);
  994|       |
  995|       |	file_clear_closexec(STDERR_FILENO);
  996|  2.37k|}
compress.c:movedesc:
  943|  7.12k|{
  944|  7.12k|	if (fd == i)
  ------------------
  |  Branch (944:6): [True: 0, False: 7.12k]
  ------------------
  945|      0|		return; /* "no dup was necessary" */
  946|  7.12k|#ifdef HAVE_POSIX_SPAWNP
  947|  7.12k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  453|  7.12k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  948|  7.12k|	posix_spawn_file_actions_adddup2(fa, fd, i);
  949|  7.12k|	posix_spawn_file_actions_addclose(fa, fd);
  950|       |#else
  951|       |	if (dup2(fd, i) == -1) {
  952|       |		DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
  953|       |		exit(EXIT_FAILURE);
  954|       |	}
  955|       |	close(v ? fd : fd);
  956|       |#endif
  957|  7.12k|}
compress.c:closedesc:
  961|  4.75k|{
  962|  4.75k|#ifdef HAVE_POSIX_SPAWNP
  963|  4.75k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  453|  4.75k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  964|  4.75k|	posix_spawn_file_actions_addclose(fa, fd);
  965|       |#else
  966|       |	close(v ? fd : fd);
  967|       |#endif
  968|  4.75k|}
compress.c:closefd:
  926|  14.2k|{
  927|  14.2k|	if (fd[i] == -1)
  ------------------
  |  Branch (927:6): [True: 4.79k, False: 9.45k]
  ------------------
  928|  4.79k|		return;
  929|  9.45k|	(void) close(fd[i]);
  930|  9.45k|	fd[i] = -1;
  931|  9.45k|}
compress.c:filter_error:
 1026|    107|{
 1027|    107|	char *p;
 1028|    107|	char *buf;
 1029|       |
 1030|    107|	ubuf[n] = '\0';
 1031|    107|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  453|    107|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1032|    107|	while (isspace(CAST(unsigned char, *buf)))
  ------------------
  |  Branch (1032:9): [True: 30, False: 107]
  ------------------
 1033|     30|		buf++;
 1034|    107|	DPRINTF("Filter error[[[%s]]]\n", buf);
 1035|    107|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  452|    107|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1035:6): [True: 5, False: 102]
  ------------------
 1036|      5|		*p = '\0';
 1037|    107|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  452|    107|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1037:6): [True: 0, False: 107]
  ------------------
 1038|      0|		*p = '\0';
 1039|    107|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  452|    107|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1039:6): [True: 12, False: 95]
  ------------------
 1040|     12|		++p;
 1041|     12|		while (isspace(CAST(unsigned char, *p)))
  ------------------
  |  Branch (1041:10): [True: 8, False: 12]
  ------------------
 1042|      8|			p++;
 1043|     12|		n = strlen(p);
 1044|     12|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  452|     12|#define CAST(T, b)	((T)(b))
  ------------------
 1045|     12|	}
 1046|    107|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
 1047|    107|	if (islower(*ubuf))
  ------------------
  |  Branch (1047:6): [True: 9, False: 98]
  ------------------
 1048|      9|		*ubuf = toupper(*ubuf);
  ------------------
  |  Branch (1048:11): [True: 0, False: 0]
  |  Branch (1048:11): [True: 0, False: 0]
  |  Branch (1048:11): [Folded, False: 9]
  ------------------
 1049|    107|	return n;
 1050|    107|}

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: 2.85k, False: 25.9k]
  ------------------
  293|  2.85k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 2.85k]
  ------------------
  294|      0|			return -1;
  295|  2.85k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  452|  2.85k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  2.85k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  2.85k|		    ms->c.li[m->cont_level - 1].off));
  298|  2.85k|	}
  299|  28.8k|	return CAST(int32_t, offs);
  ------------------
  |  |  452|  28.8k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  28.8k|}
der_cmp:
  304|   372k|{
  305|   372k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  453|   372k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   372k|	const char *s = m->value.s;
  307|   372k|	size_t offs = 0, len = ms->search.s_len;
  308|   372k|	uint32_t tag, tlen;
  309|   372k|	char buf[128];
  310|       |
  311|   372k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   372k|	tag = gettag(b, &offs, len);
  314|   372k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   372k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|   372k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 10.0k, False: 362k]
  ------------------
  315|  10.0k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  10.0k|		return -1;
  317|  10.0k|	}
  318|       |
  319|   362k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   362k|	    offs, m->offset));
  321|       |
  322|   362k|	tlen = getlength(b, &offs, len);
  323|   362k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   362k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|   362k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 118k, False: 244k]
  ------------------
  324|   118k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   118k|		return -1;
  326|   118k|	}
  327|       |
  328|   244k|	der_tag(buf, sizeof(buf), tag);
  329|   244k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   244k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 244k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   244k|	size_t slen = strlen(buf);
  333|       |
  334|   244k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 212k, False: 31.5k]
  ------------------
  335|   212k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   212k|		return 0;
  337|   212k|	}
  338|       |
  339|  31.5k|	s += slen;
  340|       |
  341|  32.5k|again:
  342|  32.5k|	switch (*s) {
  343|  28.3k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 28.3k, False: 4.19k]
  ------------------
  344|  28.3k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  28.3k|		return 1;
  346|  1.15k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.15k, False: 31.4k]
  ------------------
  347|  1.15k|		s++;
  348|  1.15k|		goto val;
  349|  3.04k|	default:
  ------------------
  |  Branch (349:2): [True: 3.04k, False: 29.5k]
  ------------------
  350|  3.04k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 3.04k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  3.04k|		slen = 0;
  356|  3.04k|		do
  357|  4.70k|			slen = slen * 10 + *s - '0';
  358|  3.04k|		while (isdigit(CAST(unsigned char, *++s)));
  ------------------
  |  Branch (358:10): [True: 1.66k, False: 3.04k]
  ------------------
  359|  3.04k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  3.04k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 3.04k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  3.04k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 1.99k, False: 1.04k]
  ------------------
  363|  1.99k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  1.99k|			return 0;
  365|  1.99k|		}
  366|  1.04k|		goto again;
  367|  32.5k|	}
  368|  1.15k|val:
  369|  1.15k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.15k|	    tlen));
  371|  1.15k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.15k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.15k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.15k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.15k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 830, False: 321]
  |  Branch (374:29): [True: 670, False: 160]
  ------------------
  375|    670|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    670|		return 0;
  377|    670|	}
  378|    481|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    481|	DPRINTF(("%s: complete match\n", __func__));
  380|    481|	return 1;
  381|  1.15k|}
der.c:gettag:
  150|   401k|{
  151|   401k|	uint32_t tag;
  152|       |
  153|   401k|	if (*p >= l)
  ------------------
  |  Branch (153:6): [True: 1.65k, False: 400k]
  ------------------
  154|  1.65k|		return DER_BAD;
  ------------------
  |  |   62|  1.65k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  1.65k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   400k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   400k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 246k, False: 154k]
  ------------------
  159|   246k|		return tag;
  160|       |
  161|   154k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 709, False: 153k]
  ------------------
  162|    709|		return DER_BAD;
  ------------------
  |  |   62|    709|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|    709|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|   764M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 764M, False: 151k]
  ------------------
  165|   764M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|   764M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 2.27k, False: 764M]
  ------------------
  167|  2.27k|			return DER_BAD;
  ------------------
  |  |   62|  2.27k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  2.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|   764M|	}
  169|   151k|	return tag;
  170|   153k|}
der.c:getlength:
  183|   391k|{
  184|   391k|	uint8_t digits, i;
  185|   391k|	size_t len;
  186|   391k|	int is_onebyte_result;
  187|       |
  188|   391k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 3.99k, False: 387k]
  ------------------
  189|  3.99k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  3.99k|		return DER_BAD;
  ------------------
  |  |   62|  3.99k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  3.99k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  3.99k|	}
  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|   387k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   387k|	digits = c[(*p)++] & 0x7f;
  200|   387k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 98.3k, False: 289k]
  ------------------
  201|  98.3k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|  98.3k|		return DER_BAD;
  ------------------
  |  |   62|  98.3k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  98.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|  98.3k|	}
  204|       |
  205|   289k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 235k, False: 54.2k]
  ------------------
  206|   235k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  54.2k|	len = 0;
  213|  4.04M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 3.98M, False: 54.2k]
  ------------------
  214|  3.98M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  54.2k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 15.1k, False: 39.1k]
  |  Branch (216:31): [True: 1.45k, False: 37.6k]
  ------------------
  217|  16.5k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  16.5k|		    __func__, *p, len, l));
  219|  16.5k|		return DER_BAD;
  ------------------
  |  |   62|  16.5k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  452|  16.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  16.5k|	}
  221|  37.6k|	return CAST(uint32_t, len);
  ------------------
  |  |  452|  37.6k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  54.2k|}
der.c:der_tag:
  226|   244k|{
  227|   244k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   244k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 166k, False: 77.8k]
  ------------------
  228|   166k|		strlcpy(buf, der__tag[tag], len);
  229|  77.8k|	else
  230|  77.8k|		snprintf(buf, len, "%#x", tag);
  231|   244k|	return buf;
  232|   244k|}
der.c:der_data:
  237|  1.15k|{
  238|  1.15k|	uint32_t i;
  239|  1.15k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  452|  1.15k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.15k|	switch (tag) {
  241|     34|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     34|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 34, False: 1.11k]
  ------------------
  242|    102|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    102|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 68, False: 1.08k]
  ------------------
  243|    102|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    102|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 0, False: 1.15k]
  ------------------
  244|    102|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  453|    102|#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.15k]
  ------------------
  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.04k|	default:
  ------------------
  |  Branch (251:2): [True: 1.04k, False: 102]
  ------------------
  252|  1.04k|		break;
  253|  1.15k|	}
  254|       |
  255|  5.04k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 3.99k, False: 1.04k]
  ------------------
  256|  3.99k|		uint32_t z = i << 1;
  257|  3.99k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 3.87k, False: 122]
  ------------------
  258|  3.87k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  3.99k|	}
  260|  1.04k|	return len * 2;
  261|  1.15k|}

file_encoding:
   78|  28.1k|{
   79|  28.1k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  28.1k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  28.1k|	size_t nbytes = b->flen;
   81|  28.1k|	size_t mlen;
   82|  28.1k|	int rv = 1, ucs_type;
   83|  28.1k|	file_unichar_t *udefbuf;
   84|  28.1k|	size_t udeflen;
   85|       |
   86|  28.1k|	if (ubuf == NULL)
  ------------------
  |  Branch (86:6): [True: 15.1k, False: 13.0k]
  ------------------
   87|  15.1k|		ubuf = &udefbuf;
   88|  28.1k|	if (ulen == NULL)
  ------------------
  |  Branch (88:6): [True: 15.1k, False: 13.0k]
  ------------------
   89|  15.1k|		ulen = &udeflen;
   90|       |
   91|  28.1k|	*type = "text";
   92|  28.1k|	*ulen = 0;
   93|  28.1k|	*code = "unknown";
   94|  28.1k|	*code_mime = "binary";
   95|       |
   96|  28.1k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (96:6): [True: 733, False: 27.4k]
  ------------------
   97|    733|		nbytes = ms->encoding_max;
   98|       |
   99|  28.1k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  100|  28.1k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  452|  28.1k|#define CAST(T, b)	((T)(b))
  ------------------
  101|  28.1k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (101:6): [True: 0, False: 28.1k]
  ------------------
  102|      0|		file_oomem(ms, mlen);
  103|      0|		goto done;
  104|      0|	}
  105|  28.1k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (105:6): [True: 1.65k, False: 26.4k]
  ------------------
  106|  1.65k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (106:7): [True: 12, False: 1.64k]
  ------------------
  107|     12|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  108|     12|			*code = "Unicode text, UTF-7";
  109|     12|			*code_mime = "utf-7";
  110|  1.64k|		} else {
  111|  1.64k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  112|  1.64k|			*code = "ASCII";
  113|  1.64k|			*code_mime = "us-ascii";
  114|  1.64k|		}
  115|  26.4k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (115:13): [True: 7, False: 26.4k]
  ------------------
  116|      7|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  117|      7|		*code = "Unicode text, UTF-8 (with BOM)";
  118|      7|		*code_mime = "utf-8";
  119|  26.4k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (119:13): [True: 155, False: 26.3k]
  ------------------
  120|    155|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  121|    155|		*code = "Unicode text, UTF-8";
  122|    155|		*code_mime = "utf-8";
  123|  26.3k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (123:13): [True: 456, False: 25.8k]
  ------------------
  124|    456|		if (ucs_type == 1) {
  ------------------
  |  Branch (124:7): [True: 187, False: 269]
  ------------------
  125|    187|			*code = "Unicode text, UTF-32, little-endian";
  126|    187|			*code_mime = "utf-32le";
  127|    269|		} else {
  128|    269|			*code = "Unicode text, UTF-32, big-endian";
  129|    269|			*code_mime = "utf-32be";
  130|    269|		}
  131|    456|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  132|  25.8k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (132:13): [True: 366, False: 25.5k]
  ------------------
  133|    366|		if (ucs_type == 1) {
  ------------------
  |  Branch (133:7): [True: 187, False: 179]
  ------------------
  134|    187|			*code = "Unicode text, UTF-16, little-endian";
  135|    187|			*code_mime = "utf-16le";
  136|    187|		} else {
  137|    179|			*code = "Unicode text, UTF-16, big-endian";
  138|    179|			*code_mime = "utf-16be";
  139|    179|		}
  140|    366|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  141|  25.5k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (141:13): [True: 805, False: 24.6k]
  ------------------
  142|    805|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  143|    805|		*code = "ISO-8859";
  144|    805|		*code_mime = "iso-8859-1";
  145|  24.6k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (145:13): [True: 421, False: 24.2k]
  ------------------
  146|    421|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  147|    421|		*code = "Non-ISO extended-ASCII";
  148|    421|		*code_mime = "unknown-8bit";
  149|  24.2k|	} else {
  150|  24.2k|		unsigned char *nbuf;
  151|       |
  152|  24.2k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  153|  24.2k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  452|  24.2k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (153:7): [True: 0, False: 24.2k]
  ------------------
  154|      0|			file_oomem(ms, mlen);
  155|      0|			goto done;
  156|      0|		}
  157|  24.2k|		from_ebcdic(buf, nbytes, nbuf);
  158|       |
  159|  24.2k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (159:7): [True: 104, False: 24.1k]
  ------------------
  160|    104|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  161|    104|			*code = "EBCDIC";
  162|    104|			*code_mime = "ebcdic";
  163|  24.1k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (163:14): [True: 90, False: 24.0k]
  ------------------
  164|     90|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  165|     90|			    *ulen));
  166|     90|			*code = "International EBCDIC";
  167|     90|			*code_mime = "ebcdic";
  168|  24.0k|		} else { /* Doesn't look like text at all */
  169|  24.0k|			DPRINTF(("binary\n"));
  170|  24.0k|			rv = 0;
  171|  24.0k|			*type = "binary";
  172|  24.0k|		}
  173|  24.2k|		free(nbuf);
  174|  24.2k|	}
  175|       |
  176|  28.1k| done:
  177|  28.1k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (177:6): [True: 15.1k, False: 13.0k]
  ------------------
  178|  15.1k|		free(udefbuf);
  179|       |
  180|  28.1k|	return rv;
  181|  28.1k|}
file_looks_utf8:
  356|  26.5k|{
  357|  26.5k|	size_t i;
  358|  26.5k|	int n;
  359|  26.5k|	file_unichar_t c;
  360|  26.5k|	int gotone = 0, ctrl = 0;
  361|       |
  362|  26.5k|	if (ubuf)
  ------------------
  |  Branch (362:6): [True: 26.5k, False: 0]
  ------------------
  363|  26.5k|		*ulen = 0;
  364|       |
  365|  14.4M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (365:14): [True: 14.4M, False: 1.47k]
  ------------------
  366|  14.4M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (366:7): [True: 14.3M, False: 124k]
  ------------------
  367|       |			/*
  368|       |			 * Even if the whole file is valid UTF-8 sequences,
  369|       |			 * still reject it if it uses weird control characters.
  370|       |			 */
  371|       |
  372|  14.3M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  236|  14.3M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (372:8): [True: 12.7M, False: 1.51M]
  ------------------
  373|  12.7M|				ctrl = 1;
  374|       |
  375|  14.3M|			if (ubuf)
  ------------------
  |  Branch (375:8): [True: 14.3M, False: 0]
  ------------------
  376|  14.3M|				ubuf[(*ulen)++] = buf[i];
  377|  14.3M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (377:14): [True: 10.0k, False: 114k]
  ------------------
  378|  10.0k|			return -1;
  379|   114k|		} else {			   /* 11xxxxxx begins UTF-8 */
  380|   114k|			int following;
  381|   114k|			uint8_t x = first[buf[i]];
  382|   114k|			const struct accept_range *ar =
  383|   114k|			    &accept_ranges[(unsigned int)x >> 4];
  384|   114k|			if (x == XX)
  ------------------
  |  |  304|   114k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (384:8): [True: 6.02k, False: 108k]
  ------------------
  385|  6.02k|				return -1;
  386|       |
  387|   108k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (387:8): [True: 87.4k, False: 20.6k]
  ------------------
  388|  87.4k|				c = buf[i] & 0x1f;
  389|  87.4k|				following = 1;
  390|  87.4k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (390:15): [True: 19.1k, False: 1.45k]
  ------------------
  391|  19.1k|				c = buf[i] & 0x0f;
  392|  19.1k|				following = 2;
  393|  19.1k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (393:15): [True: 1.45k, False: 0]
  ------------------
  394|  1.45k|				c = buf[i] & 0x07;
  395|  1.45k|				following = 3;
  396|  1.45k|			} else if ((buf[i] & 0x04) == 0) {	/* 111110xx */
  ------------------
  |  Branch (396:15): [True: 0, False: 0]
  ------------------
  397|      0|				c = buf[i] & 0x03;
  398|      0|				following = 4;
  399|      0|			} else if ((buf[i] & 0x02) == 0) {	/* 1111110x */
  ------------------
  |  Branch (399:15): [True: 0, False: 0]
  ------------------
  400|      0|				c = buf[i] & 0x01;
  401|      0|				following = 5;
  402|      0|			} else
  403|      0|				return -1;
  404|       |
  405|   224k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (405:16): [True: 125k, False: 99.1k]
  ------------------
  406|   125k|				i++;
  407|   125k|				if (i >= nbytes)
  ------------------
  |  Branch (407:9): [True: 182, False: 125k]
  ------------------
  408|    182|					goto done;
  409|       |
  410|   125k|				if (n == 0 &&
  ------------------
  |  Branch (410:9): [True: 107k, False: 17.4k]
  ------------------
  411|   107k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (411:11): [True: 3.98k, False: 103k]
  |  Branch (411:30): [True: 4.40k, False: 99.5k]
  ------------------
  412|  8.38k|					return -1;
  413|       |
  414|   116k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (414:9): [True: 139, False: 116k]
  |  Branch (414:33): [True: 261, False: 116k]
  ------------------
  415|    400|					return -1;
  416|       |
  417|   116k|				c = (c << 6) + (buf[i] & 0x3f);
  418|   116k|			}
  419|       |
  420|  99.1k|			if (ubuf)
  ------------------
  |  Branch (420:8): [True: 99.1k, False: 0]
  ------------------
  421|  99.1k|				ubuf[(*ulen)++] = c;
  422|  99.1k|			gotone = 1;
  423|  99.1k|		}
  424|  14.4M|	}
  425|  1.65k|done:
  426|  1.65k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (426:9): [True: 1.38k, False: 266]
  |  Branch (426:21): [True: 155, False: 111]
  ------------------
  427|  26.5k|}
encoding.c:looks_ascii:
  269|  52.4k|    size_t *ulen) \
  270|  52.4k|{ \
  271|  52.4k|	size_t i; \
  272|  52.4k|\
  273|  52.4k|	*ulen = 0; \
  274|  52.4k|\
  275|  11.6M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (275:14): [True: 11.6M, False: 1.76k]
  ------------------
  276|  11.6M|		int t = text_chars[buf[i]]; \
  277|  11.6M|\
  278|  11.6M|		if (COND) \
  ------------------
  |  Branch (278:7): [True: 50.6k, False: 11.6M]
  ------------------
  279|  11.6M|			return 0; \
  280|  11.6M|\
  281|  11.6M|		ubuf[(*ulen)++] = buf[i]; \
  282|  11.6M|	} \
  283|  52.4k|	return 1; \
  284|  52.4k|}
encoding.c:looks_latin1:
  269|  49.6k|    size_t *ulen) \
  270|  49.6k|{ \
  271|  49.6k|	size_t i; \
  272|  49.6k|\
  273|  49.6k|	*ulen = 0; \
  274|  49.6k|\
  275|  4.53M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (275:14): [True: 4.53M, False: 895]
  ------------------
  276|  4.53M|		int t = text_chars[buf[i]]; \
  277|  4.53M|\
  278|  12.9M|		if (COND) \
  ------------------
  |  Branch (278:7): [True: 3.86M, False: 665k]
  |  Branch (278:7): [True: 48.7k, False: 3.81M]
  ------------------
  279|  4.53M|			return 0; \
  280|  4.53M|\
  281|  4.53M|		ubuf[(*ulen)++] = buf[i]; \
  282|  4.48M|	} \
  283|  49.6k|	return 1; \
  284|  49.6k|}
encoding.c:looks_extended:
  269|  24.6k|    size_t *ulen) \
  270|  24.6k|{ \
  271|  24.6k|	size_t i; \
  272|  24.6k|\
  273|  24.6k|	*ulen = 0; \
  274|  24.6k|\
  275|  1.57M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (275:14): [True: 1.57M, False: 421]
  ------------------
  276|  1.57M|		int t = text_chars[buf[i]]; \
  277|  1.57M|\
  278|  6.38M|		if (COND) \
  ------------------
  |  Branch (278:7): [True: 1.04M, False: 531k]
  |  Branch (278:7): [True: 620k, False: 420k]
  |  Branch (278:7): [True: 24.2k, False: 596k]
  ------------------
  279|  1.57M|			return 0; \
  280|  1.57M|\
  281|  1.57M|		ubuf[(*ulen)++] = buf[i]; \
  282|  1.54M|	} \
  283|  24.6k|	return 1; \
  284|  24.6k|}
encoding.c:looks_utf8_with_BOM:
  437|  26.4k|{
  438|  26.4k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (438:6): [True: 25.2k, False: 1.19k]
  |  Branch (438:20): [True: 132, False: 25.1k]
  |  Branch (438:38): [True: 92, False: 40]
  |  Branch (438:56): [True: 63, False: 29]
  ------------------
  439|     63|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  440|  26.4k|	else
  441|  26.4k|		return -1;
  442|  26.4k|}
encoding.c:looks_utf7:
  447|  1.65k|{
  448|  1.65k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (448:6): [True: 967, False: 692]
  |  Branch (448:20): [True: 50, False: 917]
  |  Branch (448:37): [True: 26, False: 24]
  |  Branch (448:54): [True: 15, False: 11]
  ------------------
  449|     15|		switch (buf[3]) {
  450|      3|		case '8':
  ------------------
  |  Branch (450:3): [True: 3, False: 12]
  ------------------
  451|      6|		case '9':
  ------------------
  |  Branch (451:3): [True: 3, False: 12]
  ------------------
  452|      9|		case '+':
  ------------------
  |  Branch (452:3): [True: 3, False: 12]
  ------------------
  453|     12|		case '/':
  ------------------
  |  Branch (453:3): [True: 3, False: 12]
  ------------------
  454|     12|			if (ubuf)
  ------------------
  |  Branch (454:8): [True: 12, False: 0]
  ------------------
  455|     12|				*ulen = 0;
  456|     12|			return 1;
  457|      3|		default:
  ------------------
  |  Branch (457:3): [True: 3, False: 12]
  ------------------
  458|      3|			return -1;
  459|     15|		}
  460|  1.64k|	else
  461|  1.64k|		return -1;
  462|  1.65k|}
encoding.c:looks_ucs16:
  471|  25.8k|{
  472|  25.8k|	int bigend;
  473|  25.8k|	uint32_t hi;
  474|  25.8k|	size_t i;
  475|       |
  476|  25.8k|	if (nbytes < 2)
  ------------------
  |  Branch (476:6): [True: 68, False: 25.8k]
  ------------------
  477|     68|		return 0;
  478|       |
  479|  25.8k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (479:6): [True: 1.93k, False: 23.8k]
  |  Branch (479:23): [True: 277, False: 1.65k]
  ------------------
  480|    277|		bigend = 0;
  481|  25.5k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (481:11): [True: 297, False: 25.2k]
  |  Branch (481:28): [True: 244, False: 53]
  ------------------
  482|    244|		bigend = 1;
  483|  25.2k|	else
  484|  25.2k|		return 0;
  485|       |
  486|    521|	*ulen = 0;
  487|    521|	hi = 0;
  488|       |
  489|   359k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (489:14): [True: 359k, False: 366]
  ------------------
  490|   359k|		uint32_t uc;
  491|       |
  492|   359k|		if (bigend)
  ------------------
  |  Branch (492:7): [True: 9.35k, False: 350k]
  ------------------
  493|  9.35k|			uc = CAST(uint32_t,
  ------------------
  |  |  452|  9.35k|#define CAST(T, b)	((T)(b))
  ------------------
  494|   359k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  495|   350k|		else
  496|   350k|			uc = CAST(uint32_t,
  ------------------
  |  |  452|   350k|#define CAST(T, b)	((T)(b))
  ------------------
  497|   359k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  498|       |
  499|   359k|		uc &= 0xffff;
  500|       |
  501|   359k|		switch (uc) {
  502|      0|		case 0xfffe:
  ------------------
  |  Branch (502:3): [True: 0, False: 359k]
  ------------------
  503|     24|		case 0xffff:
  ------------------
  |  Branch (503:3): [True: 24, False: 359k]
  ------------------
  504|     24|			return 0;
  505|   359k|		default:
  ------------------
  |  Branch (505:3): [True: 359k, False: 24]
  ------------------
  506|   359k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  464|   359k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (464:26): [True: 105k, False: 254k]
  |  |  |  Branch (464:43): [True: 10, False: 104k]
  |  |  ------------------
  ------------------
  507|     10|				return 0;
  508|   359k|			break;
  509|   359k|		}
  510|   359k|		if (hi) {
  ------------------
  |  Branch (510:7): [True: 9.84k, False: 349k]
  ------------------
  511|  9.84k|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  466|  9.84k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (466:26): [True: 9.82k, False: 24]
  |  |  |  Branch (466:43): [True: 9.81k, False: 13]
  |  |  ------------------
  ------------------
  512|     37|				return 0;
  513|  9.81k|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  514|  9.81k|			hi = 0;
  515|  9.81k|		}
  516|   359k|		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  452|  18.4k|#define CAST(T, b)	((T)(b))
  ------------------
              		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  236|  18.4k|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (516:7): [True: 18.4k, False: 341k]
  |  Branch (516:19): [True: 53, False: 18.4k]
  ------------------
  517|     53|			return 0;
  518|   359k|		ubf[(*ulen)++] = uc;
  519|   359k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  465|   359k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (465:26): [True: 129k, False: 229k]
  |  |  |  Branch (465:43): [True: 9.88k, False: 119k]
  |  |  ------------------
  ------------------
  520|  9.88k|			hi = uc - 0xd800 + 1;
  521|   359k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  466|   359k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (466:26): [True: 119k, False: 239k]
  |  |  |  Branch (466:43): [True: 31, False: 119k]
  |  |  ------------------
  ------------------
  522|     31|			return 0;
  523|   359k|	}
  524|       |
  525|    366|	return 1 + bigend;
  526|    521|}
encoding.c:looks_ucs32:
  531|  26.3k|{
  532|  26.3k|	int bigend;
  533|  26.3k|	size_t i;
  534|       |
  535|  26.3k|	if (nbytes < 4)
  ------------------
  |  Branch (535:6): [True: 1.11k, False: 25.2k]
  ------------------
  536|  1.11k|		return 0;
  537|       |
  538|  25.2k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (538:6): [True: 2.03k, False: 23.1k]
  |  Branch (538:23): [True: 438, False: 1.60k]
  |  Branch (538:40): [True: 289, False: 149]
  |  Branch (538:54): [True: 207, False: 82]
  ------------------
  539|    207|		bigend = 0;
  540|  25.0k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (540:11): [True: 1.18k, False: 23.8k]
  |  Branch (540:25): [True: 719, False: 462]
  |  Branch (540:39): [True: 327, False: 392]
  |  Branch (540:56): [True: 274, False: 53]
  ------------------
  541|    274|		bigend = 1;
  542|  24.7k|	else
  543|  24.7k|		return 0;
  544|       |
  545|    481|	*ulen = 0;
  546|       |
  547|   658k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (547:14): [True: 658k, False: 456]
  ------------------
  548|       |		/* XXX fix to properly handle chars > 65536 */
  549|       |
  550|   658k|		if (bigend)
  ------------------
  |  Branch (550:7): [True: 381k, False: 277k]
  ------------------
  551|   381k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  452|   381k|#define CAST(T, b)	((T)(b))
  ------------------
  552|   381k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  452|   381k|#define CAST(T, b)	((T)(b))
  ------------------
  553|   381k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  452|   381k|#define CAST(T, b)	((T)(b))
  ------------------
  554|   381k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  452|   381k|#define CAST(T, b)	((T)(b))
  ------------------
  555|   277k|		else
  556|   277k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  452|   277k|#define CAST(T, b)	((T)(b))
  ------------------
  557|   277k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  452|   277k|#define CAST(T, b)	((T)(b))
  ------------------
  558|   277k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  452|   277k|#define CAST(T, b)	((T)(b))
  ------------------
  559|   277k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  452|   277k|#define CAST(T, b)	((T)(b))
  ------------------
  560|       |
  561|   658k|		if (ubf[*ulen - 1] == 0xfffe)
  ------------------
  |  Branch (561:7): [True: 7, False: 658k]
  ------------------
  562|      7|			return 0;
  563|   658k|		if (ubf[*ulen - 1] < 128 &&
  ------------------
  |  Branch (563:7): [True: 12.8k, False: 645k]
  ------------------
  564|  12.8k|		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  452|  12.8k|#define CAST(T, b)	((T)(b))
  ------------------
              		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  236|  12.8k|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (564:7): [True: 18, False: 12.8k]
  ------------------
  565|     18|			return 0;
  566|   658k|	}
  567|       |
  568|    456|	return 1 + bigend;
  569|    481|}
encoding.c:from_ebcdic:
  656|  24.2k|{
  657|  24.2k|	size_t i;
  658|       |
  659|  85.5M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (659:14): [True: 85.5M, False: 24.2k]
  ------------------
  660|  85.5M|		out[i] = ebcdic_to_ascii[buf[i]];
  661|  85.5M|	}
  662|  24.2k|}

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

file_copystr:
   57|    559|{
   58|    559|	if (blen == 0)
  ------------------
  |  Branch (58:6): [True: 0, False: 559]
  ------------------
   59|      0|		return buf;
   60|    559|	if (width >= blen)
  ------------------
  |  Branch (60:6): [True: 2, False: 557]
  ------------------
   61|      2|		width = blen - 1;
   62|    559|	memcpy(buf, str, width);
   63|    559|	buf[width] = '\0';
   64|    559|	return buf;
   65|    559|}
file_checkfmt:
   96|   347k|{
   97|   347k|	const char *p;
   98|  2.52M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (98:16): [True: 2.17M, False: 347k]
  ------------------
   99|  2.17M|		if (*p != '%')
  ------------------
  |  Branch (99:7): [True: 2.01M, False: 156k]
  ------------------
  100|  2.01M|			continue;
  101|   156k|		if (*++p == '%')
  ------------------
  |  Branch (101:7): [True: 0, False: 156k]
  ------------------
  102|      0|			continue;
  103|   156k|		if (*p == '\0') {
  ------------------
  |  Branch (103:7): [True: 0, False: 156k]
  ------------------
  104|      0|			if (msg)
  ------------------
  |  Branch (104:8): [True: 0, False: 0]
  ------------------
  105|      0|				snprintf(msg, mlen, "incomplete %% format");
  106|      0|			return -1;
  107|      0|		}
  108|       |		// Skip uninteresting.
  109|   172k|		while (*p != '\0' && strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (109:10): [True: 172k, False: 0]
  |  Branch (109:24): [True: 15.9k, False: 156k]
  ------------------
  110|  15.9k|			p++;
  111|   156k|		if (*p == '*') {
  ------------------
  |  Branch (111:7): [True: 0, False: 156k]
  ------------------
  112|      0|			if (msg)
  ------------------
  |  Branch (112:8): [True: 0, False: 0]
  ------------------
  113|      0|				snprintf(msg, mlen, "* not allowed in format");
  114|      0|			return -1;
  115|      0|		}
  116|       |
  117|   156k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (117:7): [True: 0, False: 156k]
  ------------------
  118|      0|			return -1;
  119|       |
  120|   156k|		if (*p == '.') {
  ------------------
  |  Branch (120:7): [True: 1.54k, False: 154k]
  ------------------
  121|  1.54k|			p++;
  122|  1.54k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (122:8): [True: 0, False: 1.54k]
  ------------------
  123|      0|				return -1;
  124|  1.54k|		}
  125|       |
  126|   156k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (126:7): [True: 0, False: 156k]
  ------------------
  127|      0|			if (msg)
  ------------------
  |  Branch (127:8): [True: 0, False: 0]
  ------------------
  128|      0|				snprintf(msg, mlen, "bad format char: %c", *p);
  129|      0|			return -1;
  130|      0|		}
  131|   156k|	}
  132|   347k|	return 0;
  133|   347k|}
file_vprintf:
  140|   349k|{
  141|   349k|	int len;
  142|   349k|	char *buf, *newstr;
  143|   349k|	char tbuf[1024];
  144|       |
  145|   349k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|   349k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (145:6): [True: 1.88k, False: 347k]
  ------------------
  146|  1.88k|		return 0;
  147|       |
  148|   347k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (148:6): [True: 0, False: 347k]
  ------------------
  149|      0|		file_clearbuf(ms);
  150|      0|		file_error(ms, 0, "Bad magic format `%s' (%s)", fmt, tbuf);
  151|      0|		return -1;
  152|      0|	}
  153|       |
  154|   347k|	len = vasprintf(&buf, fmt, ap);
  155|   347k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (155:6): [True: 0, False: 347k]
  |  Branch (155:17): [True: 124, False: 347k]
  |  Branch (155:39): [True: 0, False: 347k]
  ------------------
  156|    124|		size_t blen = ms->o.blen;
  157|    124|		free(buf);
  158|    124|		file_clearbuf(ms);
  159|    124|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  160|    124|		    SIZE_T_FORMAT "u", len, blen);
  161|    124|		return -1;
  162|    124|	}
  163|       |
  164|   347k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (164:6): [True: 316k, False: 30.4k]
  ------------------
  165|   316k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  166|   316k|		free(buf);
  167|   316k|		if (len < 0)
  ------------------
  |  Branch (167:7): [True: 0, False: 316k]
  ------------------
  168|      0|			goto out;
  169|   316k|		free(ms->o.buf);
  170|   316k|		buf = newstr;
  171|   316k|	}
  172|   347k|	ms->o.buf = buf;
  173|   347k|	ms->o.blen = len;
  174|   347k|	return 0;
  175|      0|out:
  176|      0|	file_clearbuf(ms);
  177|       |	file_error(ms, errno, "vasprintf failed");
  178|      0|	return -1;
  179|   347k|}
file_printf:
  183|   333k|{
  184|   333k|	int rv;
  185|   333k|	va_list ap;
  186|       |
  187|   333k|	va_start(ap, fmt);
  188|   333k|	rv = file_vprintf(ms, fmt, ap);
  189|       |	va_end(ap);
  190|   333k|	return rv;
  191|   333k|}
file_error:
  221|    283|{
  222|    283|	va_list va;
  223|    283|	va_start(va, f);
  224|    283|	file_error_core(ms, error, f, va, 0);
  225|       |	va_end(va);
  226|    283|}
file_magerror:
  234|     43|{
  235|     43|	va_list va;
  236|     43|	va_start(va, f);
  237|     43|	file_error_core(ms, 0, f, va, ms->line);
  238|       |	va_end(va);
  239|     43|}
file_badseek:
  250|      4|{
  251|       |	file_error(ms, errno, "error seeking");
  252|      4|}
file_badread:
  256|     71|{
  257|       |	file_error(ms, errno, "error reading");
  258|     71|}
file_separator:
  265|  48.8k|{
  266|  48.8k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  261|  48.8k|#define FILE_SEPARATOR "\n- "
  ------------------
  267|  48.8k|}
file_default:
  300|  11.0k|{
  301|  11.0k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  11.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  11.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  11.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (301:6): [True: 0, False: 11.0k]
  ------------------
  302|      0|		if ((ms->flags & MAGIC_MIME_TYPE) &&
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (302:7): [True: 0, False: 0]
  ------------------
  303|      0|		    file_printf(ms, "application/%s",
  ------------------
  |  Branch (303:7): [True: 0, False: 0]
  ------------------
  304|      0|			nb ? "octet-stream" : "x-empty") == -1)
  ------------------
  |  Branch (304:4): [True: 0, False: 0]
  ------------------
  305|      0|			return -1;
  306|      0|		return 1;
  307|      0|	}
  308|  11.0k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  11.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (308:6): [True: 0, False: 11.0k]
  ------------------
  309|       |		// This is not a typo: Type: UNKN Creator: UNKN
  310|      0|		if (file_printf(ms, "UNKNUNKN") == -1)
  ------------------
  |  Branch (310:7): [True: 0, False: 0]
  ------------------
  311|      0|			return -1;
  312|      0|		return 1;
  313|      0|	}
  314|  11.0k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  11.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (314:6): [True: 0, False: 11.0k]
  ------------------
  315|      0|		if (file_printf(ms, "???") == -1)
  ------------------
  |  Branch (315:7): [True: 0, False: 0]
  ------------------
  316|      0|			return -1;
  317|      0|		return 1;
  318|      0|	}
  319|  11.0k|	return 0;
  320|  11.0k|}
file_buffer:
  333|  15.1k|{
  334|  15.1k|	int m = 0, rv = 0, looks_text = 0;
  335|  15.1k|	const char *code = NULL;
  336|  15.1k|	const char *code_mime = "binary";
  337|  15.1k|	const char *def = "data";
  338|  15.1k|	const char *ftype = NULL;
  339|  15.1k|	char *rbuf = NULL;
  340|  15.1k|	struct buffer b;
  341|       |
  342|  15.1k|	buffer_init(&b, fd, st, buf, nb);
  343|  15.1k|	ms->mode = b.st.st_mode;
  344|       |
  345|  15.1k|	if (nb == 0) {
  ------------------
  |  Branch (345:6): [True: 17, False: 15.1k]
  ------------------
  346|     17|		def = "empty";
  347|     17|		goto simple;
  348|  15.1k|	} else if (nb == 1) {
  ------------------
  |  Branch (348:13): [True: 10, False: 15.1k]
  ------------------
  349|     10|		def = "very short file (no magic)";
  350|     10|		goto simple;
  351|     10|	}
  352|       |
  353|  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 (353:6): [True: 15.1k, False: 0]
  ------------------
  354|  15.1k|		looks_text = file_encoding(ms, &b, NULL, 0,
  355|  15.1k|		    &code, &code_mime, &ftype);
  356|  15.1k|	}
  357|       |
  358|       |#ifdef __EMX__
  359|       |	if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
  360|       |		m = file_os2_apptype(ms, inname, &b);
  361|       |		if ((ms->flags & MAGIC_DEBUG) != 0)
  362|       |			(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
  363|       |		switch (m) {
  364|       |		case -1:
  365|       |			return -1;
  366|       |		case 0:
  367|       |			break;
  368|       |		default:
  369|       |			return 1;
  370|       |		}
  371|       |	}
  372|       |#endif
  373|  15.1k|#if HAVE_FORK
  374|       |	/* try compression stuff */
  375|  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 (375:6): [True: 15.1k, False: 0]
  ------------------
  376|  15.1k|		m = file_zmagic(ms, &b, inname);
  377|  15.1k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  15.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (377:7): [True: 0, False: 15.1k]
  ------------------
  378|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  379|  15.1k|		if (m) {
  ------------------
  |  Branch (379:7): [True: 2.09k, False: 13.0k]
  ------------------
  380|  2.09k|			goto done_encoding;
  381|  2.09k|		}
  382|  15.1k|	}
  383|  13.0k|#endif
  384|       |	/* Check if we have a tar file */
  385|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  13.0k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (385:6): [True: 13.0k, False: 0]
  ------------------
  386|  13.0k|		m = file_is_tar(ms, &b);
  387|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (387:7): [True: 0, False: 13.0k]
  ------------------
  388|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  389|  13.0k|		if (m) {
  ------------------
  |  Branch (389:7): [True: 13, False: 13.0k]
  ------------------
  390|     13|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (390:8): [True: 0, False: 13]
  ------------------
  391|      0|				goto done;
  392|     13|		}
  393|  13.0k|	}
  394|       |
  395|       |	/* Check if we have a JSON file */
  396|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  13.0k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (396:6): [True: 13.0k, False: 0]
  ------------------
  397|  13.0k|		m = file_is_json(ms, &b);
  398|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (398:7): [True: 0, False: 13.0k]
  ------------------
  399|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  400|  13.0k|		if (m) {
  ------------------
  |  Branch (400:7): [True: 32, False: 13.0k]
  ------------------
  401|     32|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (401:8): [True: 0, False: 32]
  ------------------
  402|      0|				goto done;
  403|     32|		}
  404|  13.0k|	}
  405|       |
  406|       |	/* Check if we have a CSV file */
  407|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  13.0k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (407:6): [True: 13.0k, False: 0]
  ------------------
  408|  13.0k|		m = file_is_csv(ms, &b, looks_text, code);
  409|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (409:7): [True: 0, False: 13.0k]
  ------------------
  410|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  411|  13.0k|		if (m) {
  ------------------
  |  Branch (411:7): [True: 4, False: 13.0k]
  ------------------
  412|      4|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (412:8): [True: 0, False: 4]
  ------------------
  413|      0|				goto done;
  414|      4|		}
  415|  13.0k|	}
  416|       |
  417|       |	/* Check if we have a SIMH tape file */
  418|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_SIMH) == 0) {
  ------------------
  |  |   65|  13.0k|#define MAGIC_NO_CHECK_SIMH	0x0800000 /* Don't check for SIMH tape files */
  ------------------
  |  Branch (418:6): [True: 13.0k, False: 0]
  ------------------
  419|  13.0k|		m = file_is_simh(ms, &b);
  420|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (420:7): [True: 0, False: 13.0k]
  ------------------
  421|      0|			(void)fprintf(stderr, "[try simh %d]\n", m);
  422|  13.0k|		if (m) {
  ------------------
  |  Branch (422:7): [True: 30, False: 13.0k]
  ------------------
  423|     30|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (423:8): [True: 0, False: 30]
  ------------------
  424|      0|				goto done;
  425|     30|		}
  426|  13.0k|	}
  427|       |
  428|       |	/* Check if we have a CDF file */
  429|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  13.0k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (429:6): [True: 13.0k, False: 0]
  ------------------
  430|  13.0k|		m = file_trycdf(ms, &b);
  431|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (431:7): [True: 0, False: 13.0k]
  ------------------
  432|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  433|  13.0k|		if (m) {
  ------------------
  |  Branch (433:7): [True: 1.47k, False: 11.5k]
  ------------------
  434|  1.47k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (434:8): [True: 0, False: 1.47k]
  ------------------
  435|      0|				goto done;
  436|  1.47k|		}
  437|  13.0k|	}
  438|  13.0k|#ifdef BUILTIN_ELF
  439|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  13.0k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (439:6): [True: 13.0k, False: 0]
  |  Branch (439:47): [True: 11.5k, False: 1.50k]
  |  Branch (439:57): [True: 7.41k, False: 4.12k]
  ------------------
  440|  7.41k|		file_pushbuf_t *pb;
  441|       |		/*
  442|       |		 * We matched something in the file, so this
  443|       |		 * *might* be an ELF file, and the file is at
  444|       |		 * least 5 bytes long, so if it's an ELF file
  445|       |		 * it has at least one byte past the ELF magic
  446|       |		 * number - try extracting information from the
  447|       |		 * ELF headers that cannot easily be  extracted
  448|       |		 * with rules in the magic file. We we don't
  449|       |		 * print the information yet.
  450|       |		 */
  451|  7.41k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (451:7): [True: 6, False: 7.40k]
  ------------------
  452|      6|			return -1;
  453|       |
  454|  7.40k|		rv = file_tryelf(ms, &b);
  455|  7.40k|		rbuf = file_pop_buffer(ms, pb);
  456|  7.40k|		if (rv == -1) {
  ------------------
  |  Branch (456:7): [True: 83, False: 7.32k]
  ------------------
  457|     83|			free(rbuf);
  458|     83|			rbuf = NULL;
  459|     83|		}
  460|  7.40k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  7.40k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (460:7): [True: 0, False: 7.40k]
  ------------------
  461|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  462|  7.40k|	}
  463|  13.0k|#endif
  464|       |
  465|       |	/* try soft magic tests */
  466|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  13.0k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (466:6): [True: 13.0k, False: 0]
  ------------------
  467|  13.0k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  231|  13.0k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  468|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (468:7): [True: 0, False: 13.0k]
  ------------------
  469|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  470|  13.0k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (470:7): [True: 10.1k, False: 2.90k]
  |  Branch (470:17): [True: 3.75k, False: 6.38k]
  ------------------
  471|  3.75k|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (471:8): [True: 33, False: 3.71k]
  ------------------
  472|     33|				goto done;
  473|  3.75k|		}
  474|  13.0k|		if (m) {
  ------------------
  |  Branch (474:7): [True: 10.2k, False: 2.76k]
  ------------------
  475|  10.2k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (475:8): [True: 0, False: 10.2k]
  ------------------
  476|      0|				goto done;
  477|  10.2k|		}
  478|  13.0k|	}
  479|       |
  480|       |	/* try text properties */
  481|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  13.0k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (481:6): [True: 13.0k, False: 0]
  ------------------
  482|       |
  483|  13.0k|		m = file_ascmagic(ms, &b, looks_text);
  484|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (484:7): [True: 0, False: 13.0k]
  ------------------
  485|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  486|  13.0k|		if (m) {
  ------------------
  |  Branch (486:7): [True: 2.02k, False: 10.9k]
  ------------------
  487|  2.02k|			goto done;
  488|  2.02k|		}
  489|  13.0k|	}
  490|       |
  491|  11.0k|simple:
  492|       |	/* give up */
  493|  11.0k|	if (m == 0) {
  ------------------
  |  Branch (493:6): [True: 11.0k, False: 0]
  ------------------
  494|  11.0k|		m = 1;
  495|  11.0k|		rv = file_default(ms, nb);
  496|  11.0k|		if (rv == 0)
  ------------------
  |  Branch (496:7): [True: 11.0k, False: 0]
  ------------------
  497|  11.0k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (497:8): [True: 0, False: 11.0k]
  ------------------
  498|      0|				rv = -1;
  499|  11.0k|	}
  500|  13.0k| done:
  501|  13.0k|	trim_separator(ms);
  502|  13.0k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  13.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (502:6): [True: 0, False: 13.0k]
  ------------------
  503|      0|		if (ms->flags & MAGIC_MIME_TYPE)
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (503:7): [True: 0, False: 0]
  ------------------
  504|      0|			if (file_printf(ms, "; charset=") == -1)
  ------------------
  |  Branch (504:8): [True: 0, False: 0]
  ------------------
  505|      0|				rv = -1;
  506|      0|		if (file_printf(ms, "%s", code_mime) == -1)
  ------------------
  |  Branch (506:7): [True: 0, False: 0]
  ------------------
  507|      0|			rv = -1;
  508|      0|	}
  509|  13.0k|#if HAVE_FORK
  510|  15.1k| done_encoding:
  511|  15.1k|#endif
  512|  15.1k|	free(rbuf);
  513|  15.1k|	buffer_fini(&b);
  514|  15.1k|	if (rv)
  ------------------
  |  Branch (514:6): [True: 33, False: 15.1k]
  ------------------
  515|     33|		return rv;
  516|       |
  517|  15.1k|	return m;
  518|  15.1k|}
file_reset:
  523|  10.5k|{
  524|  10.5k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (524:6): [True: 10.5k, False: 2]
  |  Branch (524:21): [True: 0, False: 10.5k]
  ------------------
  525|      0|		file_error(ms, 0, "no magic files loaded");
  526|      0|		return -1;
  527|      0|	}
  528|  10.5k|	file_clearbuf(ms);
  529|  10.5k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (529:6): [True: 10.1k, False: 327]
  ------------------
  530|  10.1k|		free(ms->o.pbuf);
  531|  10.1k|		ms->o.pbuf = NULL;
  532|  10.1k|	}
  533|  10.5k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  487|  10.5k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  534|  10.5k|	ms->error = -1;
  535|  10.5k|	return 0;
  536|  10.5k|}
file_getbuffer:
  548|  10.4k|{
  549|  10.4k|	char *pbuf, *op, *np;
  550|  10.4k|	size_t psize, len;
  551|       |
  552|  10.4k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|  10.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (552:6): [True: 273, False: 10.1k]
  ------------------
  553|    273|		return NULL;
  554|       |
  555|  10.1k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  10.1k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (555:6): [True: 0, False: 10.1k]
  ------------------
  556|      0|		return ms->o.buf;
  557|       |
  558|  10.1k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (558:6): [True: 0, False: 10.1k]
  ------------------
  559|      0|		return NULL;
  560|       |
  561|       |	/* * 4 is for octal representation, + 1 is for NUL */
  562|  10.1k|	len = strlen(ms->o.buf);
  563|  10.1k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (563:6): [True: 0, False: 10.1k]
  ------------------
  564|      0|		file_oomem(ms, len);
  565|      0|		return NULL;
  566|      0|	}
  567|  10.1k|	psize = len * 4 + 1;
  568|  10.1k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (568:6): [True: 0, False: 10.1k]
  ------------------
  569|      0|		file_oomem(ms, psize);
  570|      0|		return NULL;
  571|      0|	}
  572|  10.1k|	ms->o.pbuf = pbuf;
  573|       |
  574|  10.1k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  575|  10.1k|	{
  576|  10.1k|		mbstate_t state;
  577|  10.1k|		wchar_t nextchar;
  578|  10.1k|		int mb_conv = 1;
  579|  10.1k|		size_t bytesconsumed;
  580|  10.1k|		char *eop;
  581|  10.1k|		(void)memset(&state, 0, sizeof(mbstate_t));
  582|       |
  583|  10.1k|		np = ms->o.pbuf;
  584|  10.1k|		op = ms->o.buf;
  585|  10.1k|		eop = op + len;
  586|       |
  587|  2.37M|		while (op < eop) {
  ------------------
  |  Branch (587:10): [True: 2.36M, False: 10.1k]
  ------------------
  588|  2.36M|			bytesconsumed = mbrtowc(&nextchar, op,
  589|  2.36M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  452|  2.36M|#define CAST(T, b)	((T)(b))
  ------------------
  590|  2.36M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  452|  4.72M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (590:8): [True: 65, False: 2.36M]
  ------------------
  591|  2.36M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  452|  2.36M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (591:8): [True: 0, False: 2.36M]
  ------------------
  592|     65|				mb_conv = 0;
  593|     65|				break;
  594|     65|			}
  595|       |
  596|  2.36M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (596:8): [True: 2.32M, False: 37.9k]
  ------------------
  597|  2.32M|				(void)memcpy(np, op, bytesconsumed);
  598|  2.32M|				op += bytesconsumed;
  599|  2.32M|				np += bytesconsumed;
  600|  2.32M|			} else {
  601|  75.9k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (601:12): [True: 37.9k, False: 37.9k]
  ------------------
  602|  37.9k|					OCTALIFY(np, op);
  ------------------
  |  |  540|  37.9k|	(void)(*(n)++ = '\\', \
  |  |  541|  37.9k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  452|  37.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  542|  37.9k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  37.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  543|  37.9k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  37.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  544|  37.9k|	(o)++)
  ------------------
  603|  37.9k|			}
  604|  2.36M|		}
  605|  10.1k|		*np = '\0';
  606|       |
  607|       |		/* Parsing succeeded as a multi-byte sequence */
  608|  10.1k|		if (mb_conv != 0)
  ------------------
  |  Branch (608:7): [True: 10.1k, False: 65]
  ------------------
  609|  10.1k|			return ms->o.pbuf;
  610|  10.1k|	}
  611|     65|#endif
  612|       |
  613|  30.2k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (613:40): [True: 30.1k, False: 65]
  ------------------
  614|  30.1k|		if (isprint(CAST(unsigned char, *op))) {
  ------------------
  |  Branch (614:7): [True: 28.8k, False: 1.25k]
  ------------------
  615|  28.8k|			*np++ = *op++;
  616|  28.8k|		} else {
  617|  1.25k|			OCTALIFY(np, op);
  ------------------
  |  |  540|  1.25k|	(void)(*(n)++ = '\\', \
  |  |  541|  1.25k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  452|  1.25k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  542|  1.25k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  1.25k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  543|  1.25k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  452|  1.25k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  544|  1.25k|	(o)++)
  ------------------
  618|  1.25k|		}
  619|  30.1k|	}
  620|     65|	*np = '\0';
  621|     65|	return ms->o.pbuf;
  622|  10.1k|}
file_check_mem:
  626|   800k|{
  627|   800k|	size_t len;
  628|       |
  629|   800k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (629:6): [True: 1, False: 800k]
  ------------------
  630|      1|		len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
  631|      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]
  |  |  ------------------
  ------------------
  632|      1|		    malloc(len) :
  633|      1|		    realloc(ms->c.li, len));
  634|      1|		if (ms->c.li == NULL) {
  ------------------
  |  Branch (634:7): [True: 0, False: 1]
  ------------------
  635|      0|			file_oomem(ms, len);
  636|      0|			return -1;
  637|      0|		}
  638|      1|	}
  639|   800k|	ms->c.li[level].got_match = 0;
  640|   800k|#ifdef ENABLE_CONDITIONALS
  641|   800k|	ms->c.li[level].last_match = 0;
  642|   800k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  360|   800k|#define				COND_NONE	0
  ------------------
  643|   800k|#endif /* ENABLE_CONDITIONALS */
  644|   800k|	return 0;
  645|   800k|}
file_printedlen:
  649|  2.02k|{
  650|  2.02k|	return ms->o.blen;
  651|  2.02k|}
file_replace:
  655|  1.29k|{
  656|  1.29k|	file_regex_t rx;
  657|  1.29k|	int rc, rv = -1;
  658|       |
  659|  1.29k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  660|  1.29k|	if (rc == 0) {
  ------------------
  |  Branch (660:6): [True: 1.29k, False: 0]
  ------------------
  661|  1.29k|		regmatch_t rm;
  662|  1.29k|		int nm = 0;
  663|  1.38k|		while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (663:10): [True: 89, False: 1.29k]
  ------------------
  664|     89|			ms->o.buf[rm.rm_so] = '\0';
  665|     89|			if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (665:8): [True: 0, False: 89]
  ------------------
  666|     89|			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (666:8): [True: 89, False: 0]
  ------------------
  667|      0|				goto out;
  668|     89|			nm++;
  669|     89|		}
  670|  1.29k|		rv = nm;
  671|  1.29k|	}
  672|  1.29k|out:
  673|  1.29k|	file_regfree(&rx);
  674|  1.29k|	return rv;
  675|  1.29k|}
file_regcomp:
  734|  29.4k|{
  735|  29.4k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (735:6): [True: 0, False: 29.4k]
  ------------------
  736|      0|		return -1;
  737|       |
  738|  29.4k|#ifdef USE_C_LOCALE
  739|  29.4k|	locale_t old = uselocale(ms->c_lc_ctype);
  740|  29.4k|	assert(old != NULL);
  ------------------
  |  Branch (740:2): [True: 0, False: 29.4k]
  |  Branch (740:2): [True: 29.4k, False: 0]
  ------------------
  741|       |#else
  742|       |	char old[1024];
  743|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  744|       |	(void)setlocale(LC_CTYPE, "C");
  745|       |#endif
  746|  29.4k|	int rc;
  747|  29.4k|	rc = regcomp(rx, pat, flags);
  748|       |
  749|  29.4k|#ifdef USE_C_LOCALE
  750|  29.4k|	uselocale(old);
  751|       |#else
  752|       |	(void)setlocale(LC_CTYPE, old);
  753|       |#endif
  754|  29.4k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (754:6): [True: 0, False: 29.4k]
  |  Branch (754:16): [True: 0, False: 0]
  ------------------
  755|      0|		char errmsg[512], buf[512];
  756|       |
  757|      0|		(void)regerror(rc, rx, errmsg, sizeof(errmsg));
  758|      0|		file_magerror(ms, "regex error %d for `%s', (%s)", rc, 
  759|      0|		    file_printable(ms, buf, sizeof(buf), pat, strlen(pat)),
  760|      0|		    errmsg);
  761|      0|	}
  762|  29.4k|	return rc;
  763|  29.4k|}
file_regexec:
  769|   291k|{
  770|   291k|#ifdef USE_C_LOCALE
  771|   291k|	locale_t old = uselocale(ms->c_lc_ctype);
  772|   291k|	assert(old != NULL);
  ------------------
  |  Branch (772:2): [True: 0, False: 291k]
  |  Branch (772:2): [True: 291k, False: 0]
  ------------------
  773|       |#else
  774|       |	char old[1024];
  775|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  776|       |	(void)setlocale(LC_CTYPE, "C");
  777|       |#endif
  778|   291k|	int rc;
  779|       |	/* XXX: force initialization because glibc does not always do this */
  780|   291k|	if (nmatch != 0)
  ------------------
  |  Branch (780:6): [True: 263k, False: 28.0k]
  ------------------
  781|   263k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  782|   291k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  783|   291k|#ifdef USE_C_LOCALE
  784|   291k|	uselocale(old);
  785|       |#else
  786|       |	(void)setlocale(LC_CTYPE, old);
  787|       |#endif
  788|   291k|	return rc;
  789|   291k|}
file_regfree:
  793|  29.3k|{
  794|  29.3k|	regfree(rx);
  795|  29.3k|}
file_push_buffer:
  799|  25.4k|{
  800|  25.4k|	file_pushbuf_t *pb;
  801|       |
  802|  25.4k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|  25.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (802:6): [True: 50, False: 25.4k]
  ------------------
  803|     50|		return NULL;
  804|       |
  805|  25.4k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  452|  25.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (805:6): [True: 0, False: 25.4k]
  ------------------
  806|      0|		return NULL;
  807|       |
  808|  25.4k|	pb->buf = ms->o.buf;
  809|  25.4k|	pb->blen = ms->o.blen;
  810|  25.4k|	pb->offset = ms->offset;
  811|       |
  812|  25.4k|	ms->o.buf = NULL;
  813|  25.4k|	ms->o.blen = 0;
  814|  25.4k|	ms->offset = 0;
  815|       |
  816|  25.4k|	return pb;
  817|  25.4k|}
file_pop_buffer:
  821|  25.4k|{
  822|  25.4k|	char *rbuf;
  823|       |
  824|  25.4k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  487|  25.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (824:6): [True: 976, False: 24.4k]
  ------------------
  825|    976|		free(pb->buf);
  826|    976|		free(pb);
  827|    976|		return NULL;
  828|    976|	}
  829|       |
  830|  24.4k|	rbuf = ms->o.buf;
  831|       |
  832|  24.4k|	ms->o.buf = pb->buf;
  833|  24.4k|	ms->o.blen = pb->blen;
  834|  24.4k|	ms->offset = pb->offset;
  835|       |
  836|  24.4k|	free(pb);
  837|  24.4k|	return rbuf;
  838|  25.4k|}
file_printable:
  846|  39.2k|{
  847|  39.2k|	char *ptr, *eptr = buf + bufsiz - 1;
  848|  39.2k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  453|  39.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  849|  39.2k|	const unsigned char *es = s + slen;
  850|       |
  851|   331k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (851:19): [True: 331k, False: 73]
  |  Branch (851:33): [True: 331k, False: 414]
  |  Branch (851:43): [True: 292k, False: 38.7k]
  ------------------
  852|   292k|		if ((ms->flags & MAGIC_RAW) != 0 || isprint(*s)) {
  ------------------
  |  |   41|   292k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (852:7): [True: 0, False: 292k]
  |  Branch (852:39): [True: 121k, False: 171k]
  ------------------
  853|   121k|			*ptr++ = *s;
  854|   121k|			continue;
  855|   121k|		}
  856|   171k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (856:7): [True: 71, False: 170k]
  ------------------
  857|     71|			break;
  858|   170k|		*ptr++ = '\\';
  859|   170k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  452|   170k|#define CAST(T, b)	((T)(b))
  ------------------
  860|   170k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  452|   170k|#define CAST(T, b)	((T)(b))
  ------------------
  861|   170k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  452|   170k|#define CAST(T, b)	((T)(b))
  ------------------
  862|   170k|	}
  863|  39.2k|	*ptr = '\0';
  864|  39.2k|	return buf;
  865|  39.2k|}
file_print_leguid:
  958|    275|{
  959|    275|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  452|    275|#define CAST(T, b)	((T)(b))
  ------------------
  960|    275|	    CAST(const void *, guid));
  961|    275|	return file_print_guid(str, len, g);
  962|    275|}
file_pipe_closexec:
  978|  4.75k|{
  979|       |#ifdef __MINGW32__
  980|       |	return 0;
  981|       |#elif defined(HAVE_PIPE2)
  982|  4.75k|	return pipe2(fds, O_CLOEXEC);
  983|       |#else
  984|       |	if (pipe(fds) == -1)
  985|       |		return -1;
  986|       |# ifdef F_SETFD
  987|       |	(void)fcntl(fds[0], F_SETFD, FD_CLOEXEC);
  988|       |	(void)fcntl(fds[1], F_SETFD, FD_CLOEXEC);
  989|       |# endif
  990|       |	return 0;
  991|       |#endif
  992|  4.75k|}
file_clear_closexec:
  995|  7.12k|file_clear_closexec(int fd) {
  996|  7.12k|#ifdef F_SETFD
  997|  7.12k|	return fcntl(fd, F_SETFD, 0);
  998|       |#else
  999|       |	return 0;
 1000|       |#endif
 1001|  7.12k|}
file_strtrim:
 1005|    273|{
 1006|    273|	char *last;
 1007|       |
 1008|    273|	while (isspace(CAST(unsigned char, *str)))
  ------------------
  |  Branch (1008:9): [True: 271, False: 273]
  ------------------
 1009|    271|		str++;
 1010|    273|	last = str;
 1011|  2.10k|	while (*last)
  ------------------
  |  Branch (1011:9): [True: 1.83k, False: 273]
  ------------------
 1012|  1.83k|		last++;
 1013|    273|	if (last == str)
  ------------------
  |  Branch (1013:6): [True: 77, False: 196]
  ------------------
 1014|     77|		return str;
 1015|    196|	--last;
 1016|    196|	while (isspace(CAST(unsigned char, *last)))
  ------------------
  |  Branch (1016:9): [True: 307, False: 196]
  ------------------
 1017|    307|		last--;
 1018|    196|	*++last = '\0';
 1019|    196|	return str;
 1020|    273|}
funcs.c:file_checkfield:
   77|   157k|{
   78|   157k|	const char *p = *pp;
   79|   157k|	int fw = 0;
   80|       |
   81|   163k|	while (*p && isdigit((unsigned char)*p))
  ------------------
  |  Branch (81:9): [True: 163k, False: 0]
  |  Branch (81:15): [True: 6.24k, False: 157k]
  ------------------
   82|  6.24k|		fw = fw * 10 + (*p++ - '0');
   83|       |
   84|   157k|	*pp = p;
   85|       |
   86|   157k|	if (fw < 1024)
  ------------------
  |  Branch (86:6): [True: 157k, False: 0]
  ------------------
   87|   157k|		return 1;
   88|      0|	if (msg)
  ------------------
  |  Branch (88:6): [True: 0, False: 0]
  ------------------
   89|      0|		snprintf(msg, mlen, "field %s too large: %d", what, fw);
   90|       |
   91|      0|	return 0;
   92|   157k|}
funcs.c:file_clearbuf:
   69|  10.6k|{
   70|  10.6k|	free(ms->o.buf);
   71|       |	ms->o.buf = NULL;
   72|  10.6k|	ms->o.blen = 0;
   73|  10.6k|}
funcs.c:file_error_core:
  201|    326|{
  202|       |	/* Only the first error is ok */
  203|    326|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|    326|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (203:6): [True: 2, False: 324]
  ------------------
  204|      2|		return;
  205|    324|	if (lineno != 0) {
  ------------------
  |  Branch (205:6): [True: 41, False: 283]
  ------------------
  206|     41|		file_clearbuf(ms);
  207|     41|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  208|     41|	}
  209|    324|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (209:6): [True: 141, False: 183]
  |  Branch (209:19): [True: 141, False: 0]
  ------------------
  210|    141|		(void)file_printf(ms, " ");
  211|    324|	(void)file_vprintf(ms, f, va);
  212|    324|	if (error > 0)
  ------------------
  |  Branch (212:6): [True: 78, False: 246]
  ------------------
  213|     78|		(void)file_printf(ms, " (%s)", strerror(error));
  214|    324|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  487|    324|#define 		EVENT_HAD_ERR		0x01
  ------------------
  215|    324|	ms->error = error;
  216|    324|}
funcs.c:checkdone:
  290|  11.8k|{
  291|  11.8k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  11.8k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (291:6): [True: 0, False: 11.8k]
  ------------------
  292|      0|		return 1;
  293|  11.8k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (293:6): [True: 0, False: 11.8k]
  ------------------
  294|      0|		*rv = -1;
  295|  11.8k|	return 0;
  296|  11.8k|}
funcs.c:trim_separator:
  271|  13.0k|{
  272|  13.0k|	size_t l;
  273|       |
  274|  13.0k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (274:6): [True: 0, False: 13.0k]
  ------------------
  275|      0|		return;
  276|       |
  277|  13.0k|	l = strlen(ms->o.buf);
  278|  13.0k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  261|  13.0k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (278:6): [True: 0, False: 13.0k]
  ------------------
  279|      0|		return;
  280|       |
  281|  13.0k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  261|  13.0k|#define FILE_SEPARATOR "\n- "
  ------------------
  282|  13.0k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  261|  13.0k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (282:6): [True: 13.0k, False: 0]
  ------------------
  283|  13.0k|		return;
  284|       |
  285|      0|	ms->o.buf[l] = '\0';
  286|      0|}
funcs.c:check_regex:
  679|  29.4k|{
  680|  29.4k|	char sbuf[512];
  681|  29.4k|	unsigned char oc = '\0';
  682|  29.4k|	const char *p;
  683|  29.4k|	unsigned long l;
  684|  29.4k|	static const char wild[] = "?*+{";
  685|       |
  686|   356k|	for (p = pat; *p; p++) {
  ------------------
  |  Branch (686:16): [True: 327k, False: 29.4k]
  ------------------
  687|   327k|		unsigned char c = *p;
  688|       |		// Avoid repetition of wild characters
  689|   327k|		if (strchr(wild, oc) != NULL && strchr(wild, c) != NULL) {
  ------------------
  |  Branch (689:7): [True: 57.7k, False: 269k]
  |  Branch (689:35): [True: 0, False: 57.7k]
  ------------------
  690|      0|			size_t len = strlen(pat);
  691|      0|			file_magwarn(ms,
  692|      0|			    "repetition-operator operand `%c%c' "
  693|      0|			    "invalid in regex `%s'", oc, c,
  694|      0|			    file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  695|      0|			return -1;
  696|      0|		}
  697|   327k|		if (c == '{') {
  ------------------
  |  Branch (697:7): [True: 71, False: 327k]
  ------------------
  698|     71|			char *ep, *eep;
  699|       |
  700|     71|			if (oc == '}') {
  ------------------
  |  Branch (700:8): [True: 0, False: 71]
  ------------------
  701|      0|				file_magwarn(ms, "cascading repetition "
  702|      0|				    "operators in regex `%s'", pat);
  703|      0|				return -1;
  704|      0|			}
  705|     71|			errno = 0;
  706|     71|			l = strtoul(p + 1, &ep, 10);
  707|     71|			if (ep != p + 1 && l > 1000)
  ------------------
  |  Branch (707:8): [True: 47, False: 24]
  |  Branch (707:23): [True: 0, False: 47]
  ------------------
  708|      0|				goto bounds;
  709|     71|			if (*ep == ',') {
  ------------------
  |  Branch (709:8): [True: 29, False: 42]
  ------------------
  710|     29|				l = strtoul(ep + 1, &eep, 10);
  711|     29|				if (eep != ep + 1 && l > 1000)
  ------------------
  |  Branch (711:9): [True: 29, False: 0]
  |  Branch (711:26): [True: 0, False: 29]
  ------------------
  712|      0|					goto bounds;
  713|     29|			}
  714|     71|		}
  715|   327k|		oc = c;
  716|   327k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (716:7): [True: 327k, False: 150]
  |  Branch (716:21): [True: 146, False: 4]
  |  Branch (716:35): [True: 3, False: 1]
  ------------------
  717|      1|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (717:10): [True: 1, False: 0]
  ------------------
  718|   327k|			continue;
  719|      0|		size_t len = strlen(pat);
  720|      0|		file_magwarn(ms,
  721|      0|		    "non-ascii characters in regex \\%#o `%s'",
  722|      0|		    c, file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  723|      0|		return -1;
  724|   327k|	}
  725|  29.4k|	return 0;
  726|      0|bounds:
  727|      0|	file_magwarn(ms, "bounds too large %ld in regex `%s'", l, pat);
  728|      0|	return -1;
  729|  29.4k|}
funcs.c:file_print_guid:
  940|    275|{
  941|    275|#ifndef WIN32
  942|    275|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  943|    275|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  944|    275|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  945|    275|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  946|    275|	    g->data4[6], g->data4[7]);
  947|       |#else
  948|       |	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hX%.2hX-"
  949|       |	    "%.2hX%.2hX%.2hX%.2hX%.2hX%.2hX",
  950|       |	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  951|       |	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  952|       |	    g->data4[6], g->data4[7]);
  953|       |#endif
  954|    275|}

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

file_is_json:
  423|  13.0k|{
  424|  13.0k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  13.0k|	const unsigned char *ue = uc + b->flen;
  426|  13.0k|	size_t st[JSON_MAX];
  427|  13.0k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  13.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  13.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  13.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  13.0k|	int jt;
  429|       |
  430|       |
  431|  13.0k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  13.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  13.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 13.0k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  13.0k|	memset(st, 0, sizeof(st));
  435|       |
  436|  13.0k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 13.0k, False: 32]
  ------------------
  437|  13.0k|		return 0;
  438|       |
  439|     32|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     32|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 32]
  ------------------
  440|      0|		return 1;
  441|     32|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 32]
  ------------------
  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|     32|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 32]
  ------------------
  448|     32|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 13, False: 19]
  ------------------
  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|     32|	return 1;
  462|     32|}
is_json.c:json_parse:
  348|  20.5k|{
  349|  20.5k|	const unsigned char *uc, *ouc;
  350|  20.5k|	int rv = 0;
  351|  20.5k|	int t;
  352|       |
  353|  20.5k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  20.5k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 76, False: 20.4k]
  ------------------
  355|     76|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  20.4k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 1, False: 20.4k]
  ------------------
  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|  20.4k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  20.4k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 20.4k]
  |  |  ------------------
  ------------------
  369|  20.4k|	switch (*uc++) {
  370|    578|	case '"':
  ------------------
  |  Branch (370:2): [True: 578, False: 19.8k]
  ------------------
  371|    578|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    578|		t = JSON_STRING;
  ------------------
  |  |   60|    578|#define JSON_STRING	4
  ------------------
  373|    578|		break;
  374|  4.26k|	case '[':
  ------------------
  |  Branch (374:2): [True: 4.26k, False: 16.1k]
  ------------------
  375|  4.26k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  4.26k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  4.26k|#define JSON_ARRAY	0
  ------------------
  377|  4.26k|		break;
  378|    827|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 827, False: 19.6k]
  ------------------
  379|    827|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    827|		t = JSON_OBJECT;
  ------------------
  |  |   59|    827|#define JSON_OBJECT	3
  ------------------
  381|    827|		break;
  382|    309|	case 't':
  ------------------
  |  Branch (382:2): [True: 309, False: 20.1k]
  ------------------
  383|    309|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    309|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    309|#define JSON_CONSTANT	1
  ------------------
  385|    309|		break;
  386|    237|	case 'f':
  ------------------
  |  Branch (386:2): [True: 237, False: 20.1k]
  ------------------
  387|    237|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    237|		    lvl + 1);
  389|    237|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    237|#define JSON_CONSTANT	1
  ------------------
  390|    237|		break;
  391|    200|	case 'n':
  ------------------
  |  Branch (391:2): [True: 200, False: 20.2k]
  ------------------
  392|    200|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    200|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    200|#define JSON_CONSTANT	1
  ------------------
  394|    200|		break;
  395|  14.0k|	default:
  ------------------
  |  Branch (395:2): [True: 14.0k, False: 6.41k]
  ------------------
  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|  20.4k|	}
  401|  20.4k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 4.49k, False: 15.9k]
  ------------------
  402|  4.49k|		st[t]++;
  403|  20.4k|	uc = json_skip_space(uc, ue);
  404|  20.5k|out:
  405|  20.5k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  20.5k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 20.5k]
  |  |  ------------------
  ------------------
  406|  20.5k|	*ucp = uc;
  407|  20.5k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 13.0k, False: 7.46k]
  ------------------
  408|  13.0k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 12.7k, False: 340]
  ------------------
  409|  12.7k|			return 0;
  410|    340|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 84, False: 256]
  ------------------
  411|     84|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|     84|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     77|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 7, False: 77]
  |  Branch (411:31): [True: 6, False: 71]
  ------------------
  412|    256|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 58, False: 198]
  |  Branch (412:22): [True: 48, False: 10]
  ------------------
  413|     48|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     48|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     31|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 17, False: 31]
  |  Branch (413:31): [True: 2, False: 29]
  ------------------
  414|    208|		else
  415|    208|			return 0;
  416|    256|	}
  417|  7.46k|	return rv;
  418|  20.5k|}
is_json.c:json_skip_space:
  119|  50.1k|{
  120|  16.5M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 16.5M, False: 3.31k]
  |  Branch (120:20): [True: 16.5M, False: 46.8k]
  ------------------
  121|  16.5M|		uc++;
  122|  50.1k|	return uc;
  123|  50.1k|}
is_json.c:json_isspace:
   79|  16.5M|{
   80|  16.5M|	switch (uc) {
   81|  7.63M|	case ' ':
  ------------------
  |  Branch (81:2): [True: 7.63M, False: 8.92M]
  ------------------
   82|  12.3M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 4.73M, False: 11.8M]
  ------------------
   83|  16.5M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 4.14M, False: 12.4M]
  ------------------
   84|  16.5M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 188, False: 16.5M]
  ------------------
   85|  16.5M|		return 1;
   86|  46.8k|	default:
  ------------------
  |  Branch (86:2): [True: 46.8k, False: 16.5M]
  ------------------
   87|  46.8k|		return 0;
   88|  16.5M|	}
   89|  16.5M|}
is_json.c:json_parse_string:
  129|  1.43k|{
  130|  1.43k|	const unsigned char *uc = *ucp;
  131|  1.43k|	size_t i;
  132|       |
  133|  1.43k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  1.43k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
  134|  3.20M|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 3.20M, False: 107]
  ------------------
  135|  3.20M|		switch (*uc++) {
  136|     12|		case '\0':
  ------------------
  |  Branch (136:3): [True: 12, False: 3.20M]
  ------------------
  137|     12|			goto out;
  138|  3.16M|		case '\\':
  ------------------
  |  Branch (138:3): [True: 3.16M, False: 41.3k]
  ------------------
  139|  3.16M|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 14, False: 3.16M]
  ------------------
  140|     14|				goto out;
  141|  3.16M|			switch (*uc++) {
  142|      0|			case '\0':
  ------------------
  |  Branch (142:4): [True: 0, False: 3.16M]
  ------------------
  143|      0|				goto out;
  144|  1.52M|			case '"':
  ------------------
  |  Branch (144:4): [True: 1.52M, False: 1.64M]
  ------------------
  145|  3.16M|			case '\\':
  ------------------
  |  Branch (145:4): [True: 1.64M, False: 1.52M]
  ------------------
  146|  3.16M|			case '/':
  ------------------
  |  Branch (146:4): [True: 83, False: 3.16M]
  ------------------
  147|  3.16M|			case 'b':
  ------------------
  |  Branch (147:4): [True: 263, False: 3.16M]
  ------------------
  148|  3.16M|			case 'f':
  ------------------
  |  Branch (148:4): [True: 173, False: 3.16M]
  ------------------
  149|  3.16M|			case 'n':
  ------------------
  |  Branch (149:4): [True: 307, False: 3.16M]
  ------------------
  150|  3.16M|			case 'r':
  ------------------
  |  Branch (150:4): [True: 198, False: 3.16M]
  ------------------
  151|  3.16M|			case 't':
  ------------------
  |  Branch (151:4): [True: 199, False: 3.16M]
  ------------------
  152|  3.16M|				continue;
  153|    586|			case 'u':
  ------------------
  |  Branch (153:4): [True: 586, False: 3.16M]
  ------------------
  154|    586|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 9, False: 577]
  ------------------
  155|      9|					uc = ue;
  156|      9|					goto out;
  157|      9|				}
  158|  2.82k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 2.27k, False: 549]
  ------------------
  159|  2.27k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 28, False: 2.25k]
  ------------------
  160|     28|						goto out;
  161|    549|				continue;
  162|    549|			default:
  ------------------
  |  Branch (162:4): [True: 6, False: 3.16M]
  ------------------
  163|      6|				goto out;
  164|  3.16M|			}
  165|  1.26k|		case '"':
  ------------------
  |  Branch (165:3): [True: 1.26k, False: 3.20M]
  ------------------
  166|  1.26k|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|  1.26k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.26k]
  |  |  ------------------
  ------------------
  167|  1.26k|			*ucp = uc;
  168|  1.26k|			return 1;
  169|  40.0k|		default:
  ------------------
  |  Branch (169:3): [True: 40.0k, False: 3.16M]
  ------------------
  170|  40.0k|			continue;
  171|  3.20M|		}
  172|  3.20M|	}
  173|    176|out:
  174|    176|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    176|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 176]
  |  |  ------------------
  ------------------
  175|    176|	*ucp = uc;
  176|    176|	return 0;
  177|  1.43k|}
is_json.c:json_isxdigit:
  105|  2.27k|{
  106|  2.27k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 229, False: 2.04k]
  ------------------
  107|    229|		return 1;
  108|  2.04k|	switch (uc) {
  109|  1.13k|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 298, False: 1.75k]
  |  Branch (109:12): [True: 303, False: 1.74k]
  |  Branch (109:22): [True: 84, False: 1.96k]
  |  Branch (109:32): [True: 61, False: 1.98k]
  |  Branch (109:42): [True: 169, False: 1.88k]
  |  Branch (109:52): [True: 218, False: 1.83k]
  ------------------
  110|  2.02k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 316, False: 1.73k]
  |  Branch (110:12): [True: 111, False: 1.93k]
  |  Branch (110:22): [True: 69, False: 1.98k]
  |  Branch (110:32): [True: 256, False: 1.79k]
  |  Branch (110:42): [True: 101, False: 1.94k]
  |  Branch (110:52): [True: 35, False: 2.01k]
  ------------------
  111|  2.02k|		return 1;
  112|     28|	default:
  ------------------
  |  Branch (112:2): [True: 28, False: 2.02k]
  ------------------
  113|     28|		return 0;
  114|  2.04k|	}
  115|  2.04k|}
is_json.c:json_isdigit:
   93|  23.7M|{
   94|  23.7M|	switch (uc) {
   95|  22.1M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 20.4M, False: 3.30M]
  |  Branch (95:12): [True: 1.72M, False: 21.9M]
  |  Branch (95:22): [True: 241, False: 23.7M]
  |  Branch (95:32): [True: 182, False: 23.7M]
  |  Branch (95:42): [True: 96, False: 23.7M]
  ------------------
   96|  23.6M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 1.45M, False: 22.2M]
  |  Branch (96:12): [True: 870, False: 23.7M]
  |  Branch (96:22): [True: 41.1k, False: 23.6M]
  |  Branch (96:32): [True: 51.4k, False: 23.6M]
  |  Branch (96:42): [True: 376, False: 23.7M]
  ------------------
   97|  23.6M|		return 1;
   98|  30.7k|	default:
  ------------------
  |  Branch (98:2): [True: 30.7k, False: 23.6M]
  ------------------
   99|  30.7k|		return 0;
  100|  23.7M|	}
  101|  23.7M|}
is_json.c:json_parse_array:
  182|  4.26k|{
  183|  4.26k|	const unsigned char *uc = *ucp;
  184|       |
  185|  4.26k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  4.26k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  186|  7.13k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 7.09k, False: 38]
  ------------------
  187|  7.09k|		uc = json_skip_space(uc, ue);
  188|  7.09k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 13, False: 7.08k]
  ------------------
  189|     13|			goto out;
  190|  7.08k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 492, False: 6.59k]
  ------------------
  191|    492|			goto done;
  192|  6.59k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 3.09k, False: 3.49k]
  ------------------
  193|  3.09k|			goto out;
  194|  3.49k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 39, False: 3.45k]
  ------------------
  195|     39|			goto out;
  196|  3.45k|		switch (*uc) {
  197|  2.86k|		case ',':
  ------------------
  |  Branch (197:3): [True: 2.86k, False: 591]
  ------------------
  198|  2.86k|			uc++;
  199|  2.86k|			continue;
  200|    575|		case ']':
  ------------------
  |  Branch (200:3): [True: 575, False: 2.88k]
  ------------------
  201|  1.06k|		done:
  202|  1.06k|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|  1.06k|#define JSON_ARRAYN	5
  ------------------
  203|  1.06k|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|  1.06k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  204|  1.06k|			*ucp = uc + 1;
  205|  1.06k|			return 1;
  206|     16|		default:
  ------------------
  |  Branch (206:3): [True: 16, False: 3.44k]
  ------------------
  207|     16|			goto out;
  208|  3.45k|		}
  209|  3.45k|	}
  210|  3.19k|out:
  211|  3.19k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  3.19k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 3.19k]
  |  |  ------------------
  ------------------
  212|  3.19k|	*ucp = uc;
  213|  3.19k|	return 0;
  214|  4.26k|}
is_json.c:json_parse_object:
  219|    827|{
  220|    827|	const unsigned char *uc = *ucp;
  221|    827|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    827|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 827]
  |  |  ------------------
  ------------------
  222|  1.23k|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 1.23k, False: 7]
  ------------------
  223|  1.23k|		uc = json_skip_space(uc, ue);
  224|  1.23k|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 11, False: 1.21k]
  ------------------
  225|     11|			goto out;
  226|  1.21k|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 324, False: 895]
  ------------------
  227|    324|			uc++;
  228|    324|			goto done;
  229|    324|		}
  230|    895|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 37, False: 858]
  ------------------
  231|     37|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     37|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 37]
  |  |  ------------------
  ------------------
  232|     37|			goto out;
  233|     37|		}
  234|    858|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    858|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 858]
  |  |  ------------------
  ------------------
  235|    858|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 9, False: 849]
  ------------------
  236|      9|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      9|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 9]
  |  |  ------------------
  ------------------
  237|      9|			goto out;
  238|      9|		}
  239|    849|		uc = json_skip_space(uc, ue);
  240|    849|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 12, False: 837]
  ------------------
  241|     12|			goto out;
  242|    837|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 19, False: 818]
  ------------------
  243|     19|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|     19|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 19]
  |  |  ------------------
  ------------------
  244|     19|			goto out;
  245|     19|		}
  246|    818|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 206, False: 612]
  ------------------
  247|    206|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    206|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 206]
  |  |  ------------------
  ------------------
  248|    206|			goto out;
  249|    206|		}
  250|    612|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 2, False: 610]
  ------------------
  251|      2|			goto out;
  252|    610|		switch (*uc++) {
  253|    410|		case ',':
  ------------------
  |  Branch (253:3): [True: 410, False: 200]
  ------------------
  254|    410|			continue;
  255|    199|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 199, False: 411]
  ------------------
  256|    523|		done:
  257|    523|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    523|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 523]
  |  |  ------------------
  ------------------
  258|    523|			*ucp = uc;
  259|    523|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 609]
  ------------------
  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|    610|		}
  265|    610|	}
  266|    304|out:
  267|    304|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    304|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 304]
  |  |  ------------------
  ------------------
  268|    304|	*ucp = uc;
  269|    304|	return 0;
  270|    827|}
is_json.c:json_parse_const:
  328|    746|{
  329|    746|	const unsigned char *uc = *ucp;
  330|       |
  331|    746|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|    746|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 746]
  |  |  ------------------
  ------------------
  332|    746|	*ucp += --len - 1;
  333|    746|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 59, False: 687]
  ------------------
  334|     59|		*ucp = ue;
  335|  2.81k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 2.77k, False: 46]
  |  Branch (335:20): [True: 2.17k, False: 603]
  ------------------
  336|  2.17k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 97, False: 2.07k]
  ------------------
  337|     97|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     97|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 97]
  |  |  ------------------
  ------------------
  338|     97|			return 0;
  339|     97|		}
  340|  2.17k|	}
  341|    649|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|    649|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 649]
  |  |  ------------------
  ------------------
  342|    649|	return 1;
  343|    746|}
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: 109, False: 13.9k]
  ------------------
  284|    109|		uc++;
  285|       |
  286|  20.5M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 20.5M, False: 42]
  ------------------
  287|  20.5M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 13.9k, False: 20.5M]
  ------------------
  288|  13.9k|			break;
  289|  20.5M|		got = 1;
  290|  20.5M|	}
  291|  14.0k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 42, False: 13.9k]
  ------------------
  292|     42|		goto out;
  293|  13.9k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 251, False: 13.7k]
  ------------------
  294|    251|		uc++;
  295|  1.72M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 1.72M, False: 21]
  ------------------
  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|  13.9k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 21, False: 13.9k]
  ------------------
  301|     21|		goto out;
  302|  13.9k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 1.84k, False: 12.1k]
  |  Branch (302:14): [True: 664, False: 1.17k]
  |  Branch (302:28): [True: 167, False: 1.01k]
  ------------------
  303|    831|		uc++;
  304|    831|		got = 0;
  305|    831|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 10, False: 821]
  ------------------
  306|     10|			goto out;
  307|    821|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 67, False: 754]
  |  Branch (307:21): [True: 357, False: 397]
  ------------------
  308|    424|			uc++;
  309|  1.45M|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 1.45M, False: 27]
  ------------------
  310|  1.45M|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 794, False: 1.45M]
  ------------------
  311|    794|				break;
  312|  1.45M|			got = 1;
  313|  1.45M|		}
  314|    821|	}
  315|  14.0k|out:
  316|  14.0k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 12.1k, False: 1.84k]
  ------------------
  317|  12.1k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  12.1k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 12.1k]
  |  |  ------------------
  ------------------
  318|  1.84k|	else
  319|  1.84k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  1.84k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.84k]
  |  |  ------------------
  ------------------
  320|  14.0k|	*ucp = uc;
  321|  14.0k|	return got;
  322|  13.9k|}

file_is_simh:
  158|  13.0k|{
  159|  13.0k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
  160|  13.0k|	const unsigned char *ue = uc + b->flen;
  161|  13.0k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  13.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  13.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  13.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  162|       |
  163|  13.0k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  13.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  13.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (163:6): [True: 0, False: 13.0k]
  ------------------
  164|      0|		return 0;
  165|       |
  166|  13.0k|	if (!simh_parse(uc, ue))
  ------------------
  |  Branch (166:6): [True: 13.0k, False: 30]
  ------------------
  167|  13.0k|		return 0;
  168|       |
  169|     30|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     30|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (169:6): [True: 0, False: 30]
  ------------------
  170|      0|		return 1;
  171|       |
  172|     30|	if (mime) {
  ------------------
  |  Branch (172:6): [True: 0, False: 30]
  ------------------
  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|     30|	if (file_printf(ms, "SIMH tape data") == -1)
  ------------------
  |  Branch (178:6): [True: 0, False: 30]
  ------------------
  179|      0|		return -1;
  180|       |
  181|     30|	return 1;
  182|     30|}
is_simh.c:simh_parse:
  114|  13.0k|{
  115|  13.0k|	uint32_t nbytes, cbytes;
  116|  13.0k|	const unsigned char *orig_uc = uc;
  117|  13.0k|	size_t nt = 0, nr = 0;
  118|  13.0k|	int err = 0;
  119|       |
  120|  13.0k|	(void)memcpy(simh_bo.s, "\01\02\03\04", 4);
  121|       |
  122|  18.6k|	while (ue - uc >= CAST(ptrdiff_t, sizeof(nbytes))) {
  ------------------
  |  |  452|  18.6k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (122:9): [True: 17.9k, False: 737]
  ------------------
  123|  17.9k|		nbytes = getlen(&uc, &err);
  124|  17.9k|		if (err)
  ------------------
  |  Branch (124:7): [True: 9.17k, False: 8.75k]
  ------------------
  125|  9.17k|			return 0;
  126|  8.75k|		if ((nt > 0 || nr > 0) && nbytes == 0xFFFFFFFF)
  ------------------
  |  Branch (126:8): [True: 3.45k, False: 5.30k]
  |  Branch (126:18): [True: 2.13k, False: 3.16k]
  |  Branch (126:29): [True: 4, False: 5.58k]
  ------------------
  127|       |			/* EOM after at least one record or tapemark */
  128|      4|			break;
  129|  8.75k|		if (nbytes == 0) {
  ------------------
  |  Branch (129:7): [True: 1.13k, False: 7.61k]
  ------------------
  130|  1.13k|			nt++;	/* count tapemarks */
  131|  1.13k|#if SIMH_TAPEMARKS
  132|  1.13k|			if (nt == SIMH_TAPEMARKS)
  ------------------
  |  |   65|  1.13k|#define SIMH_TAPEMARKS 10
  ------------------
  |  Branch (132:8): [True: 101, False: 1.03k]
  ------------------
  133|    101|				break;
  134|  1.03k|#endif
  135|  1.03k|			continue;
  136|  1.13k|		}
  137|       |		/* handle a data record */
  138|  7.61k|		uc += nbytes;
  139|  7.61k|		if (ue - uc < CAST(ptrdiff_t, sizeof(nbytes)))
  ------------------
  |  |  452|  7.61k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (139:7): [True: 2.88k, False: 4.73k]
  ------------------
  140|  2.88k|			break;
  141|  4.73k|		cbytes = getlen(&uc, &err);
  142|  4.73k|		if (err)
  ------------------
  |  Branch (142:7): [True: 37, False: 4.69k]
  ------------------
  143|     37|			return 0;
  144|  4.69k|		if (nbytes != cbytes)
  ------------------
  |  Branch (144:7): [True: 112, False: 4.58k]
  ------------------
  145|    112|			return 0;
  146|  4.58k|		nr++;
  147|  4.58k|	}
  148|  3.72k|	if (nt * sizeof(uint32_t) == CAST(size_t, uc - orig_uc))
  ------------------
  |  |  452|  3.72k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (148:6): [True: 835, False: 2.88k]
  ------------------
  149|    835|		return 0;	/* All examined data was tapemarks (0) */
  150|  2.88k|	if (nr == 0)		/* No records */
  ------------------
  |  Branch (150:6): [True: 2.85k, False: 30]
  ------------------
  151|  2.85k|		return 0;
  152|     30|	return 1;
  153|  2.88k|}
is_simh.c:getlen:
   95|  22.6k|{
   96|  22.6k|	uint32_t n;
   97|  22.6k|	memcpy(&n, *uc, sizeof(n));
   98|  22.6k|	*err = 0;
   99|  22.6k|	*uc += sizeof(n);
  100|  22.6k|	if (NEED_SWAP)
  ------------------
  |  |   75|  22.6k|#define NEED_SWAP	(simh_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  452|  22.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (75:19): [True: 0, False: 22.6k]
  |  |  ------------------
  ------------------
  101|      0|		n = swap4(n);
  102|  22.6k|	if (n == 0xffffffff)	/* check for End of Medium */
  ------------------
  |  Branch (102:6): [True: 45, False: 22.6k]
  ------------------
  103|     45|		return n;
  104|       |	/* Check bits 25 to 28 are not used */
  105|  22.6k|	*err = ((n & 0x00ffffff) != (n & 0x0fffffff));
  106|  22.6k|	n &= 0x00ffffff;	/* keep only the record len */
  107|  22.6k|	if (n & 1)
  ------------------
  |  Branch (107:6): [True: 8.91k, False: 13.7k]
  ------------------
  108|  8.91k|		n++;
  109|  22.6k|	return n;
  110|  22.6k|}

file_is_tar:
   64|  13.0k|{
   65|  13.0k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  13.0k|	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|  13.0k|	int tar;
   72|  13.0k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  13.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  13.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  13.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  13.0k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  13.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  13.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 13.0k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  13.0k|	tar = is_tar(buf, nbytes);
   78|  13.0k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 13.0k, False: 13]
  |  Branch (78:17): [True: 0, False: 13]
  ------------------
   79|  13.0k|		return 0;
   80|       |
   81|     13|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     13|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 13]
  ------------------
   82|      0|		return 1;
   83|       |
   84|     13|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 13]
  |  Branch (84:28): [True: 0, False: 13]
  ------------------
   85|     13|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|     13|	return 1;
   89|     13|}
is_tar.c:is_tar:
  100|  13.0k|{
  101|  13.0k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  13.0k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  453|  13.0k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  13.0k|	    RCAST(const void *, buf));
  105|  13.0k|	size_t i;
  106|  13.0k|	int sum, recsum;
  107|  13.0k|	const unsigned char *p, *ep;
  108|  13.0k|	const char *nulp;
  109|       |
  110|  13.0k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 9.89k, False: 3.14k]
  ------------------
  111|  9.89k|		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.14k|	nulp = CAST(const char *,
  ------------------
  |  |  452|  3.14k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  3.14k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  3.14k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 2.91k, False: 236]
  |  Branch (118:22): [True: 1.99k, False: 919]
  ------------------
  119|  1.99k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 45, False: 1.94k]
  ------------------
  120|  1.99k|	    sizeof(gpkg_match)) == 0)
  121|     45|	    return 0;
  122|       |
  123|  3.10k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  3.10k|	sum = 0;
  126|  3.10k|	p = header->charptr;
  127|  3.10k|	ep = header->charptr + sizeof(*header);
  128|  1.59M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.58M, False: 3.10k]
  ------------------
  129|  1.58M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  27.9k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 24.8k, False: 3.10k]
  ------------------
  133|  24.8k|		sum -= header->header.chksum[i];
  134|  3.10k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  3.10k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 3.09k, False: 13]
  ------------------
  137|  3.09k|		return 0;	/* Not a tar archive */
  138|       |
  139|     13|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|     13|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 1, False: 12]
  ------------------
  140|     13|	    sizeof(header->header.magic)) == 0)
  141|      1|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|     12|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|     12|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 1, False: 11]
  ------------------
  144|     12|	    sizeof(header->header.magic)) == 0)
  145|      1|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|     11|	return 1;			/* Old fashioned tar archive */
  148|     12|}
is_tar.c:from_oct:
  158|  3.10k|{
  159|  3.10k|	int	value;
  160|       |
  161|  3.10k|	if (digs == 0)
  ------------------
  |  Branch (161:6): [True: 0, False: 3.10k]
  ------------------
  162|      0|		return -1;
  163|       |
  164|  3.10k|	while (isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  ------------------
  |  Branch (164:9): [True: 496, False: 3.06k]
  ------------------
  165|    496|		where++;
  166|    496|		if (digs-- == 0)
  ------------------
  |  Branch (166:7): [True: 43, False: 453]
  ------------------
  167|     43|			return -1;		/* All blank field */
  168|    496|	}
  169|  3.06k|	value = 0;
  170|  3.44k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  3.41k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 866, False: 2.55k]
  |  |  |  Branch (51:39): [True: 387, False: 479]
  |  |  ------------------
  ------------------
  |  Branch (170:9): [True: 3.41k, False: 30]
  ------------------
  171|    387|		value = (value << 3) | (*where++ - '0');
  172|    387|		digs--;
  173|    387|	}
  174|       |
  175|  3.06k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (175:6): [True: 3.03k, False: 30]
  |  Branch (175:18): [True: 1.28k, False: 1.74k]
  |  Branch (175:28): [True: 1.27k, False: 5]
  ------------------
  176|  1.27k|		return -1;			/* Ended on non-(space/NUL) */
  177|       |
  178|  1.78k|	return value;
  179|  3.06k|}

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.5k|{
  406|  10.5k|	if (ms == NULL)
  ------------------
  |  Branch (406:6): [True: 0, False: 10.5k]
  ------------------
  407|      0|		return NULL;
  408|  10.5k|	return file_or_fd(ms, NULL, fd);
  409|  10.5k|}
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.5k|{
  425|  10.5k|	int	rv = -1;
  426|  10.5k|	unsigned char *buf;
  427|  10.5k|	struct stat	sb;
  428|  10.5k|	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
  429|  10.5k|	int	ispipe = 0;
  430|  10.5k|	int	okstat = 0;
  431|  10.5k|	off_t	pos = CAST(off_t, -1);
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  432|       |
  433|  10.5k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (433:6): [True: 0, False: 10.5k]
  ------------------
  434|      0|		goto out;
  435|       |
  436|       |	/*
  437|       |	 * one extra for terminating '\0', and
  438|       |	 * some overlapping space for matches near EOF
  439|       |	 */
  440|  10.5k|#define SLOP (1 + sizeof(union VALUETYPE))
  441|  10.5k|	if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (441:6): [True: 0, False: 10.5k]
  ------------------
  442|      0|		return NULL;
  443|       |
  444|  10.5k|	switch (file_fsmagic(ms, inname, &sb)) {
  445|      0|	case -1:		/* error */
  ------------------
  |  Branch (445:2): [True: 0, False: 10.5k]
  ------------------
  446|      0|		goto done;
  447|  10.5k|	case 0:			/* nothing found */
  ------------------
  |  Branch (447:2): [True: 10.5k, False: 0]
  ------------------
  448|  10.5k|		break;
  449|      0|	default:		/* matched it and printed type */
  ------------------
  |  Branch (449:2): [True: 0, False: 10.5k]
  ------------------
  450|      0|		rv = 0;
  451|      0|		goto done;
  452|  10.5k|	}
  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.5k|	if (inname != NULL) {
  ------------------
  |  Branch (459:6): [True: 0, False: 10.5k]
  ------------------
  460|      0|		int flags = O_RDONLY|O_BINARY|O_NONBLOCK|O_CLOEXEC;
  ------------------
  |  |  727|      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.5k|	if (fd != -1) {
  ------------------
  |  Branch (487:6): [True: 10.5k, False: 0]
  ------------------
  488|  10.5k|		okstat = fstat(fd, &sb) == 0;
  489|  10.5k|		if (okstat && S_ISFIFO(sb.st_mode))
  ------------------
  |  Branch (489:7): [True: 10.5k, False: 0]
  |  Branch (489:17): [True: 0, False: 10.5k]
  ------------------
  490|      0|			ispipe = 1;
  491|  10.5k|		if (inname == NULL)
  ------------------
  |  Branch (491:7): [True: 10.5k, False: 0]
  ------------------
  492|  10.5k|			pos = lseek(fd, CAST(off_t, 0), SEEK_CUR);
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  493|  10.5k|	}
  494|       |
  495|       |	/*
  496|       |	 * try looking at the first ms->bytes_max bytes
  497|       |	 */
  498|  10.5k|	if (ispipe) {
  ------------------
  |  Branch (498:6): [True: 0, False: 10.5k]
  ------------------
  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.5k|	} else if (fd != -1) {
  ------------------
  |  Branch (517:13): [True: 10.5k, False: 0]
  ------------------
  518|       |		/* Windows refuses to read from a big console buffer. */
  519|  10.5k|		size_t howmany =
  520|       |#ifdef WIN32
  521|       |		    _isatty(fd) ? 8 * 1024 :
  522|       |#endif
  523|  10.5k|		    ms->bytes_max;
  524|  10.5k|		if ((nbytes = read(fd, RCAST(void *, buf), howmany)) == -1) {
  ------------------
  |  |  453|  10.5k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (524:7): [True: 0, False: 10.5k]
  ------------------
  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.5k|	}
  533|       |
  534|  10.5k|	(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
  ------------------
  |  |  440|  10.5k|#define SLOP (1 + sizeof(union VALUETYPE))
  ------------------
  535|  10.5k|	if (file_buffer(ms, fd, okstat ? &sb : NULL, inname, buf,
  ------------------
  |  Branch (535:6): [True: 51, False: 10.4k]
  |  Branch (535:26): [True: 10.5k, False: 0]
  ------------------
  536|  10.5k|	    CAST(size_t, nbytes)) == -1)
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  537|     51|		goto done;
  538|  10.4k|	rv = 0;
  539|  10.5k|done:
  540|  10.5k|	free(buf);
  541|  10.5k|	if (fd != -1) {
  ------------------
  |  Branch (541:6): [True: 10.5k, False: 0]
  ------------------
  542|  10.5k|		if (pos != CAST(off_t, -1))
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (542:7): [True: 10.5k, False: 0]
  ------------------
  543|  10.5k|			(void)lseek(fd, pos, SEEK_SET);
  544|  10.5k|		close_and_restore(ms, inname, fd, okstat ? &sb : NULL);
  ------------------
  |  Branch (544:37): [True: 10.5k, False: 0]
  ------------------
  545|  10.5k|	}
  546|  10.5k|out:
  547|  10.5k|	return rv == 0 ? file_getbuffer(ms) : NULL;
  ------------------
  |  Branch (547:9): [True: 10.4k, False: 51]
  ------------------
  548|  10.5k|}
magic.c:close_and_restore:
  367|  10.5k|{
  368|  10.5k|	if (fd == STDIN_FILENO || name == NULL)
  ------------------
  |  Branch (368:6): [True: 0, False: 10.5k]
  |  Branch (368:28): [True: 10.5k, False: 0]
  ------------------
  369|  10.5k|		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|  1.99k|{
  312|  1.99k|	char *pp;
  313|  1.99k|	time_t t;
  314|  1.99k|	struct tm *tm, tmz;
  315|       |
  316|  1.99k|	if (flags & FILE_T_WINDOWS) {
  ------------------
  |  |  541|  1.99k|#define FILE_T_WINDOWS	2
  ------------------
  |  Branch (316:6): [True: 922, False: 1.07k]
  ------------------
  317|    922|		struct timespec ts;
  318|    922|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  452|    922|#define CAST(T, b)	((T)(b))
  ------------------
  319|    922|		t = ts.tv_sec;
  320|  1.07k|	} else {
  321|       |		// XXX: perhaps detect and print something if overflow
  322|       |		// on 32 bit time_t?
  323|  1.07k|		t = CAST(time_t, v);
  ------------------
  |  |  452|  1.07k|#define CAST(T, b)	((T)(b))
  ------------------
  324|  1.07k|	}
  325|       |
  326|  1.99k|	if (t > MAX_CTIME)
  ------------------
  |  |  173|  1.99k|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  452|  3.98k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.99k, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (326:6): [True: 300, False: 1.69k]
  ------------------
  327|    300|		goto out;
  328|       |
  329|  1.69k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  540|  1.69k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (329:6): [True: 264, False: 1.42k]
  ------------------
  330|    264|		tzset();
  331|    264|		tm = localtime_r(&t, &tmz);
  332|  1.42k|	} else {
  333|  1.42k|		tm = gmtime_r(&t, &tmz);
  334|  1.42k|	}
  335|  1.69k|	if (tm == NULL)
  ------------------
  |  Branch (335:6): [True: 175, False: 1.51k]
  ------------------
  336|    175|		goto out;
  337|  1.51k|	pp = asctime_r(tm, buf);
  338|       |
  339|  1.51k|	if (pp == NULL)
  ------------------
  |  Branch (339:6): [True: 307, False: 1.21k]
  ------------------
  340|    307|		goto out;
  341|  1.21k|	pp[strcspn(pp, "\n")] = '\0';
  342|  1.21k|	return pp;
  343|    782|out:
  344|    782|	strlcpy(buf, "*Invalid datetime*", bsize);
  345|    782|	return buf;
  346|  1.51k|}
file_fmtdate:
  354|    236|{
  355|    236|	struct tm tm;
  356|       |
  357|    236|	memset(&tm, 0, sizeof(tm));
  358|    236|	tm.tm_mday = v & 0x1f;
  359|    236|	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|    236|	if (tm.tm_mon < 0 || tm.tm_mon > 11)
  ------------------
  |  Branch (362:6): [True: 85, False: 151]
  |  Branch (362:23): [True: 94, False: 57]
  ------------------
  363|    179|		tm.tm_mon = 0;
  364|    236|	tm.tm_year = (v >> 9) + 80;
  365|       |
  366|    236|	if (strftime(buf, bsize, "%b %d %Y", &tm) == 0)
  ------------------
  |  Branch (366:6): [True: 0, False: 236]
  ------------------
  367|      0|		goto out;
  368|       |
  369|    236|	return buf;
  370|      0|out:
  371|      0|	strlcpy(buf, "*Invalid date*", bsize);
  372|      0|	return buf;
  373|    236|}
file_fmttime:
  377|    236|{
  378|    236|	struct tm tm;
  379|       |
  380|    236|	memset(&tm, 0, sizeof(tm));
  381|    236|	tm.tm_sec = (v & 0x1f) * 2;
  382|    236|	tm.tm_min = ((v >> 5) & 0x3f);
  383|    236|	tm.tm_hour = (v >> 11);
  384|       |
  385|    236|	if (strftime(buf, bsize, "%T", &tm) == 0)
  ------------------
  |  Branch (385:6): [True: 0, False: 236]
  ------------------
  386|      0|		goto out;
  387|       |
  388|    236|	return buf;
  389|      0|out:
  390|      0|	strlcpy(buf, "*Invalid time*", bsize);
  391|      0|	return buf;
  392|       |
  393|    236|}

file_trycdf:
  562|  13.0k|{
  563|  13.0k|	int fd = b->fd;
  564|  13.0k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
  565|  13.0k|	size_t nbytes = b->flen;
  566|  13.0k|	cdf_info_t info;
  567|  13.0k|	cdf_header_t h;
  568|  13.0k|	cdf_sat_t sat, ssat;
  569|  13.0k|	cdf_stream_t sst, scn;
  570|  13.0k|	cdf_dir_t dir;
  571|  13.0k|	int i;
  572|  13.0k|	const char *expn = "";
  573|  13.0k|	const cdf_directory_t *root_storage;
  574|       |
  575|  13.0k|	scn.sst_tab = NULL;
  576|  13.0k|	info.i_fd = fd;
  577|  13.0k|	info.i_buf = buf;
  578|  13.0k|	info.i_len = nbytes;
  579|  13.0k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  13.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  13.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (579:6): [True: 0, False: 13.0k]
  ------------------
  580|      0|		return 0;
  581|  13.0k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (581:6): [True: 11.5k, False: 1.47k]
  ------------------
  582|  11.5k|		return 0;
  583|       |#ifdef CDF_DEBUG
  584|       |	cdf_dump_header(&h);
  585|       |#endif
  586|       |
  587|  1.47k|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (587:6): [True: 175, False: 1.30k]
  ------------------
  588|    175|		expn = "Can't read SAT";
  589|    175|		goto out0;
  590|    175|	}
  591|       |#ifdef CDF_DEBUG
  592|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  593|       |#endif
  594|       |
  595|  1.30k|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (595:6): [True: 231, False: 1.07k]
  ------------------
  596|    231|		expn = "Can't read SSAT";
  597|    231|		goto out1;
  598|    231|	}
  599|       |#ifdef CDF_DEBUG
  600|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  601|       |#endif
  602|       |
  603|  1.07k|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (603:6): [True: 119, False: 952]
  ------------------
  604|    119|		expn = "Can't read directory";
  605|    119|		goto out2;
  606|    119|	}
  607|       |
  608|    952|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (608:6): [True: 89, False: 863]
  ------------------
  609|    952|	    &root_storage)) == -1) {
  610|     89|		expn = "Cannot read short stream";
  611|     89|		goto out3;
  612|     89|	}
  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|    863|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (628:6): [True: 5, False: 858]
  ------------------
  629|    863|	    "FileHeader", &scn) != -1) {
  630|      5|#define HWP5_SIGNATURE "HWP Document File"
  631|      5|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  630|      5|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (631:7): [True: 4, False: 1]
  ------------------
  632|      4|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  630|      4|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (632:10): [True: 1, False: 3]
  ------------------
  633|      4|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  630|      4|#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|      4|		} else {
  645|      4|		    cdf_zero_stream(&scn);
  646|      4|		}
  647|      5|	}
  648|       |
  649|    862|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (649:6): [True: 270, False: 592]
  ------------------
  650|    862|	    &scn)) == -1) {
  651|    270|		if (errno != ESRCH) {
  ------------------
  |  Branch (651:7): [True: 126, False: 144]
  ------------------
  652|    126|			expn = "Cannot read summary info";
  653|    126|		}
  654|    592|	} else {
  655|    592|		i = cdf_check_summary_info(ms, &info, &h,
  656|    592|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  657|    592|		cdf_zero_stream(&scn);
  658|    592|	}
  659|    862|	if (i <= 0) {
  ------------------
  |  Branch (659:6): [True: 752, False: 110]
  ------------------
  660|    752|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (660:7): [True: 625, False: 127]
  ------------------
  661|    752|		    &sst, &dir, &scn)) == -1) {
  662|    625|			if (errno != ESRCH) {
  ------------------
  |  Branch (662:8): [True: 35, False: 590]
  ------------------
  663|     35|				expn = "Cannot read summary info";
  664|     35|			}
  665|    625|		} else {
  666|    127|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  667|    127|			    &sst, &dir, &scn, root_storage, &expn);
  668|    127|		}
  669|    752|	}
  670|    862|	if (i <= 0) {
  ------------------
  |  Branch (670:6): [True: 752, False: 110]
  ------------------
  671|    752|		i = cdf_file_dir_info(ms, &dir);
  672|    752|		if (i < 0)
  ------------------
  |  Branch (672:7): [True: 721, False: 31]
  ------------------
  673|    721|			expn = "Cannot read section info";
  674|    752|	}
  675|    863|out5:
  676|    863|	cdf_zero_stream(&scn);
  677|    863|	cdf_zero_stream(&sst);
  678|    952|out3:
  679|    952|	free(dir.dir_tab);
  680|  1.07k|out2:
  681|  1.07k|	free(ssat.sat_tab);
  682|  1.30k|out1:
  683|  1.30k|	free(sat.sat_tab);
  684|  1.47k|out0:
  685|       |	/* If we handled it already, return */
  686|  1.47k|	if (i != -1)
  ------------------
  |  Branch (686:6): [True: 142, False: 1.33k]
  ------------------
  687|    142|		return i;
  688|       |	/* Provide a default handler */
  689|  1.33k|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|  1.33k|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|  1.33k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.33k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.33k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1.33k, False: 0]
  |  |  ------------------
  ------------------
  690|  1.33k|		if (file_printf(ms,
  ------------------
  |  Branch (690:7): [True: 0, False: 1.33k]
  ------------------
  691|  1.33k|		    "Composite Document File V2 Document") == -1)
  692|      0|			return -1;
  693|  1.33k|		if (*expn)
  ------------------
  |  Branch (693:7): [True: 1.33k, False: 0]
  ------------------
  694|  1.33k|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (694:8): [True: 0, False: 1.33k]
  ------------------
  695|      0|				return -1;
  696|  1.33k|	} 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.33k|	return 1;
  702|  1.33k|}
readcdf.c:cdf_check_summary_info:
  396|    719|{
  397|    719|	int i;
  398|    719|	const char *str = NULL;
  399|    719|	cdf_directory_t *d;
  400|    719|	char name[__arraycount(d->d_name)];
  401|    719|	size_t j, k;
  402|       |
  403|       |#ifdef CDF_DEBUG
  404|       |	cdf_dump_summary_info(h, scn);
  405|       |#endif
  406|    719|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (406:6): [True: 609, False: 110]
  ------------------
  407|    609|	    *expn = "Can't expand summary_info";
  408|    609|	    return i;
  409|    609|	}
  410|    110|	if (i == 1)
  ------------------
  |  Branch (410:6): [True: 110, False: 0]
  ------------------
  411|    110|		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|    719|{
  305|    719|	cdf_summary_info_header_t si;
  306|    719|	cdf_property_info_t *info;
  307|    719|	size_t count;
  308|    719|	int m;
  309|       |
  310|    719|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (310:6): [True: 483, False: 236]
  ------------------
  311|    483|		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: 51, False: 185]
  ------------------
  322|      0|			return -2;
  323|    236|		switch (si.si_os) {
  324|     49|		case 2:
  ------------------
  |  Branch (324:3): [True: 49, False: 187]
  ------------------
  325|     49|			if (file_printf(ms, ", Os: Windows, Version %d.%d",
  ------------------
  |  Branch (325:8): [True: 0, False: 49]
  ------------------
  326|     49|			    si.si_os_version & 0xff,
  327|     49|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  452|     49|#define CAST(T, b)	((T)(b))
  ------------------
  328|      0|				return -2;
  329|     49|			break;
  330|     49|		case 1:
  ------------------
  |  Branch (330:3): [True: 20, False: 216]
  ------------------
  331|     20|			if (file_printf(ms, ", Os: MacOS, Version %d.%d",
  ------------------
  |  Branch (331:8): [True: 0, False: 20]
  ------------------
  332|     20|			    CAST(uint32_t, si.si_os_version) >> 8,
  ------------------
  |  |  452|     20|#define CAST(T, b)	((T)(b))
  ------------------
  333|     20|			    si.si_os_version & 0xff) == -1)
  334|      0|				return -2;
  335|     20|			break;
  336|    167|		default:
  ------------------
  |  Branch (336:3): [True: 167, False: 69]
  ------------------
  337|    167|			if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
  ------------------
  |  Branch (337:8): [True: 0, False: 167]
  ------------------
  338|    167|			    si.si_os_version & 0xff,
  339|    167|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  452|    167|#define CAST(T, b)	((T)(b))
  ------------------
  340|      0|				return -2;
  341|    167|			break;
  342|    236|		}
  343|    236|		if (root_storage) {
  ------------------
  |  Branch (343:7): [True: 86, False: 150]
  ------------------
  344|     86|			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  345|     86|			    clsid2desc);
  346|     86|			if (str) {
  ------------------
  |  Branch (346:8): [True: 0, False: 86]
  ------------------
  347|      0|				if (file_printf(ms, ", %s", str) == -1)
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      0|					return -2;
  349|      0|			}
  350|     86|		}
  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: 126, False: 110]
  ------------------
  357|    236|}
readcdf.c:cdf_clsid_to_mime:
   97|     86|{
   98|     86|	size_t i;
   99|    172|	for (i = 0; cv[i].mime != NULL; i++) {
  ------------------
  |  Branch (99:14): [True: 86, False: 86]
  ------------------
  100|     86|		if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
  ------------------
  |  Branch (100:7): [True: 0, False: 86]
  |  Branch (100:37): [True: 0, False: 0]
  ------------------
  101|      0|			return cv[i].mime;
  102|     86|	}
  103|       |#ifdef CDF_DEBUG
  104|       |	fprintf(stderr, "unknown mime %" PRIx64 ", %" PRIx64 "\n", clsid[0],
  105|       |	    clsid[1]);
  106|       |#endif
  107|     86|	return NULL;
  108|     86|}
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.59k|	for (i = 0; i < count; i++) {
  ------------------
  |  Branch (163:14): [True: 1.48k, False: 110]
  ------------------
  164|  1.48k|		cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
  165|  1.48k|		switch (info[i].pi_type) {
  166|    233|		case CDF_NULL:
  ------------------
  |  |  198|    233|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (166:3): [True: 233, False: 1.25k]
  ------------------
  167|    233|			break;
  168|    178|		case CDF_SIGNED16:
  ------------------
  |  |  199|    178|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (168:3): [True: 178, False: 1.30k]
  ------------------
  169|    178|			if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
  ------------------
  |  |   42|    356|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    178|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    178|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    178|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 178, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (169:23): [True: 0, False: 178]
  ------------------
  170|    178|			    info[i].pi_s16) == -1)
  ------------------
  |  |  187|    178|#define pi_s16	pi_val._pi_s16
  ------------------
  171|      0|				return -1;
  172|    178|			break;
  173|    178|		case CDF_SIGNED32:
  ------------------
  |  |  200|    132|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (173:3): [True: 132, False: 1.35k]
  ------------------
  174|    132|			if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
  ------------------
  |  |   42|    264|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    132|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    132|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    132|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 132, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (174:23): [True: 0, False: 132]
  ------------------
  175|    132|			    info[i].pi_s32) == -1)
  ------------------
  |  |  185|    132|#define pi_s32	pi_val._pi_s32
  ------------------
  176|      0|				return -1;
  177|    132|			break;
  178|    132|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|     52|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (178:3): [True: 52, False: 1.43k]
  ------------------
  179|     52|			if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
  ------------------
  |  |   42|    104|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     52|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     52|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     52|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 52, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (179:23): [True: 0, False: 52]
  ------------------
  180|     52|			    info[i].pi_u32) == -1)
  ------------------
  |  |  184|     52|#define pi_u32	pi_val._pi_u32
  ------------------
  181|      0|				return -1;
  182|     52|			break;
  183|     89|		case CDF_FLOAT:
  ------------------
  |  |  201|     89|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (183:3): [True: 89, False: 1.39k]
  ------------------
  184|     89|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    178|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     89|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     89|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     89|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 89, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (184:23): [True: 0, False: 89]
  ------------------
  185|     89|			    info[i].pi_f) == -1)
  ------------------
  |  |  188|     89|#define pi_f	pi_val._pi_f
  ------------------
  186|      0|				return -1;
  187|     89|			break;
  188|     89|		case CDF_DOUBLE:
  ------------------
  |  |  202|     66|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (188:3): [True: 66, False: 1.41k]
  ------------------
  189|     66|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    132|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     66|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     66|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     66|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 66, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (189:23): [True: 0, False: 66]
  ------------------
  190|     66|			    info[i].pi_d) == -1)
  ------------------
  |  |  189|     66|#define pi_d	pi_val._pi_d
  ------------------
  191|      0|				return -1;
  192|     66|			break;
  193|     93|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|     93|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (193:3): [True: 93, False: 1.39k]
  ------------------
  194|    208|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    208|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (194:3): [True: 115, False: 1.36k]
  ------------------
  195|    208|			len = info[i].pi_str.s_len;
  ------------------
  |  |  191|    208|#define pi_str	pi_val._pi_str
  ------------------
  196|    208|			if (len > 1) {
  ------------------
  |  Branch (196:8): [True: 164, False: 44]
  ------------------
  197|    164|				char vbuf[1024];
  198|    164|				size_t j, k = 1;
  199|       |
  200|    164|				if (info[i].pi_type == CDF_LENGTH32_WSTRING)
  ------------------
  |  |  227|    164|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (200:9): [True: 79, False: 85]
  ------------------
  201|     79|				    k++;
  202|    164|				s = info[i].pi_str.s_buf;
  ------------------
  |  |  191|    164|#define pi_str	pi_val._pi_str
  ------------------
  203|    164|				e = info[i].pi_str.s_buf + len;
  ------------------
  |  |  191|    164|#define pi_str	pi_val._pi_str
  ------------------
  204|  51.9k|				for (j = 0; s < e && j < sizeof(vbuf)
  ------------------
  |  Branch (204:17): [True: 51.9k, False: 32]
  |  Branch (204:26): [True: 51.9k, False: 10]
  ------------------
  205|  51.9k|				    && len--; s += k) {
  ------------------
  |  Branch (205:12): [True: 51.9k, False: 0]
  ------------------
  206|  51.9k|					if (*s == '\0')
  ------------------
  |  Branch (206:10): [True: 122, False: 51.8k]
  ------------------
  207|    122|						break;
  208|  51.8k|					if (isprint(CAST(unsigned char, *s)))
  ------------------
  |  Branch (208:10): [True: 26.6k, False: 25.1k]
  ------------------
  209|  26.6k|						vbuf[j++] = *s;
  210|  51.8k|				}
  211|    164|				if (j == sizeof(vbuf))
  ------------------
  |  Branch (211:9): [True: 10, False: 154]
  ------------------
  212|     10|					--j;
  213|    164|				vbuf[j] = '\0';
  214|    164|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|    164|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    164|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    164|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    164|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 164, False: 0]
  |  |  ------------------
  ------------------
  215|    164|					if (vbuf[0]) {
  ------------------
  |  Branch (215:10): [True: 128, False: 36]
  ------------------
  216|    128|						if (file_printf(ms, ", %s: %s",
  ------------------
  |  Branch (216:11): [True: 6, False: 122]
  ------------------
  217|    128|						    buf, vbuf) == -1)
  218|      6|							return -1;
  219|    128|					}
  220|    164|				} 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|    164|			}
  230|    202|			break;
  231|    386|		case CDF_FILETIME:
  ------------------
  |  |  228|    386|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (231:3): [True: 386, False: 1.09k]
  ------------------
  232|    386|			tp = info[i].pi_tp;
  ------------------
  |  |  190|    386|#define pi_tp	pi_val._pi_tp
  ------------------
  233|    386|			if (tp != 0) {
  ------------------
  |  Branch (233:8): [True: 363, False: 23]
  ------------------
  234|    363|				char tbuf[64];
  235|    363|				if (tp < 1000000000000000LL) {
  ------------------
  |  Branch (235:9): [True: 151, False: 212]
  ------------------
  236|    151|					cdf_print_elapsed_time(tbuf,
  237|    151|					    sizeof(tbuf), tp);
  238|    151|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    302|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    151|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    151|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    151|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 151, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (238:25): [True: 0, False: 151]
  ------------------
  239|    151|					    ", %s: %s", buf, tbuf) == -1)
  240|      0|						return -1;
  241|    212|				} else {
  242|    212|					char *c, *ec;
  243|    212|					cdf_timestamp_to_timespec(&ts, tp);
  244|    212|					c = cdf_ctime(&ts.tv_sec, tbuf);
  245|    212|					if (c != NULL &&
  ------------------
  |  Branch (245:10): [True: 212, False: 0]
  ------------------
  246|    212|					    (ec = strchr(c, '\n')) != NULL)
  ------------------
  |  Branch (246:10): [True: 212, False: 0]
  ------------------
  247|    212|						*ec = '\0';
  248|       |
  249|    212|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    424|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    212|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    212|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    212|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 212, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (249:25): [True: 0, False: 212]
  ------------------
  250|    212|					    ", %s: %s", buf, c) == -1)
  251|      0|						return -1;
  252|    212|				}
  253|    363|			}
  254|    386|			break;
  255|    386|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|     20|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (255:3): [True: 20, False: 1.46k]
  ------------------
  256|     20|			break;
  257|    120|		default:
  ------------------
  |  Branch (257:3): [True: 120, False: 1.36k]
  ------------------
  258|    120|			return -1;
  259|  1.48k|		}
  260|  1.48k|	}
  261|    110|	if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|    110|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (261:6): [True: 0, False: 110]
  ------------------
  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|    110|	return 1;
  268|    110|}
readcdf.c:cdf_file_dir_info:
  518|    752|{
  519|    752|	size_t sd, i, j;
  520|    752|	uint16_t *dir_name;
  521|    752|	int dir_type;
  522|    752|	const char* section_name;
  523|       |
  524|  8.01k|	for (i = 0; i < dir->dir_len; i++) {
  ------------------
  |  Branch (524:14): [True: 7.29k, False: 721]
  ------------------
  525|  7.29k|		dir_name = dir->dir_tab[i].d_name;
  526|  7.29k|		dir_type = dir->dir_tab[i].d_type;
  527|       |
  528|  50.9k|		for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  130|  50.9k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (528:16): [True: 43.6k, False: 7.26k]
  ------------------
  529|  43.6k|			const struct sinfo *si = &sectioninfo[sd];
  530|   109k|			for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (530:16): [True: 65.5k, False: 43.6k]
  ------------------
  531|  65.5k|				if (si->sections[j] == NULL)
  ------------------
  |  Branch (531:9): [True: 0, False: 65.5k]
  ------------------
  532|      0|					continue;
  533|  65.5k|				section_name = si->sections[j];
  534|  65.5k|				if (si->types[j] != dir_type ||
  ------------------
  |  Branch (534:9): [True: 54.9k, False: 10.5k]
  ------------------
  535|  10.5k|				    cdf_namecmp(section_name, dir_name,
  ------------------
  |  Branch (535:9): [True: 10.5k, False: 31]
  ------------------
  536|  10.5k|					strlen(section_name) + 1) != 0)
  537|  65.5k|				    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|     31|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|     31|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     31|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     31|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     31|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 31, False: 0]
  |  |  ------------------
  ------------------
  545|     31|					if (file_printf(ms, "CDFV2 %s",
  ------------------
  |  Branch (545:10): [True: 0, False: 31]
  ------------------
  546|     31|					    si->name) == -1)
  547|      0|						return -1;
  548|     31|				} 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|     31|				return 1;
  554|     31|			}
  555|  43.6k|		}
  556|  7.29k|	}
  557|    721|	return -1;
  558|    752|}

file_tryelf:
 1896|  7.40k|{
 1897|  7.40k|	int fd = b->fd;
 1898|  7.40k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  452|  7.40k|#define CAST(T, b)	((T)(b))
  ------------------
 1899|  7.40k|	size_t nbytes = b->flen;
 1900|  7.40k|	union {
 1901|  7.40k|		int32_t l;
 1902|  7.40k|		char c[sizeof(int32_t)];
 1903|  7.40k|	} u;
 1904|  7.40k|	int clazz;
 1905|  7.40k|	int swap;
 1906|  7.40k|	struct stat st;
 1907|  7.40k|	const struct stat *stp;
 1908|  7.40k|	off_t fsize;
 1909|  7.40k|	int flags = 0;
 1910|  7.40k|	Elf32_Ehdr elf32hdr;
 1911|  7.40k|	Elf64_Ehdr elf64hdr;
 1912|  7.40k|	uint16_t type, phnum, shnum, notecount;
 1913|       |
 1914|  7.40k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  7.40k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  7.40k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (1914:6): [True: 0, False: 7.40k]
  ------------------
 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.40k|	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  157|  7.40k|#define	EI_MAG0		0		/* e_ident[] indexes */
  ------------------
              	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  166|  14.8k|#define	ELFMAG0		0x7f		/* EI_MAG */
  ------------------
  |  Branch (1924:6): [True: 3.46k, False: 3.93k]
  ------------------
 1925|  3.93k|	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  3.93k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  167|  7.87k|#define	ELFMAG1		'E'
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  3.22k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  172|  3.22k|#define	OLFMAG1		'O'
  ------------------
  |  Branch (1925:10): [True: 3.22k, False: 711]
  |  Branch (1925:37): [True: 15, False: 3.21k]
  ------------------
 1926|  3.92k|	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  159|  3.92k|#define	EI_MAG2		2
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  168|  11.3k|#define	ELFMAG2		'L'
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  160|  3.91k|#define	EI_MAG3		3
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  169|  3.91k|#define	ELFMAG3		'F'
  ------------------
  |  Branch (1926:9): [True: 12, False: 3.91k]
  |  Branch (1926:36): [True: 9, False: 3.90k]
  ------------------
 1927|  3.50k|		return 0;
 1928|       |
 1929|       |	/*
 1930|       |	 * If we cannot seek, it must be a pipe, socket or fifo.
 1931|       |	 */
 1932|  3.90k|	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  452|  3.90k|#define CAST(T, b)	((T)(b))
  ------------------
              	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  452|  3.90k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1932:5): [True: 0, False: 3.90k]
  ------------------
 1933|      0|	    && (errno == ESPIPE))
  ------------------
  |  Branch (1933:9): [True: 0, False: 0]
  ------------------
 1934|      0|		fd = file_pipe2file(ms, fd, buf, nbytes);
 1935|       |
 1936|  3.90k|	if (fd == -1) {
  ------------------
  |  Branch (1936:6): [True: 0, False: 3.90k]
  ------------------
 1937|      0|		file_badread(ms);
 1938|      0|		return -1;
 1939|      0|	}
 1940|       |
 1941|  3.90k|	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.90k|	if (b->st.st_size == 0) {
  ------------------
  |  Branch (1946:6): [True: 0, False: 3.90k]
  ------------------
 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.90k|	if (S_ISREG(stp->st_mode) || stp->st_size != 0)
  ------------------
  |  Branch (1953:6): [True: 3.90k, False: 0]
  |  Branch (1953:31): [True: 0, False: 0]
  ------------------
 1954|  3.90k|		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.90k|	clazz = buf[EI_CLASS];
  ------------------
  |  |  161|  3.90k|#define	EI_CLASS	4
  ------------------
 1959|       |
 1960|  3.90k|	switch (clazz) {
 1961|  2.47k|	case ELFCLASS32:
  ------------------
  |  |  153|  2.47k|#define	ELFCLASS32	1
  ------------------
  |  Branch (1961:2): [True: 2.47k, False: 1.42k]
  ------------------
 1962|  2.47k|#undef elf_getu
 1963|  2.47k|#define elf_getu(a, b)	elf_getu32(a, b)
 1964|  2.47k|#undef elfhdr
 1965|  2.47k|#define elfhdr elf32hdr
 1966|  2.47k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  2.47k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1965|  2.47k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 19, False: 2.45k]
  |  |  ------------------
  |  |   28|     19|		return 0;
  |  |   29|       |
  |  |   30|  2.45k|	u.l = 1;
  |  |   31|  2.45k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.45k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.45k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |   32|  2.45k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1965|  2.45k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  2.45k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  2.45k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  2.45k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  2.45k|	notecount = ms->elf_notes_max;
  |  |   36|  2.45k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|  1.50k|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|  1.50k|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 1.50k, False: 952]
  |  |  ------------------
  |  |   39|  1.50k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|  1.50k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|  1.50k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 19, False: 1.48k]
  |  |  ------------------
  |  |   41|     19|			return toomany(ms, "program headers", phnum);
  |  |   42|  1.48k|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|  1.48k|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|  1.48k|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 1.48k]
  |  |  ------------------
  |  |   44|  1.48k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|  1.48k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|  1.48k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|  1.48k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|  1.48k|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|  1.48k|		break;
  |  |   49|  1.48k|#endif
  |  |   50|  1.48k|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    849|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 849, False: 1.60k]
  |  |  ------------------
  |  |   51|    934|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    934|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 85, False: 2.37k]
  |  |  ------------------
  |  |   52|    934|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    934|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    934|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 17, False: 917]
  |  |  ------------------
  |  |   54|     17|			return toomany(ms, "program", phnum);
  |  |   55|    917|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    917|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    917|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 14, False: 903]
  |  |  ------------------
  |  |   57|     14|			return toomany(ms, "section", shnum);
  |  |   58|    903|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 2, False: 901]
  |  |  ------------------
  |  |   59|    903|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|    903|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    903|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|    903|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    903|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      2|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|    916|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|    916|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 15, False: 2.44k]
  |  |  ------------------
  |  |   65|    916|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    916|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|    916|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 9, False: 907]
  |  |  ------------------
  |  |   67|      9|			return toomany(ms, "section headers", shnum);
  |  |   68|    907|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 40, False: 867]
  |  |  ------------------
  |  |   69|    907|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  452|    907|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|    907|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  452|    907|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|    907|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|    907|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|    907|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  452|    907|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    907|		    &flags, &notecount) == -1)
  |  |   74|     40|			return -1;
  |  |   75|    867|		break;
  |  |   76|       |
  |  |   77|    867|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 3, False: 2.45k]
  |  |  ------------------
  |  |   78|      3|		break;
  |  |   79|  2.45k|	}
  |  |   80|  2.35k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 10, False: 2.34k]
  |  |  ------------------
  |  |   81|     10|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  2.34k|	return 1;
  ------------------
 1967|  1.42k|	case ELFCLASS64:
  ------------------
  |  |  154|  1.42k|#define	ELFCLASS64	2
  ------------------
  |  Branch (1967:2): [True: 1.42k, False: 2.48k]
  ------------------
 1968|  1.42k|#undef elf_getu
 1969|  1.42k|#define elf_getu(a, b)	elf_getu64(a, b)
 1970|  1.42k|#undef elfhdr
 1971|  1.42k|#define elfhdr elf64hdr
 1972|  1.42k|#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.42k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1971|  1.42k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 9, False: 1.41k]
  |  |  ------------------
  |  |   28|      9|		return 0;
  |  |   29|       |
  |  |   30|  1.41k|	u.l = 1;
  |  |   31|  1.41k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.41k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.41k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |   32|  1.41k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1971|  1.41k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  1.41k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  1.41k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  1.41k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  1.41k|	notecount = ms->elf_notes_max;
  |  |   36|  1.41k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|    475|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|    475|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 475, False: 936]
  |  |  ------------------
  |  |   39|    475|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    475|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|    475|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 20, False: 455]
  |  |  ------------------
  |  |   41|     20|			return toomany(ms, "program headers", phnum);
  |  |   42|    455|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|    455|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|    455|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 455]
  |  |  ------------------
  |  |   44|    455|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|    455|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|    455|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|    455|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|    455|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|    455|		break;
  |  |   49|    455|#endif
  |  |   50|    539|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    539|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 539, False: 872]
  |  |  ------------------
  |  |   51|    858|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    858|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 319, False: 1.09k]
  |  |  ------------------
  |  |   52|    858|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    858|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    858|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 22, False: 836]
  |  |  ------------------
  |  |   54|     22|			return toomany(ms, "program", phnum);
  |  |   55|    836|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    836|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    836|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 12, False: 824]
  |  |  ------------------
  |  |   57|     12|			return toomany(ms, "section", shnum);
  |  |   58|    824|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 823]
  |  |  ------------------
  |  |   59|    824|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  452|    824|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    824|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  452|    824|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    824|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|    899|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|    899|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 76, False: 1.33k]
  |  |  ------------------
  |  |   65|    899|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    899|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|    899|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 11, False: 888]
  |  |  ------------------
  |  |   67|     11|			return toomany(ms, "section headers", shnum);
  |  |   68|    888|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 40, False: 848]
  |  |  ------------------
  |  |   69|    888|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  452|    888|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|    888|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  452|    888|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|    888|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|    888|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|    888|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  452|    888|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    888|		    &flags, &notecount) == -1)
  |  |   74|     40|			return -1;
  |  |   75|    848|		break;
  |  |   76|       |
  |  |   77|    848|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 2, False: 1.40k]
  |  |  ------------------
  |  |   78|      2|		break;
  |  |   79|  1.41k|	}
  |  |   80|  1.30k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 3, False: 1.30k]
  |  |  ------------------
  |  |   81|      3|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  1.30k|	return 1;
  ------------------
 1973|      8|	default:
  ------------------
  |  Branch (1973:2): [True: 8, False: 3.89k]
  ------------------
 1974|      8|	    if (elf_printf(ms, ", unknown class %d", clazz) == -1)
  ------------------
  |  Branch (1974:10): [True: 0, False: 8]
  ------------------
 1975|      0|		    return -1;
 1976|      8|	    break;
 1977|  3.90k|	}
 1978|      8|	return 0;
 1979|  3.90k|}
readelf.c:getu16:
   94|  20.2k|{
   95|  20.2k|	union {
   96|  20.2k|		uint16_t ui;
   97|  20.2k|		char c[2];
   98|  20.2k|	} retval, tmpval;
   99|       |
  100|  20.2k|	if (swap) {
  ------------------
  |  Branch (100:6): [True: 7.25k, False: 13.0k]
  ------------------
  101|  7.25k|		tmpval.ui = value;
  102|       |
  103|  7.25k|		retval.c[0] = tmpval.c[1];
  104|  7.25k|		retval.c[1] = tmpval.c[0];
  105|       |
  106|  7.25k|		return retval.ui;
  107|  7.25k|	} else
  108|  13.0k|		return value;
  109|  20.2k|}
readelf.c:toomany:
   86|    137|{
   87|    137|	if (elf_printf(ms, ", too many %s (%u)", name, num) == -1)
  ------------------
  |  Branch (87:6): [True: 0, False: 137]
  ------------------
   88|      0|		return -1;
   89|    137|	return 1;
   90|    137|}
readelf.c:dophn_core:
  367|  1.93k|{
  368|  1.93k|	Elf32_Phdr ph32;
  369|  1.93k|	Elf64_Phdr ph64;
  370|  1.93k|	size_t offset, len;
  371|  1.93k|	unsigned char nbuf[NBUFSIZE];
  372|  1.93k|	ssize_t bufsize;
  373|  1.93k|	off_t ph_off = off, offs;
  374|  1.93k|	int ph_num = num;
  375|       |
  376|  1.93k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.93k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.93k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.93k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (376:6): [True: 0, False: 1.93k]
  ------------------
  377|      0|		return 0;
  378|       |
  379|  1.93k|	if (num == 0) {
  ------------------
  |  Branch (379:6): [True: 1, False: 1.93k]
  ------------------
  380|      1|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (380:7): [True: 0, False: 1]
  ------------------
  381|      0|			return -1;
  382|      1|		return 0;
  383|      1|	}
  384|  1.93k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  1.93k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.93k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 1.48k, False: 455]
  |  |  ------------------
  |  |  184|  1.93k|			 ? sizeof(ph32)				\
  |  |  185|  1.93k|			 : sizeof(ph64))
  ------------------
  |  Branch (384:6): [True: 17, False: 1.92k]
  ------------------
  385|     17|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (385:7): [True: 0, False: 17]
  ------------------
  386|      0|			return -1;
  387|     17|		return 0;
  388|     17|	}
  389|       |
  390|       |	/*
  391|       |	 * Loop through all the program headers.
  392|       |	 */
  393|  20.3k|	for ( ; num; num--) {
  ------------------
  |  Branch (393:10): [True: 20.2k, False: 77]
  ------------------
  394|  20.2k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  20.2k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 13.1k, False: 7.12k]
  |  |  ------------------
  |  |  181|  20.2k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  452|  13.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  20.2k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  452|  7.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  20.2k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 13.1k, False: 7.12k]
  |  |  ------------------
  |  |  184|  20.2k|			 ? sizeof(ph32)				\
  |  |  185|  20.2k|			 : sizeof(ph64))
  ------------------
  |  Branch (394:7): [True: 1.82k, False: 18.4k]
  ------------------
  395|  20.2k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  452|  40.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 13.1k, False: 7.12k]
  |  |  ------------------
  ------------------
  396|  1.82k|			if (elf_printf(ms, 
  ------------------
  |  Branch (396:8): [True: 0, False: 1.82k]
  ------------------
  397|  1.82k|			    ", can't read elf program headers at %jd",
  398|  1.82k|			    (intmax_t)off) == -1)
  399|      0|				return -1;
  400|  1.82k|			return 0;
  401|  1.82k|		}
  402|  18.4k|		off += size;
  403|       |
  404|  18.4k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  18.4k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  36.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  18.4k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  36.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 11.7k, False: 6.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  18.4k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  18.4k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (404:7): [True: 18.4k, False: 0]
  |  Branch (404:32): [True: 7.68k, False: 10.7k]
  ------------------
  405|       |			/* Perhaps warn here */
  406|  7.68k|			continue;
  407|  7.68k|		}
  408|       |
  409|  10.7k|		if (xph_type != PT_NOTE)
  ------------------
  |  |  186|  10.7k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  10.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 7.23k, False: 3.55k]
  |  |  ------------------
  |  |  187|  10.7k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  7.23k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  10.7k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  3.55k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
              		if (xph_type != PT_NOTE)
  ------------------
  |  |  201|  10.7k|#define	PT_NOTE		4
  ------------------
  |  Branch (409:7): [True: 5.23k, False: 5.54k]
  ------------------
  410|  5.23k|			continue;
  411|       |
  412|       |		/*
  413|       |		 * This is a PT_NOTE section; loop through all the notes
  414|       |		 * in the section.
  415|       |		 */
  416|  5.54k|		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  5.54k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  11.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 4.41k, False: 1.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  5.54k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  5.54k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  1.20k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  2.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 679, False: 530]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  5.54k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  5.54k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (416:9): [True: 1.20k, False: 4.33k]
  ------------------
  417|  5.54k|		offs = xph_offset;
  ------------------
  |  |  189|  5.54k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  11.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 4.41k, False: 1.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  5.54k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  5.54k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  418|  5.54k|		if ((bufsize = pread(fd, nbuf, len, offs)) == -1) {
  ------------------
  |  Branch (418:7): [True: 24, False: 5.52k]
  ------------------
  419|     24|			if (elf_printf(ms, " can't read note section at %jd",
  ------------------
  |  Branch (419:8): [True: 0, False: 24]
  ------------------
  420|     24|			    (intmax_t)offs) == -1)
  421|      0|				return -1;
  422|     24|			return 0;
  423|     24|		}
  424|  5.52k|		offset = 0;
  425|  25.0k|		for (;;) {
  426|  25.0k|			if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  452|  25.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (426:8): [True: 4.26k, False: 20.7k]
  ------------------
  427|  4.26k|				break;
  428|  20.7k|			offset = donote(ms, nbuf, offset, CAST(size_t, bufsize),
  ------------------
  |  |  452|  20.7k|#define CAST(T, b)	((T)(b))
  ------------------
  429|  20.7k|			    clazz, swap, 4, flags, notecount, fd, ph_off,
  430|  20.7k|			    ph_num, fsize);
  431|  20.7k|			if (offset == 0)
  ------------------
  |  Branch (431:8): [True: 1.25k, False: 19.5k]
  ------------------
  432|  1.25k|				break;
  433|       |
  434|  20.7k|		}
  435|  5.52k|	}
  436|     77|	return 0;
  437|  1.92k|}
readelf.c:donote:
 1234|  30.0k|{
 1235|  30.0k|	Elf32_Nhdr nh32;
 1236|  30.0k|	Elf64_Nhdr nh64;
 1237|  30.0k|	size_t noff, doff;
 1238|  30.0k|	uint32_t namesz, descsz;
 1239|  30.0k|	char buf[256];
 1240|  30.0k|	unsigned char *nbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  452|  30.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1241|       |
 1242|  30.0k|	if (*notecount == 0)
  ------------------
  |  Branch (1242:6): [True: 126, False: 29.9k]
  ------------------
 1243|    126|		return 0;
 1244|  29.9k|	--*notecount;
 1245|       |
 1246|  29.9k|	if (xnh_sizeof + offset > size) {
  ------------------
  |  |  211|  29.9k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  29.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 24.1k, False: 5.75k]
  |  |  ------------------
  |  |  212|  29.9k|			 ? sizeof(nh32)				\
  |  |  213|  29.9k|			 : sizeof(nh64))
  ------------------
  |  Branch (1246:6): [True: 2.61k, False: 27.3k]
  ------------------
 1247|       |		/*
 1248|       |		 * We're out of note headers.
 1249|       |		 */
 1250|  2.61k|		return xnh_sizeof + offset;
  ------------------
  |  |  211|  2.61k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.61k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 2.14k, False: 469]
  |  |  ------------------
  |  |  212|  2.61k|			 ? sizeof(nh32)				\
  |  |  213|  2.61k|			 : sizeof(nh64))
  ------------------
 1251|  2.61k|	}
 1252|       |	/*XXX: GCC */
 1253|  27.3k|	memset(&nh32, 0, sizeof(nh32));
 1254|  27.3k|	memset(&nh64, 0, sizeof(nh64));
 1255|       |
 1256|  27.3k|	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  208|  27.3k|#define xnh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (208:19): [True: 22.0k, False: 5.28k]
  |  |  ------------------
  |  |  209|  27.3k|			 ? CAST(void *, &nh32)			\
  |  |  ------------------
  |  |  |  |  452|  22.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  210|  27.3k|			 : CAST(void *, &nh64))
  |  |  ------------------
  |  |  |  |  452|  5.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  211|  27.3k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 22.0k, False: 5.28k]
  |  |  ------------------
  |  |  212|  27.3k|			 ? sizeof(nh32)				\
  |  |  213|  27.3k|			 : sizeof(nh64))
  ------------------
 1257|  27.3k|	offset += xnh_sizeof;
  ------------------
  |  |  211|  27.3k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 22.0k, False: 5.28k]
  |  |  ------------------
  |  |  212|  27.3k|			 ? sizeof(nh32)				\
  |  |  213|  27.3k|			 : sizeof(nh64))
  ------------------
 1258|       |
 1259|  27.3k|	namesz = xnh_namesz;
  ------------------
  |  |  217|  27.3k|#define xnh_namesz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (217:21): [True: 22.0k, False: 5.28k]
  |  |  ------------------
  |  |  218|  27.3k|			 ? elf_getu32(swap, nh32.n_namesz)	\
  |  |  ------------------
  |  |  |  |  158|  22.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  219|  27.3k|			 : elf_getu32(swap, nh64.n_namesz))
  |  |  ------------------
  |  |  |  |  158|  5.28k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1260|  27.3k|	descsz = xnh_descsz;
  ------------------
  |  |  220|  27.3k|#define xnh_descsz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (220:21): [True: 22.0k, False: 5.28k]
  |  |  ------------------
  |  |  221|  27.3k|			 ? elf_getu32(swap, nh32.n_descsz)	\
  |  |  ------------------
  |  |  |  |  158|  22.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  222|  27.3k|			 : elf_getu32(swap, nh64.n_descsz))
  |  |  ------------------
  |  |  |  |  158|  5.28k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1261|       |
 1262|  27.3k|	if ((namesz == 0) && (descsz == 0)) {
  ------------------
  |  Branch (1262:6): [True: 3.25k, False: 24.0k]
  |  Branch (1262:23): [True: 305, False: 2.94k]
  ------------------
 1263|       |		/*
 1264|       |		 * We're out of note headers.
 1265|       |		 */
 1266|    305|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1266:10): [True: 40, False: 265]
  ------------------
 1267|    305|	}
 1268|       |
 1269|  27.0k|	if (namesz & 0x80000000) {
  ------------------
  |  Branch (1269:6): [True: 704, False: 26.3k]
  ------------------
 1270|    704|	    (void)elf_printf(ms, ", bad note name size %#lx",
 1271|    704|		CAST(unsigned long, namesz));
  ------------------
  |  |  452|    704|#define CAST(T, b)	((T)(b))
  ------------------
 1272|    704|	    return 0;
 1273|    704|	}
 1274|       |
 1275|  26.3k|	if (descsz & 0x80000000) {
  ------------------
  |  Branch (1275:6): [True: 1.77k, False: 24.5k]
  ------------------
 1276|  1.77k|		(void)elf_printf(ms, ", bad note description size %#lx",
 1277|  1.77k|		    CAST(unsigned long, descsz));
  ------------------
  |  |  452|  1.77k|#define CAST(T, b)	((T)(b))
  ------------------
 1278|  1.77k|		return 0;
 1279|  1.77k|	}
 1280|       |
 1281|  24.5k|	noff = offset;
 1282|  24.5k|	doff = ELF_ALIGN(offset + namesz);
  ------------------
  |  |   56|  24.5k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1283|       |
 1284|  24.5k|	if (offset + namesz > size) {
  ------------------
  |  Branch (1284:6): [True: 2.47k, False: 22.0k]
  ------------------
 1285|       |		/*
 1286|       |		 * We're past the end of the buffer.
 1287|       |		 */
 1288|  2.47k|		return doff;
 1289|  2.47k|	}
 1290|       |
 1291|  22.0k|	offset = ELF_ALIGN(doff + descsz);
  ------------------
  |  |   56|  22.0k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1292|  22.0k|	if (doff + descsz > size) {
  ------------------
  |  Branch (1292:6): [True: 1.39k, False: 20.6k]
  ------------------
 1293|       |		/*
 1294|       |		 * We're past the end of the buffer.
 1295|       |		 */
 1296|  1.39k|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1296:10): [True: 1.01k, False: 378]
  ------------------
 1297|  1.39k|	}
 1298|       |
 1299|       |
 1300|  20.6k|	if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
  ------------------
  |  |  352|  20.6k|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  |  Branch (1300:6): [True: 19.8k, False: 816]
  ------------------
 1301|  19.8k|		if (do_os_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 (1301:7): [True: 150, False: 19.7k]
  ------------------
 1302|  19.8k|		    namesz, descsz, noff, doff, flags))
 1303|    150|			return offset;
 1304|  19.8k|	}
 1305|       |
 1306|  20.5k|	if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
  ------------------
  |  |  353|  20.5k|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  |  Branch (1306:6): [True: 20.3k, False: 213]
  ------------------
 1307|  20.3k|		if (do_bid_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  20.3k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 17.2k, False: 3.05k]
  |  |  ------------------
  |  |  215|  20.3k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  17.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  20.3k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1307:7): [True: 485, False: 19.8k]
  ------------------
 1308|  20.3k|		    namesz, descsz, noff, doff, flags))
 1309|    485|			return offset;
 1310|  20.3k|	}
 1311|       |
 1312|  20.0k|	if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
  ------------------
  |  |  355|  20.0k|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  |  Branch (1312:6): [True: 19.5k, False: 456]
  ------------------
 1313|  19.5k|		if (do_pax_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  19.5k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 16.5k, False: 3.05k]
  |  |  ------------------
  |  |  215|  19.5k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  16.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  19.5k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1313:7): [True: 35, False: 19.5k]
  ------------------
 1314|  19.5k|		    namesz, descsz, noff, doff, flags))
 1315|     35|			return offset;
 1316|  19.5k|	}
 1317|  20.0k|	if ((*flags & FLAGS_DID_ANDROID_MEMTAG) == 0) {
  ------------------
  |  |  360|  20.0k|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  |  Branch (1317:6): [True: 19.6k, False: 331]
  ------------------
 1318|  19.6k|		if (do_memtag_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  19.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 16.6k, False: 3.05k]
  |  |  ------------------
  |  |  215|  19.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  16.6k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  19.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1318:7): [True: 37, False: 19.6k]
  ------------------
 1319|  19.6k|		    namesz, descsz, noff, doff, flags))
 1320|     37|			return offset;
 1321|  19.6k|	}
 1322|       |
 1323|  19.9k|	if ((*flags & FLAGS_DID_CORE) == 0) {
  ------------------
  |  |  351|  19.9k|#define FLAGS_DID_CORE			0x0004
  ------------------
  |  Branch (1323:6): [True: 19.1k, False: 831]
  ------------------
 1324|  19.1k|		if (do_core_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  19.1k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 16.0k, False: 3.05k]
  |  |  ------------------
  |  |  215|  19.1k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  16.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  19.1k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.05k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1324:7): [True: 63, False: 19.0k]
  ------------------
 1325|  19.1k|		    namesz, descsz, noff, doff, flags, size, clazz))
 1326|     63|			return offset;
 1327|  19.1k|	}
 1328|       |
 1329|  19.9k|	if ((*flags & FLAGS_DID_AUXV) == 0) {
  ------------------
  |  |  362|  19.9k|#define FLAGS_DID_AUXV			0x2000
  ------------------
  |  Branch (1329:6): [True: 19.5k, False: 389]
  ------------------
 1330|  19.5k|		if (do_auxv_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  19.5k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 16.4k, False: 3.04k]
  |  |  ------------------
  |  |  215|  19.5k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  16.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  19.5k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.04k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1330:7): [True: 500, False: 19.0k]
  ------------------
 1331|  19.5k|			namesz, descsz, noff, doff, flags, size, clazz,
 1332|  19.5k|			fd, ph_off, ph_num, fsize))
 1333|    500|			return offset;
 1334|  19.5k|	}
 1335|       |
 1336|  19.4k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "NetBSD")) {
  ------------------
  |  |   67|  19.4k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.51k, False: 16.8k]
  |  |  |  Branch (67:29): [True: 1.39k, False: 1.12k]
  |  |  ------------------
  ------------------
 1337|  1.39k|		int descw, flag;
 1338|  1.39k|		const char *str, *tag;
 1339|  1.39k|		if (descsz > 100)
  ------------------
  |  Branch (1339:7): [True: 87, False: 1.30k]
  ------------------
 1340|     87|			descsz = 100;
 1341|  1.39k|		switch (xnh_type) {
  ------------------
  |  |  214|  1.39k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.39k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 1.09k, False: 294]
  |  |  ------------------
  |  |  215|  1.39k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  1.09k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  1.39k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|    294|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1342|    258|	    	case NT_NETBSD_VERSION:
  ------------------
  |  |  285|    258|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (1342:7): [True: 258, False: 1.13k]
  ------------------
 1343|    258|			return offset;
 1344|    206|		case NT_NETBSD_MARCH:
  ------------------
  |  |  346|    206|#define NT_NETBSD_MARCH		5
  ------------------
  |  Branch (1344:3): [True: 206, False: 1.18k]
  ------------------
 1345|    206|			flag = FLAGS_DID_NETBSD_MARCH;
  ------------------
  |  |  356|    206|#define FLAGS_DID_NETBSD_MARCH		0x0080
  ------------------
 1346|    206|			tag = "compiled for";
 1347|    206|			break;
 1348|    214|		case NT_NETBSD_CMODEL:
  ------------------
  |  |  356|    214|#define NT_NETBSD_CMODEL	6
  ------------------
  |  Branch (1348:3): [True: 214, False: 1.17k]
  ------------------
 1349|    214|			flag = FLAGS_DID_NETBSD_CMODEL;
  ------------------
  |  |  357|    214|#define FLAGS_DID_NETBSD_CMODEL		0x0100
  ------------------
 1350|    214|			tag = "compiler model";
 1351|    214|			break;
 1352|    203|		case NT_NETBSD_EMULATION:
  ------------------
  |  |  286|    203|#define	NT_NETBSD_EMULATION	2
  ------------------
  |  Branch (1352:3): [True: 203, False: 1.19k]
  ------------------
 1353|    203|			flag = FLAGS_DID_NETBSD_EMULATION;
  ------------------
  |  |  358|    203|#define FLAGS_DID_NETBSD_EMULATION	0x0200
  ------------------
 1354|    203|			tag = "emulation:";
 1355|    203|			break;
 1356|    512|		default:
  ------------------
  |  Branch (1356:3): [True: 512, False: 881]
  ------------------
 1357|    512|			if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  ------------------
  |  |  359|    512|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
  |  Branch (1357:8): [True: 445, False: 67]
  ------------------
 1358|    445|				return offset;
 1359|     67|			*flags |= FLAGS_DID_NETBSD_UNKNOWN;
  ------------------
  |  |  359|     67|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
 1360|     67|			if (elf_printf(ms, ", note=%u", xnh_type) == -1)
  ------------------
  |  |  214|     67|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|     67|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 48, False: 19]
  |  |  ------------------
  |  |  215|     67|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|     48|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|     67|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|     19|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1360:8): [True: 0, False: 67]
  ------------------
 1361|      0|				return offset;
 1362|     67|			return offset;
 1363|  1.39k|		}
 1364|       |
 1365|    623|		if (*flags & flag)
  ------------------
  |  Branch (1365:7): [True: 596, False: 27]
  ------------------
 1366|    596|			return offset;
 1367|     27|		str = RCAST(const char *, &nbuf[doff]);
  ------------------
  |  |  453|     27|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1368|     27|		descw = CAST(int, descsz);
  ------------------
  |  |  452|     27|#define CAST(T, b)	((T)(b))
  ------------------
 1369|     27|		*flags |= flag;
 1370|     27|		elf_printf(ms, ", %s: %s", tag,
 1371|     27|		    file_copystr(buf, sizeof(buf), descw, str));
 1372|     27|		return offset;
 1373|    623|	}
 1374|       |
 1375|  18.0k|	return offset;
 1376|  19.4k|}
readelf.c:do_os_note:
  615|  19.8k|{
  616|  19.8k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  19.8k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  617|       |
  618|  19.8k|	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |   67|  39.7k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 830, False: 19.0k]
  |  |  |  Branch (67:29): [True: 412, False: 418]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |  297|  20.2k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (618:34): [True: 197, False: 215]
  |  Branch (618:60): [True: 1, False: 196]
  ------------------
  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|  19.8k|	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |   67|  39.7k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 11.2k, False: 8.64k]
  |  |  |  Branch (67:29): [True: 982, False: 10.2k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |  297|  20.8k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (626:33): [True: 192, False: 790]
  |  Branch (626:59): [True: 18, False: 174]
  ------------------
  627|     18|		uint32_t desc[4];
  628|     18|		memcpy(desc, &nbuf[doff], sizeof(desc));
  629|       |
  630|     18|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     18|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  631|     18|		if (elf_printf(ms, ", for GNU/") == -1)
  ------------------
  |  Branch (631:7): [True: 0, False: 18]
  ------------------
  632|      0|			return -1;
  633|     18|		switch (elf_getu32(swap, desc[0])) {
  ------------------
  |  |  158|     18|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  634|      3|		case GNU_OS_LINUX:
  ------------------
  |  |  300|      3|#define	GNU_OS_LINUX	0
  ------------------
  |  Branch (634:3): [True: 3, False: 15]
  ------------------
  635|      3|			if (elf_printf(ms, "Linux") == -1)
  ------------------
  |  Branch (635:8): [True: 0, False: 3]
  ------------------
  636|      0|				return -1;
  637|      3|			break;
  638|      3|		case GNU_OS_HURD:
  ------------------
  |  |  301|      1|#define	GNU_OS_HURD	1
  ------------------
  |  Branch (638:3): [True: 1, False: 17]
  ------------------
  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: 17]
  ------------------
  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: 17]
  ------------------
  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: 17]
  ------------------
  651|      1|			if (elf_printf(ms, "kNetBSD") == -1)
  ------------------
  |  Branch (651:8): [True: 0, False: 1]
  ------------------
  652|      0|				return -1;
  653|      1|			break;
  654|     11|		default:
  ------------------
  |  Branch (654:3): [True: 11, False: 7]
  ------------------
  655|     11|			if (elf_printf(ms, "<unknown>") == -1)
  ------------------
  |  Branch (655:8): [True: 0, False: 11]
  ------------------
  656|      0|				return -1;
  657|     18|		}
  658|     18|		if (elf_printf(ms, " %d.%d.%d", elf_getu32(swap, desc[1]),
  ------------------
  |  |  158|     18|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  |  Branch (658:7): [True: 0, False: 18]
  ------------------
  659|     18|		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  158|     18|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
              		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  158|     18|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  660|      0|			return -1;
  661|     18|		return 1;
  662|     18|	}
  663|       |
  664|  19.8k|	if (NAMEEQUALS(name, "NetBSD") &&
  ------------------
  |  |   67|  39.6k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.57k, False: 17.2k]
  |  |  |  Branch (67:29): [True: 1.45k, False: 1.12k]
  |  |  ------------------
  ------------------
  665|  1.45k|	    type == NT_NETBSD_VERSION && descsz == 4) {
  ------------------
  |  |  285|  21.2k|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (665:6): [True: 323, False: 1.13k]
  |  Branch (665:35): [True: 71, False: 252]
  ------------------
  666|     71|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     71|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  667|     71|		if (do_note_netbsd_version(ms, swap, &nbuf[doff]) == -1)
  ------------------
  |  Branch (667:7): [True: 0, False: 71]
  ------------------
  668|      0|			return -1;
  669|     71|		return 1;
  670|     71|	}
  671|       |
  672|  19.7k|	if (NAMEEQUALS(name, "FreeBSD") &&
  ------------------
  |  |   67|  39.5k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.57k, False: 18.1k]
  |  |  |  Branch (67:29): [True: 551, False: 1.01k]
  |  |  ------------------
  ------------------
  673|    551|	    type == NT_FREEBSD_VERSION && descsz == 4) {
  ------------------
  |  |  287|  20.3k|#define	NT_FREEBSD_VERSION	1
  ------------------
  |  Branch (673:6): [True: 263, False: 288]
  |  Branch (673:36): [True: 57, False: 206]
  ------------------
  674|     57|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     57|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  675|     57|		if (do_note_freebsd_version(ms, swap, &nbuf[doff])
  ------------------
  |  Branch (675:7): [True: 0, False: 57]
  ------------------
  676|     57|		    == -1)
  677|      0|			return -1;
  678|     57|		return 1;
  679|     57|	}
  680|       |
  681|  19.7k|	if (NAMEEQUALS(name, "OpenBSD") &&
  ------------------
  |  |   67|  39.4k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.51k, False: 18.1k]
  |  |  |  Branch (67:29): [True: 174, False: 1.33k]
  |  |  ------------------
  ------------------
  682|    174|	    type == NT_OPENBSD_VERSION && descsz == 4) {
  ------------------
  |  |  288|  19.8k|#define	NT_OPENBSD_VERSION	1
  ------------------
  |  Branch (682:6): [True: 71, False: 103]
  |  Branch (682:36): [True: 1, False: 70]
  ------------------
  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.7k|	if (NAMEEQUALS(name, "DragonFly") &&
  ------------------
  |  |   67|  39.4k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 369, False: 19.3k]
  |  |  |  Branch (67:29): [True: 180, False: 189]
  |  |  ------------------
  ------------------
  691|    180|	    type == NT_DRAGONFLY_VERSION && descsz == 4) {
  ------------------
  |  |  289|  19.8k|#define	NT_DRAGONFLY_VERSION	1
  ------------------
  |  Branch (691:6): [True: 69, False: 111]
  |  Branch (691:38): [True: 2, False: 67]
  ------------------
  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.7k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  39.4k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.51k, False: 18.1k]
  |  |  |  Branch (67:29): [True: 332, False: 1.18k]
  |  |  ------------------
  ------------------
  705|    332|	    type == NT_ANDROID_VERSION && descsz >= 4) {
  ------------------
  |  |  377|  20.0k|#define NT_ANDROID_VERSION	1
  ------------------
  |  Branch (705:6): [True: 41, False: 291]
  |  Branch (705:36): [True: 5, False: 36]
  ------------------
  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.7k|	return 0;
  726|  19.7k|}
readelf.c:do_note_netbsd_version:
  442|     71|{
  443|     71|	uint32_t desc;
  444|     71|	memcpy(&desc, v, sizeof(desc));
  445|     71|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     71|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  446|       |
  447|     71|	if (elf_printf(ms, ", for NetBSD") == -1)
  ------------------
  |  Branch (447:6): [True: 0, False: 71]
  ------------------
  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|     71|	if (desc > 100000000U) {
  ------------------
  |  Branch (461:6): [True: 52, False: 19]
  ------------------
  462|     52|		uint32_t ver_patch = (desc / 100) % 100;
  463|     52|		uint32_t ver_rel = (desc / 10000) % 100;
  464|     52|		uint32_t ver_min = (desc / 1000000) % 100;
  465|     52|		uint32_t ver_maj = desc / 100000000;
  466|       |
  467|     52|		if (elf_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
  ------------------
  |  Branch (467:7): [True: 0, False: 52]
  ------------------
  468|      0|			return -1;
  469|     52|		if (ver_maj >= 9) {
  ------------------
  |  Branch (469:7): [True: 22, False: 30]
  ------------------
  470|     22|			ver_patch += 100 * ver_rel;
  471|     22|			ver_rel = 0;
  472|     22|		}
  473|     52|		if (ver_rel == 0 && ver_patch != 0) {
  ------------------
  |  Branch (473:7): [True: 24, False: 28]
  |  Branch (473:23): [True: 21, False: 3]
  ------------------
  474|     21|			if (elf_printf(ms, ".%u", ver_patch) == -1)
  ------------------
  |  Branch (474:8): [True: 0, False: 21]
  ------------------
  475|      0|				return -1;
  476|     31|		} else if (ver_rel != 0) {
  ------------------
  |  Branch (476:14): [True: 28, False: 3]
  ------------------
  477|     74|			while (ver_rel > 26) {
  ------------------
  |  Branch (477:11): [True: 46, False: 28]
  ------------------
  478|     46|				if (elf_printf(ms, "Z") == -1)
  ------------------
  |  Branch (478:9): [True: 0, False: 46]
  ------------------
  479|      0|					return -1;
  480|     46|				ver_rel -= 26;
  481|     46|			}
  482|     28|			if (elf_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
  ------------------
  |  Branch (482:8): [True: 0, False: 28]
  ------------------
  483|      0|				return -1;
  484|     28|		}
  485|     52|	}
  486|     71|	return 0;
  487|     71|}
readelf.c:do_note_freebsd_version:
  491|     57|{
  492|     57|	uint32_t desc;
  493|       |
  494|     57|	memcpy(&desc, v, sizeof(desc));
  495|     57|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     57|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  496|     57|	if (elf_printf(ms, ", for FreeBSD") == -1)
  ------------------
  |  Branch (496:6): [True: 0, False: 57]
  ------------------
  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|     57|	if (desc == 460002) {
  ------------------
  |  Branch (525:6): [True: 1, False: 56]
  ------------------
  526|      1|		if (elf_printf(ms, " 4.6.2") == -1)
  ------------------
  |  Branch (526:7): [True: 0, False: 1]
  ------------------
  527|      0|			return -1;
  528|     56|	} else if (desc < 460100) {
  ------------------
  |  Branch (528:13): [True: 19, False: 37]
  ------------------
  529|     19|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (529:7): [True: 0, False: 19]
  ------------------
  530|     19|		    desc / 10000 % 10) == -1)
  531|      0|			return -1;
  532|     19|		if (desc / 1000 % 10 > 0)
  ------------------
  |  Branch (532:7): [True: 11, False: 8]
  ------------------
  533|     11|			if (elf_printf(ms, ".%d", desc / 1000 % 10) == -1)
  ------------------
  |  Branch (533:8): [True: 0, False: 11]
  ------------------
  534|      0|				return -1;
  535|     19|		if ((desc % 1000 > 0) || (desc % 100000 == 0))
  ------------------
  |  Branch (535:7): [True: 17, False: 2]
  |  Branch (535:28): [True: 1, False: 1]
  ------------------
  536|     18|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (536:8): [True: 0, False: 18]
  ------------------
  537|      0|				return -1;
  538|     37|	} else if (desc < 500000) {
  ------------------
  |  Branch (538:13): [True: 7, False: 30]
  ------------------
  539|      7|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (539:7): [True: 0, False: 7]
  ------------------
  540|      7|		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
  541|      0|			return -1;
  542|      7|		if (desc / 100 % 10 > 0) {
  ------------------
  |  Branch (542:7): [True: 4, False: 3]
  ------------------
  543|      4|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (543:8): [True: 0, False: 4]
  ------------------
  544|      0|				return -1;
  545|      4|		} 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|     30|	} else {
  550|     30|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (550:7): [True: 0, False: 30]
  ------------------
  551|     30|		    desc / 1000 % 100) == -1)
  552|      0|			return -1;
  553|     30|		if ((desc / 100 % 10 > 0) ||
  ------------------
  |  Branch (553:7): [True: 19, False: 11]
  ------------------
  554|     20|		    (desc % 100000 / 100 == 0)) {
  ------------------
  |  Branch (554:7): [True: 1, False: 10]
  ------------------
  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: 8, False: 2]
  ------------------
  558|      8|			if (elf_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (558:8): [True: 0, False: 8]
  ------------------
  559|      0|				return -1;
  560|      8|		}
  561|     30|	}
  562|     57|	return 0;
  563|     57|}
readelf.c:do_bid_note:
  570|  20.3k|{
  571|  20.3k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "GNU") &&
  ------------------
  |  |   67|  40.6k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 11.6k, False: 8.65k]
  |  |  |  Branch (67:29): [True: 1.42k, False: 10.2k]
  |  |  ------------------
  ------------------
  572|  1.42k|	    type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
  ------------------
  |  |  319|  21.7k|#define	NT_GNU_BUILD_ID		3
  ------------------
  |  Branch (572:6): [True: 616, False: 806]
  |  Branch (572:34): [True: 546, False: 70]
  |  Branch (572:49): [True: 13, False: 533]
  ------------------
  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|      1|		case 8:
  ------------------
  |  Branch (578:3): [True: 1, False: 12]
  ------------------
  579|      1|		    btype = "xxHash";
  580|      1|		    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|      3|		default:
  ------------------
  |  Branch (587:3): [True: 3, False: 10]
  ------------------
  588|      3|		    btype = "unknown";
  589|      3|		    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|    191|		for (i = 0; i < descsz; i++)
  ------------------
  |  Branch (594:15): [True: 178, False: 13]
  ------------------
  595|    178|		    if (elf_printf(ms, "%02x", desc[i]) == -1)
  ------------------
  |  Branch (595:11): [True: 0, False: 178]
  ------------------
  596|      0|			return -1;
  597|     13|		return 1;
  598|     13|	}
  599|  20.2k|	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.65k]
  |  Branch (599:21): [True: 1.05k, False: 10.5k]
  ------------------
  600|  1.05k|	    type == NT_GO_BUILD_ID && descsz < 128) {
  ------------------
  |  |  365|  21.3k|#define NT_GO_BUILD_ID	4
  ------------------
  |  Branch (600:6): [True: 598, False: 459]
  |  Branch (600:32): [True: 472, False: 126]
  ------------------
  601|    472|		char buf[256];
  602|    472|		if (elf_printf(ms, ", Go BuildID=%s",
  ------------------
  |  Branch (602:7): [True: 0, False: 472]
  ------------------
  603|    472|		    file_copystr(buf, sizeof(buf), descsz,
  604|    472|		    RCAST(const char *, &nbuf[doff]))) == -1)
  ------------------
  |  |  453|    472|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  605|      0|			return -1;
  606|    472|		return 1;
  607|    472|	}
  608|  19.8k|	return 0;
  609|  20.2k|}
readelf.c:do_pax_note:
  732|  19.5k|{
  733|  19.5k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  19.5k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  734|       |
  735|  19.5k|	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |   67|  39.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 10.9k, False: 8.62k]
  |  |  |  Branch (67:29): [True: 1.04k, False: 9.91k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |  330|  20.6k|#define NT_NETBSD_PAX		3
  ------------------
  |  Branch (735:33): [True: 322, False: 726]
  |  Branch (735:58): [True: 35, False: 287]
  ------------------
  736|     35|		static const char *pax[] = {
  737|     35|		    "+mprotect",
  738|     35|		    "-mprotect",
  739|     35|		    "+segvguard",
  740|     35|		    "-segvguard",
  741|     35|		    "+ASLR",
  742|     35|		    "-ASLR",
  743|     35|		};
  744|     35|		uint32_t desc;
  745|     35|		size_t i;
  746|     35|		int did = 0;
  747|       |
  748|     35|		*flags |= FLAGS_DID_NETBSD_PAX;
  ------------------
  |  |  355|     35|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  749|     35|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  750|     35|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     35|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  751|       |
  752|     35|		if (desc && elf_printf(ms, ", PaX: ") == -1)
  ------------------
  |  Branch (752:7): [True: 34, False: 1]
  |  Branch (752:15): [True: 0, False: 34]
  ------------------
  753|      0|			return -1;
  754|       |
  755|    245|		for (i = 0; i < __arraycount(pax); i++) {
  ------------------
  |  |  130|    245|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (755:15): [True: 210, False: 35]
  ------------------
  756|    210|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  452|    210|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (756:8): [True: 120, False: 90]
  ------------------
  757|    120|				continue;
  758|     90|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (758:8): [True: 0, False: 90]
  |  Branch (758:31): [True: 64, False: 26]
  ------------------
  759|     90|			    pax[i]) == -1)
  760|      0|				return -1;
  761|     90|		}
  762|     35|		return 1;
  763|     35|	}
  764|  19.5k|	return 0;
  765|  19.5k|}
readelf.c:do_memtag_note:
  771|  19.6k|{
  772|  19.6k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  19.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  773|       |
  774|  19.6k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  39.3k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.47k, False: 18.1k]
  |  |  |  Branch (67:29): [True: 299, False: 1.18k]
  |  |  ------------------
  ------------------
  775|    299|	    type == NT_ANDROID_MEMTAG && descsz == 4) {
  ------------------
  |  |  389|  19.9k|#define NT_ANDROID_MEMTAG	4
  ------------------
  |  Branch (775:6): [True: 126, False: 173]
  |  Branch (775:35): [True: 37, False: 89]
  ------------------
  776|     37|		static const char *memtag[] = {
  777|     37|		    "none",
  778|     37|		    "async",
  779|     37|		    "sync",
  780|     37|		    "heap",
  781|     37|		    "stack",
  782|     37|		};
  783|     37|		uint32_t desc;
  784|     37|		size_t i;
  785|     37|		int did = 0;
  786|       |
  787|     37|		*flags |= FLAGS_DID_ANDROID_MEMTAG;
  ------------------
  |  |  360|     37|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  788|     37|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  789|     37|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     37|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  790|       |
  791|     37|		if (desc && elf_printf(ms, ", Android Memtag: ") == -1)
  ------------------
  |  Branch (791:7): [True: 36, False: 1]
  |  Branch (791:15): [True: 0, False: 36]
  ------------------
  792|      0|			return -1;
  793|       |
  794|    222|		for (i = 0; i < __arraycount(memtag); i++) {
  ------------------
  |  |  130|    222|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (794:15): [True: 185, False: 37]
  ------------------
  795|    185|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  452|    185|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (795:8): [True: 107, False: 78]
  ------------------
  796|    107|				continue;
  797|     78|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (797:8): [True: 0, False: 78]
  |  Branch (797:31): [True: 47, False: 31]
  ------------------
  798|     78|			    memtag[i]) == -1)
  799|      0|				return -1;
  800|     78|		}
  801|     37|		return 1;
  802|     37|	}
  803|  19.6k|	return 0;
  804|  19.6k|}
readelf.c:do_core_note:
  810|  19.1k|{
  811|  19.1k|#ifdef ELFCORE
  812|  19.1k|	char buf[256];
  813|  19.1k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  453|  19.1k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  814|       |
  815|  19.1k|	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.1k|	if ((namesz == 4 && memcmp(name, "CORE", 4) == 0) ||
  ------------------
  |  Branch (830:7): [True: 10.5k, False: 8.61k]
  |  Branch (830:22): [True: 1.08k, False: 9.42k]
  ------------------
  831|  18.0k|	    NAMEEQUALS(name, "CORE")) {
  ------------------
  |  |   67|  18.0k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 829, False: 17.2k]
  |  |  |  Branch (67:29): [True: 91, False: 738]
  |  |  ------------------
  ------------------
  832|  1.18k|		os_style = OS_STYLE_SVR4;
  ------------------
  |  |  339|  1.18k|#define	OS_STYLE_SVR4		0
  ------------------
  833|  1.18k|	}
  834|       |
  835|  19.1k|	if (NAMEEQUALS(name, "FreeBSD")) {
  ------------------
  |  |   67|  19.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.47k, False: 17.6k]
  |  |  |  Branch (67:29): [True: 494, False: 981]
  |  |  ------------------
  ------------------
  836|    494|		os_style = OS_STYLE_FREEBSD;
  ------------------
  |  |  340|    494|#define	OS_STYLE_FREEBSD	1
  ------------------
  837|    494|	}
  838|       |
  839|  19.1k|	if ((namesz >= 11 && memcmp(name, "NetBSD-CORE", 11) == 0)) {
  ------------------
  |  Branch (839:7): [True: 1.30k, False: 17.8k]
  |  Branch (839:23): [True: 442, False: 861]
  ------------------
  840|    442|		os_style = OS_STYLE_NETBSD;
  ------------------
  |  |  341|    442|#define	OS_STYLE_NETBSD		2
  ------------------
  841|    442|	}
  842|       |
  843|  19.1k|	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
  ------------------
  |  |  354|  2.11k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (843:6): [True: 2.11k, False: 17.0k]
  |  Branch (843:24): [True: 679, False: 1.43k]
  ------------------
  844|    679|		if (elf_printf(ms, ", %s-style", os_style_names[os_style])
  ------------------
  |  Branch (844:7): [True: 0, False: 679]
  ------------------
  845|    679|		    == -1)
  846|      0|			return -1;
  847|    679|		*flags |= FLAGS_DID_CORE_STYLE;
  ------------------
  |  |  354|    679|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  848|    679|		*flags |= os_style;
  849|    679|	}
  850|       |
  851|  19.1k|	switch (os_style) {
  852|    442|	case OS_STYLE_NETBSD:
  ------------------
  |  |  341|    442|#define	OS_STYLE_NETBSD		2
  ------------------
  |  Branch (852:2): [True: 442, False: 18.6k]
  ------------------
  853|    442|		if (type == NT_NETBSD_CORE_PROCINFO) {
  ------------------
  |  |  232|    442|#define	NT_NETBSD_CORE_PROCINFO		1
  ------------------
  |  Branch (853:7): [True: 3, False: 439]
  ------------------
  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|    439|		break;
  876|       |
  877|    494|	case OS_STYLE_FREEBSD:
  ------------------
  |  |  340|    494|#define	OS_STYLE_FREEBSD	1
  ------------------
  |  Branch (877:2): [True: 494, False: 18.6k]
  ------------------
  878|    494|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|    988|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|    177|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (878:7): [True: 177, False: 317]
  |  Branch (878:30): [True: 15, False: 162]
  ------------------
  879|     15|			size_t argoff, pidoff;
  880|       |
  881|     15|			if (clazz == ELFCLASS32)
  ------------------
  |  |  153|     15|#define	ELFCLASS32	1
  ------------------
  |  Branch (881:8): [True: 14, False: 1]
  ------------------
  882|     14|				argoff = 4 + 4 + 17;
  883|      1|			else
  884|      1|				argoff = 4 + 4 + 8 + 17;
  885|     15|			if (doff + argoff + 81 <= size) {
  ------------------
  |  Branch (885:8): [True: 8, False: 7]
  ------------------
  886|      8|				if (elf_printf(ms, ", from '%.80s'",
  ------------------
  |  Branch (886:9): [True: 0, False: 8]
  ------------------
  887|      8|				    nbuf + doff + argoff) == -1)
  888|      0|					return -1;
  889|      8|			}
  890|     15|			pidoff = argoff + 81 + 2;
  891|     15|			if (doff + pidoff + 4 <= size) {
  ------------------
  |  Branch (891:8): [True: 6, False: 9]
  ------------------
  892|      6|				if (elf_printf(ms, ", pid=%u",
  ------------------
  |  Branch (892:9): [True: 0, False: 6]
  ------------------
  893|      6|				    elf_getu32(swap, *RCAST(uint32_t *, (nbuf +
  ------------------
  |  |  158|      6|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  894|      6|				    doff + pidoff)))) == -1)
  895|      0|					return -1;
  896|      6|			}
  897|     15|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     15|#define FLAGS_DID_CORE			0x0004
  ------------------
  898|     15|		}			    
  899|    494|		break;
  900|       |
  901|  18.1k|	default:
  ------------------
  |  Branch (901:2): [True: 18.1k, False: 936]
  ------------------
  902|  18.1k|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|  36.3k|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|  2.15k|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (902:7): [True: 2.15k, False: 16.0k]
  |  Branch (902:30): [True: 1.59k, False: 560]
  ------------------
  903|  1.59k|			size_t i, j;
  904|  1.59k|			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|  12.3k|			for (i = 0; i < NOFFSETS; i++) {
  ------------------
  |  |  308|  12.3k|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|  12.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|  11.7k|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  11.7k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  306|    568|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    568|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (308:19): [True: 11.7k, False: 568]
  |  |  ------------------
  ------------------
  |  Branch (915:16): [True: 10.8k, False: 1.53k]
  ------------------
  916|  10.8k|				unsigned char *cname, *cp;
  917|  10.8k|				size_t reloffset = prpsoffsets(i);
  ------------------
  |  |  263|  10.8k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  10.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 10.3k, False: 475]
  |  |  ------------------
  |  |  264|  10.8k|			 ? prpsoffsets32[i]			\
  |  |  265|  10.8k|			 : prpsoffsets64[i])
  ------------------
  918|  10.8k|				size_t noffset = doff + reloffset;
  919|  10.8k|				size_t k;
  920|  11.9k|				for (j = 0; j < 16; j++, noffset++,
  ------------------
  |  Branch (920:17): [True: 11.8k, False: 16]
  ------------------
  921|  11.8k|				    reloffset++) {
  922|       |					/*
  923|       |					 * Make sure we're not past
  924|       |					 * the end of the buffer; if
  925|       |					 * we are, just give up.
  926|       |					 */
  927|  11.8k|					if (noffset >= size)
  ------------------
  |  Branch (927:10): [True: 2.26k, False: 9.62k]
  ------------------
  928|  2.26k|						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|  9.62k|					if (reloffset >= descsz)
  ------------------
  |  Branch (936:10): [True: 5.63k, False: 3.98k]
  ------------------
  937|  5.63k|						goto tryanother;
  938|       |
  939|  3.98k|					c = nbuf[noffset];
  940|  3.98k|					if (c == '\0') {
  ------------------
  |  Branch (940:10): [True: 769, False: 3.21k]
  ------------------
  941|       |						/*
  942|       |						 * A '\0' at the
  943|       |						 * beginning is
  944|       |						 * obviously wrong.
  945|       |						 * Any other '\0'
  946|       |						 * means we're done.
  947|       |						 */
  948|    769|						if (j == 0)
  ------------------
  |  Branch (948:11): [True: 725, False: 44]
  ------------------
  949|    725|							goto tryanother;
  950|     44|						else
  951|     44|							break;
  952|  3.21k|					} else {
  953|       |						/*
  954|       |						 * A nonprintable
  955|       |						 * character is also
  956|       |						 * wrong.
  957|       |						 */
  958|  3.21k|						if (!isprint(c) || isquote(c))
  ------------------
  |  |   58|  1.69k|#define isquote(c) (strchr("'\"`", (c)) != NULL)
  |  |  ------------------
  |  |  |  Branch (58:20): [True: 602, False: 1.08k]
  |  |  ------------------
  ------------------
  |  Branch (958:11): [True: 1.52k, False: 1.69k]
  ------------------
  959|  2.12k|							goto tryanother;
  960|  3.21k|					}
  961|  3.98k|				}
  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|    205|				for (k = i + 1 ; k < NOFFSETS; k++) {
  ------------------
  |  |  308|    205|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|    205|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|    191|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    191|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  306|     14|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     14|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (308:19): [True: 191, False: 14]
  |  |  ------------------
  ------------------
  |  Branch (970:22): [True: 145, False: 60]
  ------------------
  971|    145|					size_t no;
  972|    145|					int adjust = 1;
  973|    145|					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    145|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    145|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 135, False: 10]
  |  |  ------------------
  |  |  264|    145|			 ? prpsoffsets32[i]			\
  |  |  265|    145|			 : prpsoffsets64[i])
  ------------------
              					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    145|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    145|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 135, False: 10]
  |  |  ------------------
  |  |  264|    145|			 ? prpsoffsets32[i]			\
  |  |  265|    145|			 : prpsoffsets64[i])
  ------------------
  |  Branch (973:10): [True: 40, False: 105]
  ------------------
  974|     40|						continue;
  975|       |					/*
  976|       |					 * pr_fname == pr_psargs - 16 &&
  977|       |					 * non-nul-terminated fname (qemu)
  978|       |					 */
  979|    105|					if (prpsoffsets(k) ==
  ------------------
  |  |  263|    105|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    105|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 95, False: 10]
  |  |  ------------------
  |  |  264|    105|			 ? prpsoffsets32[i]			\
  |  |  265|    105|			 : prpsoffsets64[i])
  ------------------
  |  Branch (979:10): [True: 25, False: 80]
  ------------------
  980|    105|					    prpsoffsets(i) - 16 && j == 16)
  ------------------
  |  |  263|    105|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    105|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 95, False: 10]
  |  |  ------------------
  |  |  264|    105|			 ? prpsoffsets32[i]			\
  |  |  265|    105|			 : prpsoffsets64[i])
  ------------------
  |  Branch (980:33): [True: 11, False: 14]
  ------------------
  981|     11|						continue;
  982|     94|					for (no = doff + prpsoffsets(k);
  ------------------
  |  |  263|     94|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|     94|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 84, False: 10]
  |  |  ------------------
  |  |  264|     94|			 ? prpsoffsets32[i]			\
  |  |  265|     94|			 : prpsoffsets64[i])
  ------------------
  983|  3.17k|					     no < doff + prpsoffsets(i); no++)
  ------------------
  |  |  263|  3.17k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  3.17k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 2.71k, False: 458]
  |  |  ------------------
  |  |  264|  3.17k|			 ? prpsoffsets32[i]			\
  |  |  265|  3.17k|			 : prpsoffsets64[i])
  ------------------
  |  Branch (983:11): [True: 3.08k, False: 94]
  ------------------
  984|  3.08k|						adjust = adjust
  ------------------
  |  Branch (984:16): [True: 928, False: 2.15k]
  ------------------
  985|  3.08k|						         && isprint(nbuf[no]);
  ------------------
  |  Branch (985:19): [True: 858, False: 70]
  ------------------
  986|     94|					if (adjust)
  ------------------
  |  Branch (986:10): [True: 24, False: 70]
  ------------------
  987|     24|						i = k;
  988|     94|				}
  989|       |
  990|     60|				cname = CAST(unsigned char *,
  ------------------
  |  |  452|    120|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 56, False: 4]
  |  |  ------------------
  ------------------
  991|     60|				    &nbuf[doff + prpsoffsets(i)]);
  992|  1.87k|				for (cp = cname; cp < nbuf + size && *cp
  ------------------
  |  Branch (992:22): [True: 1.86k, False: 9]
  |  Branch (992:42): [True: 1.81k, False: 46]
  ------------------
  993|  1.87k|				    && isprint(*cp); cp++)
  ------------------
  |  Branch (993:12): [True: 1.81k, False: 5]
  ------------------
  994|  1.81k|					continue;
  995|       |				/*
  996|       |				 * Linux apparently appends a space at the end
  997|       |				 * of the command line: remove it.
  998|       |				 */
  999|    360|				while (cp > cname && isspace(cp[-1]))
  ------------------
  |  Branch (999:12): [True: 353, False: 7]
  |  Branch (999:26): [True: 300, False: 53]
  ------------------
 1000|    300|					cp--;
 1001|     60|				if (elf_printf(ms, ", from '%s'",
  ------------------
  |  Branch (1001:9): [True: 0, False: 60]
  ------------------
 1002|     60|				    file_copystr(buf, sizeof(buf),
 1003|     60|				    CAST(size_t, cp - cname),
  ------------------
  |  |  452|     60|#define CAST(T, b)	((T)(b))
  ------------------
 1004|     60|				    RCAST(char *, cname))) == -1)
  ------------------
  |  |  453|     60|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1005|      0|					return -1;
 1006|     60|				*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     60|#define FLAGS_DID_CORE			0x0004
  ------------------
 1007|     60|				return 1;
 1008|       |
 1009|  10.7k|			tryanother:
 1010|  10.7k|				;
 1011|  10.7k|			}
 1012|  1.59k|		}
 1013|  18.1k|		break;
 1014|  19.1k|	}
 1015|  19.0k|#endif
 1016|  19.0k|	return 0;
 1017|  19.1k|}
readelf.c:do_auxv_note:
 1094|  19.5k|{
 1095|  19.5k|#ifdef ELFCORE
 1096|  19.5k|	Aux32Info auxv32;
 1097|  19.5k|	Aux64Info auxv64;
 1098|  19.5k|	size_t elsize = xauxv_sizeof;
  ------------------
  |  |  253|  19.5k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 16.4k, False: 3.04k]
  |  |  ------------------
  |  |  254|  19.5k|			 ? sizeof(auxv32)			\
  |  |  255|  19.5k|			 : sizeof(auxv64))
  ------------------
 1099|  19.5k|	const char *tag;
 1100|  19.5k|	int is_string;
 1101|  19.5k|	size_t nval, off;
 1102|       |
 1103|  19.5k|	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  361|  19.5k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  354|  19.5k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (1103:6): [True: 15.9k, False: 3.60k]
  ------------------
 1104|  19.5k|	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  361|  19.5k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  354|  19.5k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
 1105|  15.9k|		return 0;
 1106|       |
 1107|  3.60k|	switch (*flags & FLAGS_CORE_STYLE) {
  ------------------
  |  |  349|  3.60k|#define FLAGS_CORE_STYLE		0x0003
  ------------------
 1108|  1.69k|	case OS_STYLE_SVR4:
  ------------------
  |  |  339|  1.69k|#define	OS_STYLE_SVR4		0
  ------------------
  |  Branch (1108:2): [True: 1.69k, False: 1.91k]
  ------------------
 1109|  1.69k|		if (type != NT_AUXV)
  ------------------
  |  |  281|  1.69k|#define	NT_AUXV		6
  ------------------
  |  Branch (1109:7): [True: 1.19k, False: 500]
  ------------------
 1110|  1.19k|			return 0;
 1111|    500|		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.91k|	default:
  ------------------
  |  Branch (1122:2): [True: 1.91k, False: 1.69k]
  ------------------
 1123|  1.91k|		return 0;
 1124|  3.60k|	}
 1125|       |
 1126|    500|	*flags |= FLAGS_DID_AUXV;
  ------------------
  |  |  362|    500|#define FLAGS_DID_AUXV			0x2000
  ------------------
 1127|       |
 1128|    500|	nval = 0;
 1129|  7.19k|	for (off = 0; off + elsize <= descsz; off += elsize) {
  ------------------
  |  Branch (1129:16): [True: 6.71k, False: 481]
  ------------------
 1130|  6.71k|		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  250|  6.71k|#define xauxv_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.71k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (250:21): [True: 3.24k, False: 3.47k]
  |  |  ------------------
  |  |  251|  6.71k|			 ? CAST(void *, &auxv32)		\
  |  |  ------------------
  |  |  |  |  452|  3.24k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  252|  6.71k|			 : CAST(void *, &auxv64))
  |  |  ------------------
  |  |  |  |  452|  3.47k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  253|  6.71k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.71k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 3.24k, False: 3.47k]
  |  |  ------------------
  |  |  254|  6.71k|			 ? sizeof(auxv32)			\
  |  |  255|  6.71k|			 : sizeof(auxv64))
  ------------------
 1131|       |		/* Limit processing to 50 vector entries to prevent DoS */
 1132|  6.71k|		if (nval++ >= 50) {
  ------------------
  |  Branch (1132:7): [True: 19, False: 6.69k]
  ------------------
 1133|     19|			file_error(ms, 0, "Too many ELF Auxv elements");
 1134|     19|			return 1;
 1135|     19|		}
 1136|       |
 1137|  6.69k|		switch(xauxv_type) {
  ------------------
  |  |  256|  6.69k|#define xauxv_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.69k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (256:21): [True: 3.23k, False: 3.46k]
  |  |  ------------------
  |  |  257|  6.69k|			 ? elf_getu32(swap, auxv32.a_type)	\
  |  |  ------------------
  |  |  |  |  158|  3.23k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  258|  6.69k|			 : elf_getu64(swap, auxv64.a_type))
  |  |  ------------------
  |  |  |  |  159|  3.46k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1138|    999|		case AT_LINUX_EXECFN:
  ------------------
  |  |   90|    999|#define AT_LINUX_EXECFN 31   /* filename of program */
  ------------------
  |  Branch (1138:3): [True: 999, False: 5.69k]
  ------------------
 1139|    999|			is_string = 1;
 1140|    999|			tag = "execfn";
 1141|    999|			break;
 1142|    807|		case AT_LINUX_PLATFORM:
  ------------------
  |  |   81|    807|#define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
  ------------------
  |  Branch (1142:3): [True: 807, False: 5.89k]
  ------------------
 1143|    807|			is_string = 1;
 1144|    807|			tag = "platform";
 1145|    807|			break;
 1146|     49|		case AT_LINUX_UID:
  ------------------
  |  |   77|     49|#define AT_LINUX_UID    11    /* real uid */
  ------------------
  |  Branch (1146:3): [True: 49, False: 6.64k]
  ------------------
 1147|     49|			is_string = 0;
 1148|     49|			tag = "real uid";
 1149|     49|			break;
 1150|     27|		case AT_LINUX_GID:
  ------------------
  |  |   79|     27|#define AT_LINUX_GID    13    /* real gid */
  ------------------
  |  Branch (1150:3): [True: 27, False: 6.67k]
  ------------------
 1151|     27|			is_string = 0;
 1152|     27|			tag = "real gid";
 1153|     27|			break;
 1154|     56|		case AT_LINUX_EUID:
  ------------------
  |  |   78|     56|#define AT_LINUX_EUID   12    /* effective uid */
  ------------------
  |  Branch (1154:3): [True: 56, False: 6.64k]
  ------------------
 1155|     56|			is_string = 0;
 1156|     56|			tag = "effective uid";
 1157|     56|			break;
 1158|     64|		case AT_LINUX_EGID:
  ------------------
  |  |   80|     64|#define AT_LINUX_EGID   14    /* effective gid */
  ------------------
  |  Branch (1158:3): [True: 64, False: 6.63k]
  ------------------
 1159|     64|			is_string = 0;
 1160|     64|			tag = "effective gid";
 1161|     64|			break;
 1162|  4.69k|		default:
  ------------------
  |  Branch (1162:3): [True: 4.69k, False: 2.00k]
  ------------------
 1163|  4.69k|			is_string = 0;
 1164|  4.69k|			tag = NULL;
 1165|  4.69k|			break;
 1166|  6.69k|		}
 1167|       |
 1168|  6.69k|		if (tag == NULL)
  ------------------
  |  Branch (1168:7): [True: 4.69k, False: 2.00k]
  ------------------
 1169|  4.69k|			continue;
 1170|       |
 1171|  2.00k|		if (is_string) {
  ------------------
  |  Branch (1171:7): [True: 1.80k, False: 196]
  ------------------
 1172|  1.80k|			char buf[256];
 1173|  1.80k|			ssize_t buflen;
 1174|  1.80k|			buflen = get_string_on_virtaddr(ms, swap, clazz, fd,
 1175|  1.80k|			    ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf));
  ------------------
  |  |  259|  1.80k|#define xauxv_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.80k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (259:20): [True: 1.08k, False: 726]
  |  |  ------------------
  |  |  260|  1.80k|			 ? elf_getu32(swap, auxv32.a_v)		\
  |  |  ------------------
  |  |  |  |  158|  1.08k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  261|  1.80k|			 : elf_getu64(swap, auxv64.a_v))
  |  |  ------------------
  |  |  |  |  159|    726|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1176|       |
 1177|  1.80k|			if (buflen == 0)
  ------------------
  |  Branch (1177:8): [True: 1.70k, False: 98]
  ------------------
 1178|  1.70k|				continue;
 1179|       |
 1180|     98|			if (elf_printf(ms, ", %s: '%s'", tag, buf) == -1)
  ------------------
  |  Branch (1180:8): [True: 0, False: 98]
  ------------------
 1181|      0|				return -1;
 1182|    196|		} else {
 1183|    196|			if (elf_printf(ms, ", %s: %d", tag,
  ------------------
  |  Branch (1183:8): [True: 0, False: 196]
  ------------------
 1184|    196|			    CAST(int, xauxv_val)) == -1)
  ------------------
  |  |  452|    392|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 167, False: 29]
  |  |  ------------------
  ------------------
 1185|      0|				return -1;
 1186|    196|		}
 1187|  2.00k|	}
 1188|    481|	return 1;
 1189|       |#else
 1190|       |	return 0;
 1191|       |#endif
 1192|    500|}
readelf.c:get_string_on_virtaddr:
 1057|  1.80k|{
 1058|  1.80k|	char *bptr;
 1059|  1.80k|	off_t offset;
 1060|       |
 1061|  1.80k|	if (buflen == 0)
  ------------------
  |  Branch (1061:6): [True: 0, False: 1.80k]
  ------------------
 1062|      0|		return 0;
 1063|       |
 1064|  1.80k|	offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
 1065|  1.80k|	    fsize, virtaddr);
 1066|  1.80k|	if (offset < 0 ||
  ------------------
  |  Branch (1066:6): [True: 163, False: 1.64k]
  ------------------
 1067|  1.64k|	    (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
  ------------------
  |  |  452|  1.64k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1067:6): [True: 589, False: 1.05k]
  ------------------
 1068|    752|		(void)elf_printf(ms, ", can't read elf string at %jd",
 1069|    752|		    (intmax_t)offset);
 1070|    752|		return 0;
 1071|    752|	}
 1072|       |
 1073|  1.05k|	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|  15.8k|	for (bptr = buf; *bptr && isprint(CAST(unsigned char, *bptr)); bptr++)
  ------------------
  |  Branch (1077:19): [True: 15.6k, False: 215]
  |  Branch (1077:28): [True: 14.8k, False: 839]
  ------------------
 1078|  14.8k|		continue;
 1079|  1.05k|	if (*bptr != '\0')
  ------------------
  |  Branch (1079:6): [True: 839, False: 215]
  ------------------
 1080|    839|		return 0;
 1081|       |
 1082|    215|	return bptr - buf;
 1083|  1.05k|}
readelf.c:get_offset_from_virtaddr:
 1022|  1.80k|{
 1023|  1.80k|	Elf32_Phdr ph32;
 1024|  1.80k|	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|  27.5k|	for ( ; num; num--) {
  ------------------
  |  Branch (1030:10): [True: 27.4k, False: 119]
  ------------------
 1031|  27.4k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  27.4k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 13.6k, False: 13.8k]
  |  |  ------------------
  |  |  181|  27.4k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  452|  13.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  27.4k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  452|  13.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  27.4k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 13.6k, False: 13.8k]
  |  |  ------------------
  |  |  184|  27.4k|			 ? sizeof(ph32)				\
  |  |  185|  27.4k|			 : sizeof(ph64))
  ------------------
  |  Branch (1031:7): [True: 691, False: 26.7k]
  ------------------
 1032|  27.4k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  452|  54.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 13.6k, False: 13.8k]
  |  |  ------------------
  ------------------
 1033|    691|			if (elf_printf(ms,
  ------------------
  |  Branch (1033:8): [True: 0, False: 691]
  ------------------
 1034|    691|			    ", can't read elf program header at %jd",
 1035|    691|			    (intmax_t)off) == -1)
 1036|      0|				return -1;
 1037|    691|			return 0;
 1038|       |
 1039|    691|		}
 1040|  26.7k|		off += xph_sizeof;
  ------------------
  |  |  183|  26.7k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  26.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 13.2k, False: 13.4k]
  |  |  ------------------
  |  |  184|  26.7k|			 ? sizeof(ph32)				\
  |  |  185|  26.7k|			 : sizeof(ph64))
  ------------------
 1041|       |
 1042|  26.7k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  26.7k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  53.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  26.7k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  53.5k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 13.2k, False: 13.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  26.7k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  26.7k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1042:7): [True: 26.7k, False: 0]
  |  Branch (1042:32): [True: 17.0k, False: 9.74k]
  ------------------
 1043|       |			/* Perhaps warn here */
 1044|  17.0k|			continue;
 1045|  17.0k|		}
 1046|       |
 1047|  9.74k|		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  9.74k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  38.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.94k, False: 529]
  |  |  |  |  |  Branch (452:25): [True: 5.31k, False: 965]
  |  |  |  |  |  Branch (452:25): [True: 3.47k, False: 6.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  9.74k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  9.74k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  9.74k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  9.74k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  6.19k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  24.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.06k, False: 526]
  |  |  |  |  |  Branch (452:25): [True: 2.65k, False: 954]
  |  |  |  |  |  Branch (452:25): [True: 2.58k, False: 3.60k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  6.19k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  6.19k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  6.19k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  6.19k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  202|  6.19k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  12.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 2.58k, False: 3.60k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1047:7): [True: 6.19k, False: 3.55k]
  |  Branch (1047:32): [True: 996, False: 5.20k]
  ------------------
 1048|    996|			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  189|    996|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  1.99k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 611, False: 385]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|    996|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|    996|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
              			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  197|    996|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  3.98k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 474, False: 137]
  |  |  |  |  |  Branch (452:25): [True: 291, False: 94]
  |  |  |  |  |  Branch (452:25): [True: 611, False: 385]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|    996|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|    996|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|    996|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|    996|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
 1049|  9.74k|	}
 1050|    119|	return 0;
 1051|  1.80k|}
readelf.c:getu32:
  113|   608k|{
  114|   608k|	union {
  115|   608k|		uint32_t ui;
  116|   608k|		char c[4];
  117|   608k|	} retval, tmpval;
  118|       |
  119|   608k|	if (swap) {
  ------------------
  |  Branch (119:6): [True: 168k, False: 440k]
  ------------------
  120|   168k|		tmpval.ui = value;
  121|       |
  122|   168k|		retval.c[0] = tmpval.c[3];
  123|   168k|		retval.c[1] = tmpval.c[2];
  124|   168k|		retval.c[2] = tmpval.c[1];
  125|   168k|		retval.c[3] = tmpval.c[0];
  126|       |
  127|   168k|		return retval.ui;
  128|   168k|	} else
  129|   440k|		return value;
  130|   608k|}
readelf.c:dophn_exec:
 1740|  1.72k|{
 1741|  1.72k|	Elf32_Phdr ph32;
 1742|  1.72k|	Elf64_Phdr ph64;
 1743|  1.72k|	const char *str;
 1744|  1.72k|	unsigned char nbuf[NBUFSIZE];
 1745|  1.72k|	char interp[NBUFSIZE];
 1746|  1.72k|	ssize_t bufsize;
 1747|  1.72k|	size_t offset, align, need = 0;
 1748|  1.72k|	int pie = 0, dynamic = 0;
 1749|       |
 1750|  1.72k|	if (num == 0) {
  ------------------
  |  Branch (1750:6): [True: 550, False: 1.17k]
  ------------------
 1751|    550|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (1751:7): [True: 0, False: 550]
  ------------------
 1752|      0|			return -1;
 1753|    550|		return 0;
 1754|    550|	}
 1755|  1.17k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  1.17k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.17k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 659, False: 518]
  |  |  ------------------
  |  |  184|  1.17k|			 ? sizeof(ph32)				\
  |  |  185|  1.17k|			 : sizeof(ph64))
  ------------------
  |  Branch (1755:6): [True: 353, False: 824]
  ------------------
 1756|    353|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (1756:7): [True: 0, False: 353]
  ------------------
 1757|      0|			return -1;
 1758|    353|		return 0;
 1759|    353|	}
 1760|       |
 1761|    824|	interp[0] = '\0';
 1762|  34.5k|  	for ( ; num; num--) {
  ------------------
  |  Branch (1762:12): [True: 34.5k, False: 47]
  ------------------
 1763|  34.5k|		int doread;
 1764|  34.5k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  34.5k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  34.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 27.7k, False: 6.79k]
  |  |  ------------------
  |  |  181|  34.5k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  452|  27.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  34.5k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  452|  6.79k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  34.5k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  34.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 27.7k, False: 6.79k]
  |  |  ------------------
  |  |  184|  34.5k|			 ? sizeof(ph32)				\
  |  |  185|  34.5k|			 : sizeof(ph64))
  ------------------
  |  Branch (1764:7): [True: 771, False: 33.7k]
  ------------------
 1765|  34.5k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  452|  69.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 27.7k, False: 6.79k]
  |  |  ------------------
  ------------------
 1766|    771|			if (elf_printf(ms,
  ------------------
  |  Branch (1766:8): [True: 0, False: 771]
  ------------------
 1767|    771|			    ", can't read elf program headers at %jd",
 1768|    771|			    (intmax_t)off) == -1)
 1769|      0|				return -1;
 1770|    771|			return 0;
 1771|    771|		}
 1772|       |
 1773|  33.7k|		off += size;
 1774|  33.7k|		bufsize = 0;
 1775|  33.7k|		align = 4;
 1776|       |
 1777|       |		/* Things we can determine before we seek */
 1778|  33.7k|		switch (xph_type) {
  ------------------
  |  |  186|  33.7k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 27.3k, False: 6.42k]
  |  |  ------------------
  |  |  187|  33.7k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  27.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  33.7k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  6.42k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1779|  1.79k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  1.79k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1779:3): [True: 1.79k, False: 31.9k]
  ------------------
 1780|  1.79k|			doread = 1;
 1781|  1.79k|			break;
 1782|  5.19k|		case PT_NOTE:
  ------------------
  |  |  201|  5.19k|#define	PT_NOTE		4
  ------------------
  |  Branch (1782:3): [True: 5.19k, False: 28.5k]
  ------------------
 1783|  5.19k|			if (sh_num)	/* Did this through section headers */
  ------------------
  |  Branch (1783:8): [True: 609, False: 4.58k]
  ------------------
 1784|    609|				continue;
 1785|  4.58k|			if (((align = xph_align) & 0x80000000UL) != 0 ||
  ------------------
  |  |  192|  4.58k|#define xph_align	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  18.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.67k, False: 1.15k]
  |  |  |  |  |  Branch (452:25): [True: 1.42k, False: 331]
  |  |  |  |  |  Branch (452:25): [True: 2.82k, False: 1.76k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|  4.58k|			 ? CAST(off_t, (ph32.p_align ? 		\
  |  |  194|  4.58k|			    elf_getu32(swap, ph32.p_align) : 4))\
  |  |  195|  4.58k|			 : CAST(off_t, (ph64.p_align ?		\
  |  |  196|  4.58k|			    elf_getu64(swap, ph64.p_align) : 4))))
  ------------------
  |  Branch (1785:8): [True: 222, False: 4.36k]
  ------------------
 1786|  4.36k|			    align < 4) {
  ------------------
  |  Branch (1786:8): [True: 966, False: 3.40k]
  ------------------
 1787|  1.18k|				if (elf_printf(ms,
  ------------------
  |  Branch (1787:9): [True: 0, False: 1.18k]
  ------------------
 1788|  1.18k|				    ", invalid note alignment %#lx",
 1789|  1.18k|				    CAST(unsigned long, align)) == -1)
  ------------------
  |  |  452|  1.18k|#define CAST(T, b)	((T)(b))
  ------------------
 1790|      0|					return -1;
 1791|  1.18k|				align = 4;
 1792|  1.18k|			}
 1793|       |			/*FALLTHROUGH*/
 1794|  5.35k|		case PT_INTERP:
  ------------------
  |  |  200|  5.35k|#define	PT_INTERP	3
  ------------------
  |  Branch (1794:3): [True: 765, False: 32.9k]
  ------------------
 1795|  5.35k|			doread = 1;
 1796|  5.35k|			break;
 1797|  25.9k|		default:
  ------------------
  |  Branch (1797:3): [True: 25.9k, False: 7.76k]
  ------------------
 1798|  25.9k|			doread = 0;
 1799|  25.9k|			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  25.9k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  51.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  25.9k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  51.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 21.5k, False: 4.37k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  25.9k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  25.9k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1799:8): [True: 25.9k, False: 0]
  |  Branch (1799:33): [True: 14.8k, False: 11.1k]
  ------------------
 1800|       |				/* Maybe warn here? */
 1801|  14.8k|				continue;
 1802|  14.8k|			}
 1803|  11.1k|			break;
 1804|  33.7k|		}
 1805|       |
 1806|  18.3k|		if (doread) {
  ------------------
  |  Branch (1806:7): [True: 7.15k, False: 11.1k]
  ------------------
 1807|  7.15k|			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  7.15k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 5.11k, False: 2.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.15k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.15k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  2.66k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  5.33k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.92k, False: 740]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.15k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.15k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (1807:17): [True: 2.66k, False: 4.48k]
  ------------------
 1808|  7.15k|			    : sizeof(nbuf);
 1809|  7.15k|			off_t offs = xph_offset;
  ------------------
  |  |  189|  7.15k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 5.11k, False: 2.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  7.15k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  7.15k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
 1810|  7.15k|			bufsize = pread(fd, nbuf, len, offs);
 1811|  7.15k|			if (bufsize == -1) {
  ------------------
  |  Branch (1811:8): [True: 6, False: 7.14k]
  ------------------
 1812|      6|				if (elf_printf(ms,
  ------------------
  |  Branch (1812:9): [True: 0, False: 6]
  ------------------
 1813|      6|				    ", can't read section at %jd",
 1814|      6|				    (intmax_t)offs) == -1)
 1815|      0|					return -1;
 1816|      6|				return 0;
 1817|      6|			}
 1818|  7.15k|		}
 1819|       |
 1820|       |		/* Things we can determine when we seek */
 1821|  18.2k|		switch (xph_type) {
  ------------------
  |  |  186|  18.2k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  18.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 13.8k, False: 4.42k]
  |  |  ------------------
  |  |  187|  18.2k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  13.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  18.2k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  4.42k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1822|  1.79k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  1.79k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1822:3): [True: 1.79k, False: 16.5k]
  ------------------
 1823|  1.79k|			dynamic = 1;
 1824|  1.79k|			offset = 0;
 1825|       |			// Let DF_1 determine if we are PIE or not.
 1826|  1.79k|			ms->mode &= ~0111;
 1827|  60.5k|			for (;;) {
 1828|  60.5k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  452|  60.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1828:9): [True: 1.79k, False: 58.7k]
  ------------------
 1829|  1.79k|					break;
 1830|  58.7k|				offset = dodynamic(ms, nbuf, offset,
 1831|  58.7k|				    CAST(size_t, bufsize), clazz, swap,
  ------------------
  |  |  452|  58.7k|#define CAST(T, b)	((T)(b))
  ------------------
 1832|  58.7k|				    &pie, &need);
 1833|  58.7k|				if (offset == 0)
  ------------------
  |  Branch (1833:9): [True: 0, False: 58.7k]
  ------------------
 1834|      0|					break;
 1835|  58.7k|			}
 1836|  1.79k|			break;
 1837|       |
 1838|  58.7k|		case PT_INTERP:
  ------------------
  |  |  200|    765|#define	PT_INTERP	3
  ------------------
  |  Branch (1838:3): [True: 765, False: 17.5k]
  ------------------
 1839|    765|			need++;
 1840|    765|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    765|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    765|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    765|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1840:8): [True: 0, False: 765]
  ------------------
 1841|      0|				continue;
 1842|    765|			if (bufsize && nbuf[0]) {
  ------------------
  |  Branch (1842:8): [True: 499, False: 266]
  |  Branch (1842:19): [True: 294, False: 205]
  ------------------
 1843|    294|				nbuf[bufsize - 1] = '\0';
 1844|    294|				str = RCAST(const char *, nbuf);
  ------------------
  |  |  453|    294|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1845|    294|			} else
 1846|    471|				str = "*empty*";
 1847|    765|			strlcpy(interp, str, sizeof(interp));
 1848|    765|			break;
 1849|  4.58k|		case PT_NOTE:
  ------------------
  |  |  201|  4.58k|#define	PT_NOTE		4
  ------------------
  |  Branch (1849:3): [True: 4.58k, False: 13.7k]
  ------------------
 1850|  4.58k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  4.58k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  4.58k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  4.58k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1850:8): [True: 0, False: 4.58k]
  ------------------
 1851|      0|				return 0;
 1852|       |			/*
 1853|       |			 * This is a PT_NOTE section; loop through all the notes
 1854|       |			 * in the section.
 1855|       |			 */
 1856|  4.58k|			offset = 0;
 1857|  8.36k|			for (;;) {
 1858|  8.36k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  452|  8.36k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1858:9): [True: 3.70k, False: 4.66k]
  ------------------
 1859|  3.70k|					break;
 1860|  4.66k|				offset = donote(ms, nbuf, offset,
 1861|  4.66k|				    CAST(size_t, bufsize), clazz, swap, align,
  ------------------
  |  |  452|  4.66k|#define CAST(T, b)	((T)(b))
  ------------------
 1862|  4.66k|				    flags, notecount, fd, 0, 0, 0);
 1863|  4.66k|				if (offset == 0)
  ------------------
  |  Branch (1863:9): [True: 882, False: 3.77k]
  ------------------
 1864|    882|					break;
 1865|  4.66k|			}
 1866|  4.58k|			break;
 1867|  11.1k|		default:
  ------------------
  |  Branch (1867:3): [True: 11.1k, False: 7.14k]
  ------------------
 1868|  11.1k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  11.1k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  11.1k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  11.1k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1868:8): [True: 0, False: 11.1k]
  ------------------
 1869|      0|				continue;
 1870|  11.1k|			break;
 1871|  18.2k|		}
 1872|  18.2k|	}
 1873|     47|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   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 (1873:6): [True: 0, False: 47]
  ------------------
 1874|      0|		return 0;
 1875|     47|	if (dynamic) {
  ------------------
  |  Branch (1875:6): [True: 22, False: 25]
  ------------------
 1876|     22|		if (pie && need == 0)
  ------------------
  |  Branch (1876:7): [True: 3, False: 19]
  |  Branch (1876:14): [True: 1, False: 2]
  ------------------
 1877|      1|			str = "static-pie";
 1878|     21|		else
 1879|     21|			str = "dynamically";
 1880|     25|	} else {
 1881|     25|		str = "statically";
 1882|     25|	}
 1883|     47|	if (elf_printf(ms, ", %s linked", str) == -1)
  ------------------
  |  Branch (1883:6): [True: 0, False: 47]
  ------------------
 1884|      0|		return -1;
 1885|     47|	if (interp[0])
  ------------------
  |  Branch (1885:6): [True: 9, False: 38]
  ------------------
 1886|      9|		if (elf_printf(ms, ", interpreter %s", file_printable(ms,
  ------------------
  |  Branch (1886:7): [True: 3, False: 6]
  ------------------
 1887|      9|		    RCAST(char *, nbuf), sizeof(nbuf),
  ------------------
  |  |  453|      9|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1888|      9|		    interp, sizeof(interp))) == -1)
 1889|      3|			return -1;
 1890|     44|	return 0;
 1891|     47|}
readelf.c:dodynamic:
 1197|  58.7k|{
 1198|  58.7k|	Elf32_Dyn dh32;
 1199|  58.7k|	Elf64_Dyn dh64;
 1200|  58.7k|	unsigned char *dbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  452|  58.7k|#define CAST(T, b)	((T)(b))
  ------------------
 1201|       |
 1202|  58.7k|	if (xdh_sizeof + offset > size) {
  ------------------
  |  |  227|  58.7k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  58.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 48.7k, False: 9.98k]
  |  |  ------------------
  |  |  228|  58.7k|			 ? sizeof(dh32)				\
  |  |  229|  58.7k|			 : sizeof(dh64))
  ------------------
  |  Branch (1202:6): [True: 1.22k, False: 57.5k]
  ------------------
 1203|       |		/*
 1204|       |		 * We're out of note headers.
 1205|       |		 */
 1206|  1.22k|		return xdh_sizeof + offset;
  ------------------
  |  |  227|  1.22k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.22k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 1.01k, False: 210]
  |  |  ------------------
  |  |  228|  1.22k|			 ? sizeof(dh32)				\
  |  |  229|  1.22k|			 : sizeof(dh64))
  ------------------
 1207|  1.22k|	}
 1208|       |
 1209|  57.5k|	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  224|  57.5k|#define xdh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  57.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (224:19): [True: 47.7k, False: 9.77k]
  |  |  ------------------
  |  |  225|  57.5k|			 ? CAST(void *, &dh32)			\
  |  |  ------------------
  |  |  |  |  452|  47.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  226|  57.5k|			 : CAST(void *, &dh64))
  |  |  ------------------
  |  |  |  |  452|  9.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  227|  57.5k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  57.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 47.7k, False: 9.77k]
  |  |  ------------------
  |  |  228|  57.5k|			 ? sizeof(dh32)				\
  |  |  229|  57.5k|			 : sizeof(dh64))
  ------------------
 1210|  57.5k|	offset += xdh_sizeof;
  ------------------
  |  |  227|  57.5k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  57.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 47.7k, False: 9.77k]
  |  |  ------------------
  |  |  228|  57.5k|			 ? sizeof(dh32)				\
  |  |  229|  57.5k|			 : sizeof(dh64))
  ------------------
 1211|       |
 1212|  57.5k|	switch (xdh_tag) {
  ------------------
  |  |  230|  57.5k|#define xdh_tag		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  57.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (230:19): [True: 47.7k, False: 9.77k]
  |  |  ------------------
  |  |  231|  57.5k|			 ? elf_getu32(swap, dh32.d_tag)		\
  |  |  ------------------
  |  |  |  |  158|  47.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  232|  57.5k|			 : elf_getu64(swap, dh64.d_tag))
  |  |  ------------------
  |  |  |  |  159|  9.77k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1213|  2.19k|	case DT_FLAGS_1:
  ------------------
  |  |  531|  2.19k|#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
  ------------------
  |  Branch (1213:2): [True: 2.19k, False: 55.3k]
  ------------------
 1214|  2.19k|		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  233|  2.19k|#define xdh_val		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.19k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (233:19): [True: 1.28k, False: 918]
  |  |  ------------------
  |  |  234|  2.19k|			 ? elf_getu32(swap, dh32.d_un.d_val)	\
  |  |  ------------------
  |  |  |  |  158|  1.28k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  235|  2.19k|			 : elf_getu64(swap, dh64.d_un.d_val))
  |  |  ------------------
  |  |  |  |  159|    918|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
              		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  574|  2.19k|#define	DF_1_PIE	0x08000000	/* Position Independent Executable */
  ------------------
  |  Branch (1214:7): [True: 993, False: 1.20k]
  ------------------
 1215|    993|			*pie = 1;
 1216|    993|			ms->mode |= 0111;
 1217|    993|		} else
 1218|  1.20k|			ms->mode &= ~0111;
 1219|  2.19k|		break;
 1220|    915|	case DT_NEEDED:
  ------------------
  |  |  494|    915|#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
  ------------------
  |  Branch (1220:2): [True: 915, False: 56.6k]
  ------------------
 1221|    915|		(*need)++;
 1222|    915|		break;
 1223|  54.4k|	default:
  ------------------
  |  Branch (1223:2): [True: 54.4k, False: 3.11k]
  ------------------
 1224|  54.4k|		break;
 1225|  57.5k|	}
 1226|  57.5k|	return offset;
 1227|  57.5k|}
readelf.c:doshn:
 1432|  1.79k|{
 1433|  1.79k|	Elf32_Shdr sh32;
 1434|  1.79k|	Elf64_Shdr sh64;
 1435|  1.79k|	int stripped = 1, has_debug_info = 0;
 1436|  1.79k|	size_t nbadcap = 0;
 1437|  1.79k|	void *nbuf;
 1438|  1.79k|	off_t noff, coff, name_off, offs;
 1439|  1.79k|	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilities */
 1440|  1.79k|	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilities */
 1441|  1.79k|	char name[50];
 1442|  1.79k|	ssize_t namesize;
 1443|       |
 1444|  1.79k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.79k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.79k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.79k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1444:6): [True: 0, False: 1.79k]
  ------------------
 1445|      0|		return 0;
 1446|       |
 1447|  1.79k|	if (num == 0) {
  ------------------
  |  Branch (1447:6): [True: 471, False: 1.32k]
  ------------------
 1448|    471|		if (elf_printf(ms, ", no section header") == -1)
  ------------------
  |  Branch (1448:7): [True: 0, False: 471]
  ------------------
 1449|      0|			return -1;
 1450|    471|		return 0;
 1451|    471|	}
 1452|  1.32k|	if (size != xsh_sizeof) {
  ------------------
  |  |  164|  1.32k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.32k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 699, False: 625]
  |  |  ------------------
  |  |  165|  1.32k|			 ? sizeof(sh32)				\
  |  |  166|  1.32k|			 : sizeof(sh64))
  ------------------
  |  Branch (1452:6): [True: 303, False: 1.02k]
  ------------------
 1453|    303|		if (elf_printf(ms, ", corrupted section header size") == -1)
  ------------------
  |  Branch (1453:7): [True: 0, False: 303]
  ------------------
 1454|      0|			return -1;
 1455|    303|		return 0;
 1456|    303|	}
 1457|       |
 1458|       |	/* Read offset of name section to be able to read section names later */
 1459|  1.02k|	offs = CAST(off_t, (off + size * strtab));
  ------------------
  |  |  452|  1.02k|#define CAST(T, b)	((T)(b))
  ------------------
 1460|  1.02k|	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  161|  1.02k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.02k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 537, False: 484]
  |  |  ------------------
  |  |  162|  1.02k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  452|    537|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  1.02k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  452|    484|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  164|  1.02k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.02k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 537, False: 484]
  |  |  ------------------
  |  |  165|  1.02k|			 ? sizeof(sh32)				\
  |  |  166|  1.02k|			 : sizeof(sh64))
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  452|  2.04k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 537, False: 484]
  |  |  ------------------
  ------------------
  |  Branch (1460:6): [True: 7, False: 1.01k]
  ------------------
 1461|      7|		if (elf_printf(ms, ", missing section headers at %jd",
  ------------------
  |  Branch (1461:7): [True: 0, False: 7]
  ------------------
 1462|      7|		    (intmax_t)offs) == -1)
 1463|      0|			return -1;
 1464|      7|		return 0;
 1465|      7|	}
 1466|  1.01k|	name_off = xsh_offset;
  ------------------
  |  |  170|  1.01k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  2.02k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 533, False: 481]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.01k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.01k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1467|       |
 1468|  1.01k|	if (fsize != SIZE_UNKNOWN && fsize < name_off) {
  ------------------
  |  |   65|  1.01k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|  2.02k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1468:6): [True: 1.01k, False: 0]
  |  Branch (1468:31): [True: 13, False: 1.00k]
  ------------------
 1469|     13|		if (elf_printf(ms, ", too large section header offset %jd",
  ------------------
  |  Branch (1469:7): [True: 0, False: 13]
  ------------------
 1470|     13|		    (intmax_t)name_off) == -1)
 1471|      0|			return -1;
 1472|     13|		return 0;
 1473|     13|	}
 1474|       |
 1475|  62.8k|	for ( ; num; num--) {
  ------------------
  |  Branch (1475:10): [True: 62.6k, False: 214]
  ------------------
 1476|       |		/* Read the name of this section. */
 1477|  62.6k|		offs = name_off + xsh_name;
  ------------------
  |  |  176|  62.6k|#define xsh_name    	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  62.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (176:23): [True: 56.1k, False: 6.53k]
  |  |  ------------------
  |  |  177|  62.6k|			 ? elf_getu32(swap, sh32.sh_name)	\
  |  |  ------------------
  |  |  |  |  158|  56.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  178|  62.6k|			 : elf_getu32(swap, sh64.sh_name))
  |  |  ------------------
  |  |  |  |  158|  6.53k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1478|  62.6k|		if ((namesize = pread(fd, name, sizeof(name) - 1, offs))
  ------------------
  |  Branch (1478:7): [True: 48, False: 62.6k]
  ------------------
 1479|  62.6k|		    == -1) {
 1480|     48|			if (elf_printf(ms, 
  ------------------
  |  Branch (1480:8): [True: 0, False: 48]
  ------------------
 1481|     48|			    ", can't read name of elf section at %jd",
 1482|     48|			    (intmax_t)offs) == -1)
 1483|      0|				return -1;
 1484|     48|			return 0;
 1485|     48|		}
 1486|  62.6k|		name[namesize] = '\0';
 1487|  62.6k|		if (strcmp(name, ".debug_info") == 0) {
  ------------------
  |  Branch (1487:7): [True: 196, False: 62.4k]
  ------------------
 1488|    196|			has_debug_info = 1;
 1489|    196|			stripped = 0;
 1490|    196|		}
 1491|       |
 1492|  62.6k|		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  161|  62.6k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  62.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 56.1k, False: 6.48k]
  |  |  ------------------
  |  |  162|  62.6k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  452|  56.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  62.6k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  452|  6.48k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  164|  62.6k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  62.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 56.1k, False: 6.48k]
  |  |  ------------------
  |  |  165|  62.6k|			 ? sizeof(sh32)				\
  |  |  166|  62.6k|			 : sizeof(sh64))
  ------------------
  |  Branch (1492:7): [True: 524, False: 62.1k]
  ------------------
 1493|  62.6k|		    CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  452|   125k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 56.1k, False: 6.48k]
  |  |  ------------------
  ------------------
 1494|    524|			if (elf_printf(ms, ", can't read elf section at %jd",
  ------------------
  |  Branch (1494:8): [True: 0, False: 524]
  ------------------
 1495|    524|			    (intmax_t)off) == -1)
 1496|      0|				return -1;
 1497|    524|			return 0;
 1498|    524|		}
 1499|  62.1k|		off += size;
 1500|       |
 1501|       |		/* Things we can determine before we seek */
 1502|  62.1k|		switch (xsh_type) {
  ------------------
  |  |  173|  62.1k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  62.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 55.7k, False: 6.31k]
  |  |  ------------------
  |  |  174|  62.1k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  55.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  62.1k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  6.31k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1503|  1.56k|		case SHT_SYMTAB:
  ------------------
  |  |  141|  1.56k|#define	SHT_SYMTAB	2
  ------------------
  |  Branch (1503:3): [True: 1.56k, False: 60.5k]
  ------------------
 1504|       |#if 0
 1505|       |		case SHT_DYNSYM:
 1506|       |#endif
 1507|  1.56k|			stripped = 0;
 1508|  1.56k|			break;
 1509|  60.5k|		default:
  ------------------
  |  Branch (1509:3): [True: 60.5k, False: 1.56k]
  ------------------
 1510|  60.5k|			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |   65|  60.5k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  452|   121k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |  170|  60.5k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|   121k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 54.2k, False: 6.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  60.5k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  60.5k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1510:8): [True: 60.5k, False: 0]
  |  Branch (1510:33): [True: 34.3k, False: 26.2k]
  ------------------
 1511|       |				/* Perhaps warn here */
 1512|  34.3k|				continue;
 1513|  34.3k|			}
 1514|  26.2k|			break;
 1515|  62.1k|		}
 1516|       |
 1517|       |
 1518|       |		/* Things we can determine when we seek */
 1519|  27.8k|		switch (xsh_type) {
  ------------------
  |  |  173|  27.8k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  27.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 23.0k, False: 4.73k]
  |  |  ------------------
  |  |  174|  27.8k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  23.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  27.8k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  4.73k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1520|  2.60k|		case SHT_NOTE:
  ------------------
  |  |  142|  2.60k|#define	SHT_NOTE	7
  ------------------
  |  Branch (1520:3): [True: 2.60k, False: 25.1k]
  ------------------
 1521|  2.60k|			if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
  ------------------
  |  |  452|  10.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 1.50k, False: 1.09k]
  |  |  |  Branch (452:25): [True: 1.50k, False: 1.09k]
  |  |  ------------------
  ------------------
  |  Branch (1521:8): [True: 117, False: 2.49k]
  ------------------
 1522|  2.60k|			    CAST(uintmax_t, fsize)) {
  ------------------
  |  |  452|  2.60k|#define CAST(T, b)	((T)(b))
  ------------------
 1523|    117|				if (elf_printf(ms,
  ------------------
  |  Branch (1523:9): [True: 0, False: 117]
  ------------------
 1524|    117|				    ", note offset/size %#" INTMAX_T_FORMAT
 1525|    117|				    "x+%#" INTMAX_T_FORMAT "x exceeds"
 1526|    117|				    " file size %#" INTMAX_T_FORMAT "x",
 1527|    117|				    CAST(uintmax_t, xsh_offset),
  ------------------
  |  |  452|    234|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 52, False: 65]
  |  |  ------------------
  ------------------
 1528|    117|				    CAST(uintmax_t, xsh_size),
  ------------------
  |  |  452|    234|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 52, False: 65]
  |  |  ------------------
  ------------------
 1529|    117|				    CAST(uintmax_t, fsize)) == -1)
  ------------------
  |  |  452|    117|#define CAST(T, b)	((T)(b))
  ------------------
 1530|      0|					return -1;
 1531|    117|				return 0;
 1532|    117|			}
 1533|  2.49k|			if (xsh_size > ms->elf_shsize_max) {
  ------------------
  |  |  167|  2.49k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  4.98k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.45k, False: 1.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.49k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.49k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1533:8): [True: 5, False: 2.48k]
  ------------------
 1534|      5|				file_error(ms, errno, "Note section size too "
 1535|      5|				    "big (%ju > %zu)", (uintmax_t)xsh_size,
  ------------------
  |  |  167|      5|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|     10|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|      5|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|      5|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1536|      5|				    ms->elf_shsize_max);
 1537|      5|				return -1;
 1538|      5|			}
 1539|  2.48k|			if ((nbuf = malloc(xsh_size)) == NULL) {
  ------------------
  |  |  167|  2.48k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  4.97k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.45k, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.48k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.48k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1539:8): [True: 0, False: 2.48k]
  ------------------
 1540|      0|				file_error(ms, errno, "Cannot allocate memory"
 1541|      0|				    " for note");
 1542|      0|				return -1;
 1543|      0|			}
 1544|  2.48k|			offs = xsh_offset;
  ------------------
  |  |  170|  2.48k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  4.97k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.45k, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  2.48k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  2.48k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1545|  2.48k|			if (pread(fd, nbuf, xsh_size, offs) <
  ------------------
  |  |  167|  2.48k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  4.97k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.45k, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.48k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.48k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1545:8): [True: 18, False: 2.46k]
  ------------------
 1546|  2.48k|			    CAST(ssize_t, xsh_size)) {
  ------------------
  |  |  452|  4.97k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 1.45k, False: 1.02k]
  |  |  ------------------
  ------------------
 1547|     18|				free(nbuf);
 1548|     18|				if (elf_printf(ms,
  ------------------
  |  Branch (1548:9): [True: 0, False: 18]
  ------------------
 1549|     18|				    ", can't read elf note at %jd",
 1550|     18|				    (intmax_t)offs) == -1)
 1551|      0|					return -1;
 1552|     18|				return 0;
 1553|     18|			}
 1554|       |
 1555|  2.46k|			noff = 0;
 1556|  6.64k|			for (;;) {
 1557|  6.64k|				if (noff >= CAST(off_t, xsh_size))
  ------------------
  |  |  452|  13.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 3.18k, False: 3.46k]
  |  |  ------------------
  ------------------
  |  Branch (1557:9): [True: 2.00k, False: 4.64k]
  ------------------
 1558|  2.00k|					break;
 1559|  4.64k|				noff = donote(ms, nbuf, CAST(size_t, noff),
  ------------------
  |  |  452|  4.64k|#define CAST(T, b)	((T)(b))
  ------------------
 1560|  4.64k|				    xsh_size, clazz, swap, 4, flags, notecount,
  ------------------
  |  |  167|  4.64k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  9.28k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 1.79k, False: 2.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  4.64k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  4.64k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1561|  4.64k|				    fd, 0, 0, 0);
 1562|  4.64k|				if (noff == 0)
  ------------------
  |  Branch (1562:9): [True: 463, False: 4.18k]
  ------------------
 1563|    463|					break;
 1564|  4.64k|			}
 1565|  2.46k|			free(nbuf);
 1566|  2.46k|			break;
 1567|  2.21k|		case SHT_SUNW_cap:
  ------------------
  |  |  144|  2.21k|#define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
  ------------------
  |  Branch (1567:3): [True: 2.21k, False: 25.5k]
  ------------------
 1568|  2.21k|			switch (mach) {
 1569|    300|			case EM_SPARC:
  ------------------
  |  |  133|    300|#define	EM_SPARC	2
  ------------------
  |  Branch (1569:4): [True: 300, False: 1.91k]
  ------------------
 1570|    816|			case EM_SPARCV9:
  ------------------
  |  |  136|    816|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1570:4): [True: 516, False: 1.70k]
  ------------------
 1571|  1.06k|			case EM_IA_64:
  ------------------
  |  |  137|  1.06k|#define	EM_IA_64	50
  ------------------
  |  Branch (1571:4): [True: 251, False: 1.96k]
  ------------------
 1572|  1.71k|			case EM_386:
  ------------------
  |  |  134|  1.71k|#define	EM_386		3
  ------------------
  |  Branch (1572:4): [True: 646, False: 1.57k]
  ------------------
 1573|  1.90k|			case EM_AMD64:
  ------------------
  |  |  138|  1.90k|#define	EM_AMD64	62
  ------------------
  |  Branch (1573:4): [True: 190, False: 2.02k]
  ------------------
 1574|  1.90k|				break;
 1575|    313|			default:
  ------------------
  |  Branch (1575:4): [True: 313, False: 1.90k]
  ------------------
 1576|    313|				goto skip;
 1577|  2.21k|			}
 1578|       |
 1579|  1.90k|			if (nbadcap > 5)
  ------------------
  |  Branch (1579:8): [True: 522, False: 1.38k]
  ------------------
 1580|    522|				break;
 1581|  1.38k|			if (lseek(fd, xsh_offset, SEEK_SET)
  ------------------
  |  |  170|  1.38k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  452|  2.76k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:25): [True: 830, False: 551]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.38k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.38k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1581:8): [True: 4, False: 1.37k]
  ------------------
 1582|  1.38k|			    == CAST(off_t, -1)) {
  ------------------
  |  |  452|  1.38k|#define CAST(T, b)	((T)(b))
  ------------------
 1583|      4|				file_badseek(ms);
 1584|      4|				return -1;
 1585|      4|			}
 1586|  1.37k|			coff = 0;
 1587|  7.00k|			for (;;) {
 1588|  7.00k|				Elf32_Cap cap32;
 1589|  7.00k|				Elf64_Cap cap64;
 1590|  7.00k|				cap32.c_un.c_val = 0;
 1591|  7.00k|				cap64.c_un.c_val = 0;
 1592|  7.00k|				char cbuf[/*CONSTCOND*/
 1593|  7.00k|				    MAX(sizeof(cap32), sizeof(cap64))];
 1594|  7.00k|				if ((coff += xcap_sizeof) >
  ------------------
  |  |  240|  7.00k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.00k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 5.02k, False: 1.98k]
  |  |  ------------------
  |  |  241|  7.00k|			 ? sizeof(cap32)			\
  |  |  242|  7.00k|			 : sizeof(cap64))
  ------------------
  |  Branch (1594:9): [True: 661, False: 6.34k]
  ------------------
 1595|  7.00k|				    CAST(off_t, xsh_size))
  ------------------
  |  |  452|  14.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 5.02k, False: 1.98k]
  |  |  ------------------
  ------------------
 1596|    661|					break;
 1597|  6.34k|				if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
  ------------------
  |  |  452|  12.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 4.70k, False: 1.63k]
  |  |  ------------------
  ------------------
  |  Branch (1597:9): [True: 71, False: 6.27k]
  ------------------
 1598|  6.34k|				    CAST(ssize_t, xcap_sizeof)) {
  ------------------
  |  |  452|  12.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 4.70k, False: 1.63k]
  |  |  ------------------
  ------------------
 1599|     71|					file_badread(ms);
 1600|     71|					return -1;
 1601|     71|				}
 1602|  6.27k|				if (cbuf[0] == 'A') {
  ------------------
  |  Branch (1602:9): [True: 387, False: 5.88k]
  ------------------
 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|    387|					break;
 1631|    387|				}
 1632|  5.88k|				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  237|  5.88k|#define xcap_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.88k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (237:20): [True: 4.35k, False: 1.52k]
  |  |  ------------------
  |  |  238|  5.88k|			 ? CAST(void *, &cap32)			\
  |  |  ------------------
  |  |  |  |  452|  4.35k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  239|  5.88k|			 : CAST(void *, &cap64))
  |  |  ------------------
  |  |  |  |  452|  1.52k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  240|  5.88k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.88k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 4.35k, False: 1.52k]
  |  |  ------------------
  |  |  241|  5.88k|			 ? sizeof(cap32)			\
  |  |  242|  5.88k|			 : sizeof(cap64))
  ------------------
 1633|  5.88k|				switch (xcap_tag) {
  ------------------
  |  |  243|  5.88k|#define xcap_tag	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.88k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (243:19): [True: 4.35k, False: 1.52k]
  |  |  ------------------
  |  |  244|  5.88k|			 ? elf_getu32(swap, cap32.c_tag)	\
  |  |  ------------------
  |  |  |  |  158|  4.35k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  245|  5.88k|			 : elf_getu64(swap, cap64.c_tag))
  |  |  ------------------
  |  |  |  |  159|  1.52k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1634|  2.86k|				case CA_SUNW_NULL:
  ------------------
  |  |  424|  2.86k|#define	CA_SUNW_NULL	0
  ------------------
  |  Branch (1634:5): [True: 2.86k, False: 3.01k]
  ------------------
 1635|  2.86k|					break;
 1636|    981|				case CA_SUNW_HW_1:
  ------------------
  |  |  425|    981|#define	CA_SUNW_HW_1	1
  ------------------
  |  Branch (1636:5): [True: 981, False: 4.90k]
  ------------------
 1637|    981|					cap_hw1 |= xcap_val;
  ------------------
  |  |  246|    981|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    981|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 739, False: 242]
  |  |  ------------------
  |  |  247|    981|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    739|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|    981|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    242|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1638|    981|					break;
 1639|    878|				case CA_SUNW_SF_1:
  ------------------
  |  |  426|    878|#define	CA_SUNW_SF_1	2
  ------------------
  |  Branch (1639:5): [True: 878, False: 5.00k]
  ------------------
 1640|    878|					cap_sf1 |= xcap_val;
  ------------------
  |  |  246|    878|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    878|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 794, False: 84]
  |  |  ------------------
  |  |  247|    878|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    794|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|    878|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|     84|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1641|    878|					break;
 1642|  1.15k|				default:
  ------------------
  |  Branch (1642:5): [True: 1.15k, False: 4.72k]
  ------------------
 1643|  1.15k|					if (elf_printf(ms,
  ------------------
  |  Branch (1643:10): [True: 0, False: 1.15k]
  ------------------
 1644|  1.15k|					    ", with unknown capability "
 1645|  1.15k|					    "%#" INT64_T_FORMAT "x = %#"
 1646|  1.15k|					    INT64_T_FORMAT "x",
 1647|  1.15k|					    CAST(unsigned long long, xcap_tag),
  ------------------
  |  |  452|  2.31k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 626, False: 531]
  |  |  ------------------
  ------------------
 1648|  1.15k|					    CAST(unsigned long long, xcap_val))
  ------------------
  |  |  452|  2.31k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (452:25): [True: 626, False: 531]
  |  |  ------------------
  ------------------
 1649|  1.15k|					    == -1)
 1650|      0|						return -1;
 1651|  1.15k|					if (nbadcap++ > 2)
  ------------------
  |  Branch (1651:10): [True: 258, False: 899]
  ------------------
 1652|    258|						goto skip;
 1653|    899|					break;
 1654|  5.88k|				}
 1655|  5.88k|			}
 1656|       |			/*FALLTHROUGH*/
 1657|  1.61k|		skip:
 1658|  24.5k|		default:
  ------------------
  |  Branch (1658:3): [True: 22.9k, False: 4.82k]
  ------------------
 1659|  24.5k|			break;
 1660|  27.8k|		}
 1661|  27.8k|	}
 1662|       |
 1663|    214|	if (has_debug_info) {
  ------------------
  |  Branch (1663:6): [True: 1, False: 213]
  ------------------
 1664|      1|		if (elf_printf(ms, ", with debug_info") == -1)
  ------------------
  |  Branch (1664:7): [True: 0, False: 1]
  ------------------
 1665|      0|			return -1;
 1666|      1|	}
 1667|    214|	if (elf_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
  ------------------
  |  Branch (1667:6): [True: 0, False: 214]
  |  Branch (1667:37): [True: 209, False: 5]
  ------------------
 1668|      0|		return -1;
 1669|    214|	if (cap_hw1) {
  ------------------
  |  Branch (1669:6): [True: 99, False: 115]
  ------------------
 1670|     99|		const cap_desc_t *cdp;
 1671|     99|		switch (mach) {
 1672|      7|		case EM_SPARC:
  ------------------
  |  |  133|      7|#define	EM_SPARC	2
  ------------------
  |  Branch (1672:3): [True: 7, False: 92]
  ------------------
 1673|      7|		case EM_SPARC32PLUS:
  ------------------
  |  |  135|      7|#define	EM_SPARC32PLUS	18
  ------------------
  |  Branch (1673:3): [True: 0, False: 99]
  ------------------
 1674|     84|		case EM_SPARCV9:
  ------------------
  |  |  136|     84|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1674:3): [True: 77, False: 22]
  ------------------
 1675|     84|			cdp = cap_desc_sparc;
 1676|     84|			break;
 1677|      4|		case EM_386:
  ------------------
  |  |  134|      4|#define	EM_386		3
  ------------------
  |  Branch (1677:3): [True: 4, False: 95]
  ------------------
 1678|      6|		case EM_IA_64:
  ------------------
  |  |  137|      6|#define	EM_IA_64	50
  ------------------
  |  Branch (1678:3): [True: 2, False: 97]
  ------------------
 1679|     15|		case EM_AMD64:
  ------------------
  |  |  138|     15|#define	EM_AMD64	62
  ------------------
  |  Branch (1679:3): [True: 9, False: 90]
  ------------------
 1680|     15|			cdp = cap_desc_386;
 1681|     15|			break;
 1682|      0|		default:
  ------------------
  |  Branch (1682:3): [True: 0, False: 99]
  ------------------
 1683|      0|			cdp = NULL;
 1684|      0|			break;
 1685|     99|		}
 1686|     99|		if (elf_printf(ms, ", uses") == -1)
  ------------------
  |  Branch (1686:7): [True: 0, False: 99]
  ------------------
 1687|      0|			return -1;
 1688|     99|		if (cdp) {
  ------------------
  |  Branch (1688:7): [True: 99, False: 0]
  ------------------
 1689|  1.39k|			while (cdp->cd_name) {
  ------------------
  |  Branch (1689:11): [True: 1.29k, False: 99]
  ------------------
 1690|  1.29k|				if (cap_hw1 & cdp->cd_mask) {
  ------------------
  |  Branch (1690:9): [True: 663, False: 636]
  ------------------
 1691|    663|					if (elf_printf(ms,
  ------------------
  |  Branch (1691:10): [True: 0, False: 663]
  ------------------
 1692|    663|					    " %s", cdp->cd_name) == -1)
 1693|      0|						return -1;
 1694|    663|					cap_hw1 &= ~cdp->cd_mask;
 1695|    663|				}
 1696|  1.29k|				++cdp;
 1697|  1.29k|			}
 1698|     99|			if (cap_hw1)
  ------------------
  |  Branch (1698:8): [True: 91, False: 8]
  ------------------
 1699|     91|				if (elf_printf(ms,
  ------------------
  |  Branch (1699:9): [True: 0, False: 91]
  ------------------
 1700|     91|				    " unknown hardware capability %#"
 1701|     91|				    INT64_T_FORMAT "x",
 1702|     91|				    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  452|     91|#define CAST(T, b)	((T)(b))
  ------------------
 1703|      0|					return -1;
 1704|     99|		} 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|     99|	}
 1711|    214|	if (cap_sf1) {
  ------------------
  |  Branch (1711:6): [True: 88, False: 126]
  ------------------
 1712|     88|		if (cap_sf1 & SF1_SUNW_FPUSED) {
  ------------------
  |  |  430|     88|#define	SF1_SUNW_FPUSED	0x02
  ------------------
  |  Branch (1712:7): [True: 39, False: 49]
  ------------------
 1713|     39|			if (elf_printf(ms,
  ------------------
  |  Branch (1713:8): [True: 0, False: 39]
  ------------------
 1714|     39|			    (cap_sf1 & SF1_SUNW_FPKNWN)
  ------------------
  |  |  429|     39|#define	SF1_SUNW_FPKNWN	0x01
  ------------------
  |  Branch (1714:8): [True: 29, False: 10]
  ------------------
 1715|     39|			    ? ", uses frame pointer"
 1716|     39|			    : ", not known to use frame pointer") == -1)
 1717|      0|				return -1;
 1718|     39|		}
 1719|     88|		cap_sf1 &= ~SF1_SUNW_MASK;
  ------------------
  |  |  431|     88|#define	SF1_SUNW_MASK	0x03
  ------------------
 1720|     88|		if (cap_sf1)
  ------------------
  |  Branch (1720:7): [True: 87, False: 1]
  ------------------
 1721|     87|			if (elf_printf(ms,
  ------------------
  |  Branch (1721:8): [True: 0, False: 87]
  ------------------
 1722|     87|			    ", with unknown software capability %#"
 1723|     87|			    INT64_T_FORMAT "x",
 1724|     87|			    CAST(unsigned long long, cap_sf1)) == -1)
  ------------------
  |  |  452|     87|#define CAST(T, b)	((T)(b))
  ------------------
 1725|      0|				return -1;
 1726|     88|	}
 1727|    214|	return 0;
 1728|    214|}
readelf.c:getu64:
  134|  88.9k|{
  135|  88.9k|	union {
  136|  88.9k|		uint64_t ui;
  137|  88.9k|		char c[8];
  138|  88.9k|	} retval, tmpval;
  139|       |
  140|  88.9k|	if (swap) {
  ------------------
  |  Branch (140:6): [True: 46.3k, False: 42.6k]
  ------------------
  141|  46.3k|		tmpval.ui = value;
  142|       |
  143|  46.3k|		retval.c[0] = tmpval.c[7];
  144|  46.3k|		retval.c[1] = tmpval.c[6];
  145|  46.3k|		retval.c[2] = tmpval.c[5];
  146|  46.3k|		retval.c[3] = tmpval.c[4];
  147|  46.3k|		retval.c[4] = tmpval.c[3];
  148|  46.3k|		retval.c[5] = tmpval.c[2];
  149|  46.3k|		retval.c[6] = tmpval.c[1];
  150|  46.3k|		retval.c[7] = tmpval.c[0];
  151|       |
  152|  46.3k|		return retval.ui;
  153|  46.3k|	} else
  154|  42.6k|		return value;
  155|  88.9k|}
readelf.c:elf_printf:
   72|  15.2k|{
   73|  15.2k|	va_list ap;
   74|  15.2k|	int rv;
   75|       |
   76|  15.2k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  15.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  15.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  15.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (76:6): [True: 0, False: 15.2k]
  ------------------
   77|      0|		return 1;
   78|       |
   79|  15.2k|	va_start(ap, fmt);
   80|  15.2k|	rv = file_vprintf(ms, fmt, ap);
   81|       |	va_end(ap);
   82|  15.2k|	return rv;
   83|  15.2k|}

file_softmagic:
  130|  14.9k|{
  131|  14.9k|	struct mlist *ml;
  132|  14.9k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  133|  14.9k|	uint16_t nc, ic;
  134|       |
  135|  14.9k|	if (name_count == NULL) {
  ------------------
  |  Branch (135:6): [True: 14.9k, False: 0]
  ------------------
  136|  14.9k|		nc = 0;
  137|  14.9k|		name_count = &nc;
  138|  14.9k|	}
  139|  14.9k|	if (indir_count == NULL) {
  ------------------
  |  Branch (139:6): [True: 14.9k, False: 0]
  ------------------
  140|  14.9k|		ic = 0;
  141|  14.9k|		indir_count = &ic;
  142|  14.9k|	}
  143|       |
  144|  29.8k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (144:32): [True: 14.9k, False: 14.8k]
  ------------------
  145|  14.9k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  146|  14.9k|		    0, mode, text, 0, indir_count, name_count,
  147|  14.9k|		    &printed_something, &need_separator, &firstline,
  148|  14.9k|		    NULL, NULL);
  149|  14.9k|		switch (ret) {
  150|    145|		case -1:
  ------------------
  |  Branch (150:3): [True: 145, False: 14.8k]
  ------------------
  151|    145|			return ret;
  152|  4.61k|		case 0:
  ------------------
  |  Branch (152:3): [True: 4.61k, False: 10.3k]
  ------------------
  153|  4.61k|			continue;
  154|  10.2k|		default:
  ------------------
  |  Branch (154:3): [True: 10.2k, False: 4.76k]
  ------------------
  155|  10.2k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  10.2k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (155:8): [True: 0, False: 10.2k]
  ------------------
  156|      0|				return ret;
  157|  10.2k|			rv = ret;
  158|  10.2k|			break;
  159|  14.9k|		}
  160|  14.9k|	}
  161|       |
  162|  14.8k|	return rv;
  163|  14.9k|}
softmagic.c:match:
  222|  91.8k|{
  223|  91.8k|	uint32_t magindex = 0;
  224|  91.8k|	unsigned int cont_level = 0;
  225|  91.8k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  226|  91.8k|	int returnvalv = 0, e;
  227|  91.8k|	struct buffer bb;
  228|  91.8k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  91.8k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  91.8k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  91.8k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  91.8k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  91.8k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  91.8k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  229|       |
  230|  91.8k|	(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.8k|	if (returnval == NULL)
  ------------------
  |  Branch (235:6): [True: 30.6k, False: 61.2k]
  ------------------
  236|  30.6k|		returnval = &returnvalv;
  237|  91.8k|	if (found_match == NULL)
  ------------------
  |  Branch (237:6): [True: 30.6k, False: 61.2k]
  ------------------
  238|  30.6k|		found_match = &found_matchv;
  239|       |
  240|  91.8k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (240:6): [True: 0, False: 91.8k]
  ------------------
  241|      0|		return -1;
  242|       |
  243|   116M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (243:21): [True: 116M, False: 89.8k]
  ------------------
  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: 61.2k]
  ------------------
  249|   116M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  310|   232M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  250|   232M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (310:3): [True: 70.9M, False: 45.3M]
  |  |  ------------------
  |  |  311|   116M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  258|   161M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (311:3): [True: 30.3k, False: 45.3M]
  |  |  ------------------
  |  |  312|   116M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  263|   161M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (312:3): [True: 0, False: 45.3M]
  |  |  ------------------
  |  |  313|   116M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  264|   161M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (313:3): [True: 60.6k, False: 45.2M]
  |  |  ------------------
  |  |  314|   116M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  262|   161M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (314:3): [True: 2.27M, False: 43.0M]
  |  |  ------------------
  |  |  315|   116M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  265|   159M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (315:3): [True: 7.99M, False: 35.0M]
  |  |  ------------------
  |  |  316|   116M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  286|   151M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (316:3): [True: 0, False: 35.0M]
  |  |  ------------------
  |  |  317|   116M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  290|   151M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (317:3): [True: 0, False: 35.0M]
  |  |  ------------------
  |  |  318|   116M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  291|   151M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (318:3): [True: 0, False: 35.0M]
  |  |  ------------------
  |  |  319|   232M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  306|  35.0M|#define				FILE_OCTAL		61
  |  |  ------------------
  |  |  |  Branch (319:3): [True: 0, False: 35.0M]
  |  |  ------------------
  ------------------
  250|  81.3M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  251|  81.3M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  382|  10.6M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  250|  10.6M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  402|  10.6M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  10.6M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  401|  10.6M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  10.6M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  402|  10.6M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  395|  10.6M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (251:10): [True: 10.6M, False: 70.6M]
  |  Branch (251:18): [True: 417k, False: 10.2M]
  ------------------
  252|  80.8M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  382|  70.6M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  250|  70.6M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  402|  70.6M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  70.6M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  401|  70.6M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  395|  70.6M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  401|  70.6M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  395|  70.6M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (252:10): [True: 70.6M, False: 10.2M]
  |  Branch (252:19): [True: 3.49M, False: 67.1M]
  ------------------
  253|   112M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (253:7): [True: 14.9M, False: 97.4M]
  ------------------
  254|   116M|flush:
  255|       |			/* Skip sub-tests */
  256|   521M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (256:11): [True: 521M, False: 4.18k]
  ------------------
  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.9M|		}
  263|       |
  264|  97.4M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1) {
  ------------------
  |  Branch (264:7): [True: 74.6k, False: 97.4M]
  ------------------
  265|  74.6k|			if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  175|  74.6k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  74.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (265:8): [True: 0, False: 74.6k]
  ------------------
  266|      0|				continue;
  267|  74.6k|			else
  268|  74.6k|				goto flush;
  269|  74.6k|		}
  270|  97.4M|		ms->line = m->lineno;
  271|       |
  272|       |		/* if main entry matches, print it... */
  273|  97.4M|		switch (mget(ms, m, b, &bb, offset, cont_level,
  274|  97.4M|		    mode, text, flip, indir_count, name_count,
  275|  97.4M|		    printed_something, need_separator, firstline, returnval,
  276|  97.4M|		    found_match))
  277|  97.4M|		{
  278|     60|		case -1:
  ------------------
  |  Branch (278:3): [True: 60, False: 97.4M]
  ------------------
  279|     60|			return -1;
  280|  13.8M|		case 0:
  ------------------
  |  Branch (280:3): [True: 13.8M, False: 83.5M]
  ------------------
  281|  13.8M|			flush = m->reln != '!';
  282|  13.8M|			break;
  283|  83.5M|		default:
  ------------------
  |  Branch (283:3): [True: 83.5M, False: 13.8M]
  ------------------
  284|  83.5M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  286|  83.5M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (284:8): [True: 0, False: 83.5M]
  ------------------
  285|      0|				*found_match = 1;
  286|      0|				*returnval = 1;
  287|      0|			}
  288|       |
  289|  83.5M|			switch (magiccheck(ms, m, m_rxcomp)) {
  290|      0|			case -1:
  ------------------
  |  Branch (290:4): [True: 0, False: 83.5M]
  ------------------
  291|      0|				return -1;
  292|  83.2M|			case 0:
  ------------------
  |  Branch (292:4): [True: 83.2M, False: 389k]
  ------------------
  293|  83.2M|				flush++;
  294|  83.2M|				break;
  295|   389k|			default:
  ------------------
  |  Branch (295:4): [True: 389k, False: 83.2M]
  ------------------
  296|   389k|				flush = 0;
  297|   389k|				break;
  298|  83.5M|			}
  299|  83.5M|			break;
  300|  97.4M|		}
  301|  97.4M|		if (flush) {
  ------------------
  |  Branch (301:7): [True: 97.0M, False: 389k]
  ------------------
  302|       |			/*
  303|       |			 * main entry didn't match,
  304|       |			 * flush its continuations
  305|       |			 */
  306|  97.0M|			goto flush;
  307|  97.0M|		}
  308|       |
  309|   389k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (309:7): [True: 0, False: 389k]
  ------------------
  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|   389k|		if (*m->desc) {
  ------------------
  |  Branch (323:7): [True: 28.2k, False: 361k]
  ------------------
  324|  28.2k|			*found_match = 1;
  325|  28.2k|			if (print) {
  ------------------
  |  Branch (325:8): [True: 28.2k, False: 0]
  ------------------
  326|  28.2k|				*returnval = 1;
  327|  28.2k|				*need_separator = 1;
  328|  28.2k|				*printed_something = 1;
  329|  28.2k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (329:9): [True: 0, False: 28.2k]
  ------------------
  330|      0|					return -1;
  331|  28.2k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (331:9): [True: 0, False: 28.2k]
  ------------------
  332|      0|					return -1;
  333|  28.2k|			}
  334|  28.2k|		}
  335|       |
  336|   389k|		switch (moffset(ms, m, bb.flen, offset,
  337|   389k|		    &ms->c.li[cont_level].off)) {
  338|  22.8k|		case -1:
  ------------------
  |  Branch (338:3): [True: 22.8k, False: 366k]
  ------------------
  339|  22.8k|		case 0:
  ------------------
  |  Branch (339:3): [True: 0, False: 389k]
  ------------------
  340|  22.8k|			goto flush;
  341|   366k|		default:
  ------------------
  |  Branch (341:3): [True: 366k, False: 22.8k]
  ------------------
  342|   366k|			break;
  343|   389k|		}
  344|       |
  345|       |		/* and any continuations that match */
  346|   366k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (346:7): [True: 0, False: 366k]
  ------------------
  347|      0|			return -1;
  348|       |
  349|  6.74M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (349:10): [True: 6.66M, False: 85.6k]
  ------------------
  350|  6.66M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (350:7): [True: 6.38M, False: 278k]
  ------------------
  351|  6.38M|			m = &magic[++magindex];
  352|  6.38M|			m_rxcomp = &magic_rxcomp[magindex];
  353|  6.38M|			ms->line = m->lineno; /* for messages */
  354|       |
  355|  6.38M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (355:8): [True: 4.87M, False: 1.51M]
  ------------------
  356|  4.87M|				continue;
  357|  1.51M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (357:8): [True: 119k, False: 1.39M]
  ------------------
  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.51M|			if (msetoffset(ms, m, &bb, b, offset, cont_level)
  ------------------
  |  Branch (364:8): [True: 145, False: 1.51M]
  ------------------
  365|  1.51M|			    == -1) {
  366|    145|				if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  175|    145|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|    145|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (366:9): [True: 0, False: 145]
  ------------------
  367|      0|					continue;
  368|    145|				else
  369|    145|					goto flush;
  370|    145|			}
  371|  1.51M|			if (m->flag & OFFADD) {
  ------------------
  |  |  227|  1.51M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (371:8): [True: 102k, False: 1.40M]
  ------------------
  372|   102k|				if (cont_level == 0) {
  ------------------
  |  Branch (372:9): [True: 0, False: 102k]
  ------------------
  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|   102k|				ms->offset +=
  380|   102k|				    ms->c.li[cont_level - 1].off;
  381|   102k|			}
  382|       |
  383|  1.51M|#ifdef ENABLE_CONDITIONALS
  384|  1.51M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  363|  3.02M|#define				COND_ELSE	3
  ------------------
  |  Branch (384:8): [True: 0, False: 1.51M]
  ------------------
  385|  1.51M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  362|  1.51M|#define				COND_ELIF	2
  ------------------
  |  Branch (385:8): [True: 0, False: 1.51M]
  ------------------
  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.51M|#endif
  390|  1.51M|			switch (mget(ms, m, b, &bb, offset,
  391|  1.51M|			    cont_level, mode, text, flip, indir_count,
  392|  1.51M|			    name_count, printed_something, need_separator,
  393|  1.51M|			    firstline, returnval, found_match)) {
  394|  1.91k|			case -1:
  ------------------
  |  Branch (394:4): [True: 1.91k, False: 1.50M]
  ------------------
  395|  1.91k|				return -1;
  396|  87.0k|			case 0:
  ------------------
  |  Branch (396:4): [True: 87.0k, False: 1.42M]
  ------------------
  397|  87.0k|				if (m->reln != '!')
  ------------------
  |  Branch (397:9): [True: 84.9k, False: 2.05k]
  ------------------
  398|  84.9k|					continue;
  399|  2.05k|				flush = 1;
  400|  2.05k|				break;
  401|  1.42M|			default:
  ------------------
  |  Branch (401:4): [True: 1.42M, False: 88.9k]
  ------------------
  402|  1.42M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  286|  1.42M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (402:9): [True: 12.0k, False: 1.40M]
  ------------------
  403|  12.0k|					*found_match = 1;
  404|  12.0k|					*returnval = 1;
  405|  12.0k|				}
  406|  1.42M|				flush = 0;
  407|  1.42M|				break;
  408|  1.51M|			}
  409|       |
  410|  1.42M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (410:12): [True: 2.05k, False: 1.42M]
  ------------------
  411|      0|			case -1:
  ------------------
  |  Branch (411:4): [True: 0, False: 1.42M]
  ------------------
  412|      0|				return -1;
  413|  1.07M|			case 0:
  ------------------
  |  Branch (413:4): [True: 1.07M, False: 343k]
  ------------------
  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|   343k|			default:
  ------------------
  |  Branch (418:4): [True: 343k, False: 1.07M]
  ------------------
  419|   343k|#ifdef ENABLE_CONDITIONALS
  420|   343k|				ms->c.li[cont_level].last_match = 1;
  421|   343k|#endif
  422|   343k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  292|   343k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (422:9): [True: 3.22k, False: 340k]
  ------------------
  423|  3.22k|					ms->c.li[cont_level].got_match = 0;
  424|   340k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (424:14): [True: 81.7k, False: 258k]
  ------------------
  425|  81.7k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  248|  81.7k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (425:10): [True: 2.13k, False: 79.6k]
  ------------------
  426|  2.13k|						break;
  427|  81.7k|				} else
  428|   258k|					ms->c.li[cont_level].got_match = 1;
  429|       |
  430|   341k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (430:9): [True: 0, False: 341k]
  ------------------
  431|   341k|				    != 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|   341k|				if (*m->desc) {
  ------------------
  |  Branch (439:9): [True: 105k, False: 235k]
  ------------------
  440|   105k|					*found_match = 1;
  441|   105k|				}
  442|   341k|				if (print && *m->desc) {
  ------------------
  |  Branch (442:9): [True: 341k, False: 0]
  |  Branch (442:18): [True: 105k, False: 235k]
  ------------------
  443|   105k|					*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|   105k|					if (!*printed_something) {
  ------------------
  |  Branch (455:10): [True: 20.6k, False: 85.2k]
  ------------------
  456|  20.6k|						*printed_something = 1;
  457|  20.6k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (457:11): [True: 0, False: 20.6k]
  ------------------
  458|  20.6k|						    == -1)
  459|      0|							return -1;
  460|  20.6k|					}
  461|       |					/* space if previous printed */
  462|   105k|					if (*need_separator
  ------------------
  |  Branch (462:10): [True: 95.8k, False: 9.97k]
  ------------------
  463|  95.8k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  230|  95.8k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (463:13): [True: 39.2k, False: 56.6k]
  ------------------
  464|  39.2k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (464:11): [True: 0, False: 39.2k]
  ------------------
  465|      0|							return -1;
  466|  39.2k|					}
  467|   105k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (467:10): [True: 0, False: 105k]
  ------------------
  468|      0|						return -1;
  469|   105k|					*need_separator = 1;
  470|   105k|				}
  471|       |
  472|   341k|				switch (moffset(ms, m, bb.flen, offset,
  473|   341k|				    &ms->c.li[cont_level].off)) {
  474|  4.76k|				case -1:
  ------------------
  |  Branch (474:5): [True: 4.76k, False: 336k]
  ------------------
  475|  4.76k|				case 0:
  ------------------
  |  Branch (475:5): [True: 0, False: 341k]
  ------------------
  476|  4.76k|					cont_level--;
  477|  4.76k|					break;
  478|   336k|				default:
  ------------------
  |  Branch (478:5): [True: 336k, False: 4.76k]
  ------------------
  479|   336k|					break;
  480|   341k|				}
  481|       |
  482|       |				/*
  483|       |				 * If we see any continuations
  484|       |				 * at a higher level,
  485|       |				 * process them.
  486|       |				 */
  487|   341k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (487:9): [True: 0, False: 341k]
  ------------------
  488|      0|					return -1;
  489|   341k|				break;
  490|  1.42M|			}
  491|  1.42M|		}
  492|   364k|		if (*printed_something) {
  ------------------
  |  Branch (492:7): [True: 100k, False: 264k]
  ------------------
  493|   100k|			*firstline = 0;
  494|   100k|		}
  495|   364k|		if (*found_match) {
  ------------------
  |  Branch (495:7): [True: 250k, False: 114k]
  ------------------
  496|   250k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   250k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (496:8): [True: 0, False: 250k]
  ------------------
  497|      0|				return *returnval;
  498|       |			// So that we print a separator
  499|   250k|			*printed_something = 0;
  500|   250k|			*firstline = 0;
  501|   250k|		}
  502|   364k|		cont_level = 0;
  503|   364k|	}
  504|  89.8k|	return *returnval;
  505|  91.8k|}
softmagic.c:msetoffset:
 1569|  98.9M|{
 1570|  98.9M|	int32_t offset;
 1571|  98.9M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  234|  98.9M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1571:6): [True: 299k, False: 98.6M]
  ------------------
 1572|   299k|		offset = -m->offset;
 1573|   299k|		if (cont_level > 0) {
  ------------------
  |  Branch (1573:7): [True: 16.0k, False: 283k]
  ------------------
 1574|  16.0k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  227|  16.0k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  228|  16.0k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1574:8): [True: 9.07k, False: 7.00k]
  ------------------
 1575|  9.07k|				goto normal;
 1576|       |#if 0
 1577|       |			file_error(ms, 0, "negative offset %d at continuation"
 1578|       |			    "level %u", m->offset, cont_level);
 1579|       |			return -1;
 1580|       |#endif
 1581|  16.0k|		}
 1582|   290k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1582:7): [True: 0, False: 290k]
  ------------------
 1583|      0|			return -1;
 1584|   290k|		if (o != 0) {
  ------------------
  |  Branch (1584:7): [True: 43, False: 289k]
  ------------------
 1585|       |			// Not yet!
 1586|     43|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1587|     43|			    "u at level %u", o, cont_level);
 1588|     43|			return -1;
 1589|     43|		}
 1590|   289k|		if (b->fd == -1) {
  ------------------
  |  Branch (1590:7): [True: 59.7k, False: 230k]
  ------------------
 1591|  59.7k|			if (CAST(size_t, m->offset) > b->flen)
  ------------------
  |  |  452|  59.7k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1591:8): [True: 13.1k, False: 46.5k]
  ------------------
 1592|  13.1k|				return -1;
 1593|  46.5k|			ms->eoffset = ms->offset =
 1594|  46.5k|			    CAST(int32_t, b->flen - m->offset);
  ------------------
  |  |  452|  46.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1595|   230k|		} else {
 1596|   230k|			if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  452|   230k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1596:8): [True: 61.5k, False: 168k]
  ------------------
 1597|  61.5k|				return -1;
 1598|   168k|			buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1599|   168k|			ms->eoffset = ms->offset =
 1600|   168k|			    CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  452|   168k|#define CAST(T, b)	((T)(b))
  ------------------
 1601|   168k|		}
 1602|  98.6M|	} else {
 1603|  98.6M|		offset = m->offset;
 1604|  98.6M|		if ((m->flag & OFFPOSITIVE) || cont_level == 0) {
  ------------------
  |  |  235|  98.6M|#define OFFPOSITIVE	0x100	/* relative to the beginning of file */
  ------------------
  |  Branch (1604:7): [True: 103, False: 98.6M]
  |  Branch (1604:34): [True: 97.1M, False: 1.49M]
  ------------------
 1605|  97.2M|normal:
 1606|       |			// XXX: Pass real fd, then who frees bb?
 1607|  97.2M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1608|  97.2M|			ms->offset = offset;
 1609|  97.2M|			ms->eoffset = 0;
 1610|  97.2M|		} else {
 1611|  1.49M|			ms->offset = ms->eoffset + offset;
 1612|  1.49M|		}
 1613|  98.6M|	}
 1614|  98.9M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  98.9M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1614:6): [True: 0, False: 98.9M]
  ------------------
 1615|       |		fprintf(stderr, "bb=[%p,%" SIZE_T_FORMAT "u,%"
 1616|      0|		    SIZE_T_FORMAT "u], %d [b=%p,%"
 1617|      0|		    SIZE_T_FORMAT "u,%" SIZE_T_FORMAT "u], [o=%#x, c=%d]\n",
 1618|      0|		    bb->fbuf, bb->flen, bb->elen, ms->offset, b->fbuf,
 1619|      0|		    b->flen, b->elen, offset, cont_level);
 1620|      0|	}
 1621|  98.9M|	return 0;
 1622|  98.9M|}
softmagic.c:mget:
 1652|  98.9M|{
 1653|  98.9M|	uint32_t eoffset, offset = ms->offset;
 1654|  98.9M|	struct buffer sbb;
 1655|  98.9M|	intmax_t lhs;
 1656|  98.9M|	file_pushbuf_t *pb;
 1657|  98.9M|	int rv, oneed_separator, in_type, nfound_match;
 1658|  98.9M|	char *rbuf;
 1659|  98.9M|	union VALUETYPE *p = &ms->ms_value;
 1660|  98.9M|	struct mlist ml, *mlp;
 1661|  98.9M|	struct cont c;
 1662|  98.9M|	const unsigned char *s = CAST(const unsigned char *, bb->fbuf);
  ------------------
  |  |  452|  98.9M|#define CAST(T, b)	((T)(b))
  ------------------
 1663|  98.9M|	size_t nbytes = bb->flen;
 1664|       |
 1665|  98.9M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1665:6): [True: 59, False: 98.9M]
  ------------------
 1666|     59|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1667|     59|		    *indir_count);
 1668|     59|		return -1;
 1669|     59|	}
 1670|       |
 1671|  98.9M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1671:6): [True: 1, False: 98.9M]
  ------------------
 1672|      1|		file_error(ms, 0, "name use count (%hu) exceeded",
 1673|      1|		    *name_count);
 1674|      1|		return -1;
 1675|      1|	}
 1676|       |
 1677|       |
 1678|  98.9M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  226|  98.9M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1678:6): [True: 0, False: 98.9M]
  ------------------
 1679|  98.9M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  452|  98.9M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  452|  98.9M|#define CAST(T, b)	((T)(b))
  ------------------
 1680|      0|		return -1;
 1681|       |
 1682|  98.9M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  98.9M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1682:6): [True: 0, False: 98.9M]
  ------------------
 1683|      0|		fprintf(stderr, "mget(type=%d, flag=%#x, offset=%u, o=%"
 1684|      0|		    SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
 1685|      0|		    "u, il=%hu, nc=%hu)\n",
 1686|      0|		    m->type, m->flag, offset, o, nbytes,
 1687|      0|		    *indir_count, *name_count);
 1688|      0|		mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  453|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1689|      0|		    sizeof(union VALUETYPE));
 1690|      0|#ifndef COMPILE_ONLY
 1691|      0|		file_mdump(m);
 1692|      0|#endif
 1693|      0|	}
 1694|       |
 1695|  98.9M|	if (m->flag & INDIR) {
  ------------------
  |  |  226|  98.9M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1695:6): [True: 726k, False: 98.1M]
  ------------------
 1696|   726k|		intmax_t off = m->in_offset;
 1697|   726k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  355|   726k|#define				FILE_OPSIGNED	0x20
  ------------------
 1698|   726k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  357|   726k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1698:7): [True: 1.26k, False: 724k]
  ------------------
 1699|  1.26k|			uint8_t *hb;
 1700|  1.26k|			uint16_t hs;
 1701|  1.26k|			uint32_t hl;
 1702|  1.26k|			int op;
 1703|       |
 1704|  1.26k|			if (offset_oob(nbytes, offset + off, 0))
  ------------------
  |  Branch (1704:8): [True: 193, False: 1.07k]
  ------------------
 1705|    193|				return 0;
 1706|  1.07k|			hb = CCAST(uint8_t *, s + offset + off);
  ------------------
  |  |  454|  1.07k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1707|  1.07k|			switch (op = cvt_flip(m->in_type, flip)) {
 1708|      0|			case FILE_BYTE:
  ------------------
  |  |  246|      0|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1708:4): [True: 0, False: 1.07k]
  ------------------
 1709|      0|				if (offset_oob(nbytes, offset + off, 1))
  ------------------
  |  Branch (1709:9): [True: 0, False: 0]
  ------------------
 1710|      0|					return 0;
 1711|      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))
  |  |  ------------------
  ------------------
 1712|      0|				break;
 1713|      0|			case FILE_SHORT:
  ------------------
  |  |  247|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1713:4): [True: 0, False: 1.07k]
  ------------------
 1714|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1714:9): [True: 0, False: 0]
  ------------------
 1715|      0|					return 0;
 1716|      0|				memcpy(&hs, hb, sizeof(hs));
 1717|      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))
  |  |  ------------------
  ------------------
 1718|      0|				break;
 1719|      0|			case FILE_BESHORT:
  ------------------
  |  |  252|      0|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1719:4): [True: 0, False: 1.07k]
  ------------------
 1720|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1720:9): [True: 0, False: 0]
  ------------------
 1721|      0|					return 0;
 1722|      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))
  |  |  ------------------
  ------------------
 1723|      0|				break;
 1724|      0|			case FILE_LESHORT:
  ------------------
  |  |  255|      0|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1724:4): [True: 0, False: 1.07k]
  ------------------
 1725|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1725:9): [True: 0, False: 0]
  ------------------
 1726|      0|					return 0;
 1727|      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))
  |  |  ------------------
  ------------------
 1728|      0|				break;
 1729|      0|			case FILE_LONG:
  ------------------
  |  |  249|      0|#define				FILE_LONG		4
  ------------------
  |  Branch (1729:4): [True: 0, False: 1.07k]
  ------------------
 1730|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1730:9): [True: 0, False: 0]
  ------------------
 1731|      0|					return 0;
 1732|      0|				memcpy(&hl, hb, sizeof(hl));
 1733|      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))
  |  |  ------------------
  ------------------
 1734|      0|				break;
 1735|      0|			case FILE_BELONG:
  ------------------
  |  |  253|      0|#define				FILE_BELONG		8
  ------------------
  |  Branch (1735:4): [True: 0, False: 1.07k]
  ------------------
 1736|      0|			case FILE_BEID3:
  ------------------
  |  |  284|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1736:4): [True: 0, False: 1.07k]
  ------------------
 1737|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1737:9): [True: 0, False: 0]
  ------------------
 1738|      0|					return 0;
 1739|      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))
  |  |  ------------------
  ------------------
 1740|      0|				break;
 1741|      0|			case FILE_LEID3:
  ------------------
  |  |  285|      0|#define				FILE_LEID3		40
  ------------------
  |  Branch (1741:4): [True: 0, False: 1.07k]
  ------------------
 1742|  1.07k|			case FILE_LELONG:
  ------------------
  |  |  256|  1.07k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1742:4): [True: 1.07k, False: 0]
  ------------------
 1743|  1.07k|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1743:9): [True: 190, False: 884]
  ------------------
 1744|    190|					return 0;
 1745|    884|				off = SEXT(sgn,32,LE32(hb));
  ------------------
  |  |  108|    884|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 884]
  |  |  ------------------
  |  |  109|    884|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    884|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    884|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1746|    884|				break;
 1747|      0|			case FILE_MELONG:
  ------------------
  |  |  268|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1747:4): [True: 0, False: 1.07k]
  ------------------
 1748|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1748:9): [True: 0, False: 0]
  ------------------
 1749|      0|					return 0;
 1750|      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))
  |  |  ------------------
  ------------------
 1751|      0|				break;
 1752|      0|			case FILE_BEQUAD:
  ------------------
  |  |  271|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1752:4): [True: 0, False: 1.07k]
  ------------------
 1753|      0|				if (offset_oob(nbytes, offset + off, 8))
  ------------------
  |  Branch (1753:9): [True: 0, False: 0]
  ------------------
 1754|      0|					return 0;
 1755|      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))
  |  |  ------------------
  ------------------
 1756|      0|				break;
 1757|      0|			case FILE_LEQUAD:
  ------------------
  |  |  270|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1757:4): [True: 0, False: 1.07k]
  ------------------
 1758|      0|				if (offset_oob(nbytes, offset + off, 8))
  ------------------
  |  Branch (1758:9): [True: 0, False: 0]
  ------------------
 1759|      0|					return 0;
 1760|      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))
  |  |  ------------------
  ------------------
 1761|      0|				break;
 1762|      0|			case FILE_OCTAL:
  ------------------
  |  |  306|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1762:4): [True: 0, False: 1.07k]
  ------------------
 1763|      0|				if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1763:9): [True: 0, False: 0]
  ------------------
 1764|      0|					return 0;
 1765|      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))
  |  |  ------------------
  ------------------
 1766|      0|				break;
 1767|      0|			default:
  ------------------
  |  Branch (1767:4): [True: 0, False: 1.07k]
  ------------------
 1768|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1768:9): [True: 0, False: 0]
  ------------------
 1769|      0|					fprintf(stderr, "bad op=%d\n", op);
 1770|      0|				return 0;
 1771|  1.07k|			}
 1772|    884|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    884|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1772:8): [True: 0, False: 884]
  ------------------
 1773|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1774|    884|		}
 1775|   725k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1776|  21.6k|		case FILE_BYTE:
  ------------------
  |  |  246|  21.6k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1776:3): [True: 21.6k, False: 704k]
  ------------------
 1777|  21.6k|			if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1777:8): [True: 193, False: 21.5k]
  ------------------
 1778|    193|				return 0;
 1779|  21.5k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), 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 (1779:8): [True: 0, False: 21.5k]
  ------------------
 1780|      0|				return 0;
 1781|  21.5k|			break;
 1782|  23.6k|		case FILE_BESHORT:
  ------------------
  |  |  252|  23.6k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1782:3): [True: 23.6k, False: 702k]
  ------------------
 1783|  23.6k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1783:8): [True: 174, False: 23.4k]
  ------------------
 1784|    174|				return 0;
 1785|  23.4k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p->hs)), off))
  ------------------
  |  |  108|  23.4k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 23.4k]
  |  |  ------------------
  |  |  109|  23.4k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  23.4k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  23.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1785:8): [True: 0, False: 23.4k]
  ------------------
 1786|      0|				return 0;
 1787|  23.4k|			break;
 1788|  23.4k|		case FILE_LESHORT:
  ------------------
  |  |  255|  12.6k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1788:3): [True: 12.6k, False: 713k]
  ------------------
 1789|  12.6k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1789:8): [True: 879, False: 11.7k]
  ------------------
 1790|    879|				return 0;
 1791|  11.7k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p->hs)), off))
  ------------------
  |  |  108|  11.7k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 11.7k]
  |  |  ------------------
  |  |  109|  11.7k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  11.7k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  11.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1791:8): [True: 0, False: 11.7k]
  ------------------
 1792|      0|				return 0;
 1793|  11.7k|			break;
 1794|  11.7k|		case FILE_SHORT:
  ------------------
  |  |  247|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1794:3): [True: 0, False: 725k]
  ------------------
 1795|      0|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1795:8): [True: 0, False: 0]
  ------------------
 1796|      0|				return 0;
 1797|      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 (1797:8): [True: 0, False: 0]
  ------------------
 1798|      0|				return 0;
 1799|      0|			break;
 1800|  10.2k|		case FILE_BELONG:
  ------------------
  |  |  253|  10.2k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1800:3): [True: 10.2k, False: 715k]
  ------------------
 1801|  10.3k|		case FILE_BEID3:
  ------------------
  |  |  284|  10.3k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1801:3): [True: 129, False: 725k]
  ------------------
 1802|  10.3k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1802:8): [True: 195, False: 10.1k]
  ------------------
 1803|    195|				return 0;
 1804|  10.1k|			lhs = BE32(p->hl);
  ------------------
  |  |   95|  10.1k|#define BE32(p) ( \
  |  |   96|  10.1k|    (CAST(uint32_t, (p)[0])<<24)| \
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|  10.1k|    (CAST(uint32_t, (p)[1])<<16)| \
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  10.1k|    (CAST(uint32_t, (p)[2])<<8)| \
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  10.1k|    (CAST(uint32_t, (p)[3])))
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1805|  10.1k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  284|  10.1k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1805:8): [True: 125, False: 10.0k]
  ------------------
 1806|    125|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  452|    125|#define CAST(T, b)	((T)(b))
  ------------------
 1807|  10.1k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|  10.1k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 10.1k]
  |  |  ------------------
  |  |  109|  10.1k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  10.1k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1807:8): [True: 464, False: 9.73k]
  ------------------
 1808|    464|				return 0;
 1809|  9.73k|			break;
 1810|   653k|		case FILE_LELONG:
  ------------------
  |  |  256|   653k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1810:3): [True: 653k, False: 72.1k]
  ------------------
 1811|   653k|		case FILE_LEID3:
  ------------------
  |  |  285|   653k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1811:3): [True: 0, False: 725k]
  ------------------
 1812|   653k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1812:8): [True: 238k, False: 415k]
  ------------------
 1813|   238k|				return 0;
 1814|   415k|			lhs = LE32(p->hl);
  ------------------
  |  |   90|   415k|#define LE32(p) ( \
  |  |   91|   415k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  452|   415k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|   415k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  452|   415k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|   415k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  452|   415k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|   415k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  452|   415k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1815|   415k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  285|   415k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1815:8): [True: 0, False: 415k]
  ------------------
 1816|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1817|   415k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|   415k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 415k]
  |  |  ------------------
  |  |  109|   415k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|   415k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|   415k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1817:8): [True: 7.80k, False: 407k]
  ------------------
 1818|  7.80k|				return 0;
 1819|   407k|			break;
 1820|   407k|		case FILE_MELONG:
  ------------------
  |  |  268|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1820:3): [True: 0, False: 725k]
  ------------------
 1821|      0|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1821:8): [True: 0, False: 0]
  ------------------
 1822|      0|				return 0;
 1823|      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 (1823:8): [True: 0, False: 0]
  ------------------
 1824|      0|				return 0;
 1825|      0|			break;
 1826|  3.13k|		case FILE_LONG:
  ------------------
  |  |  249|  3.13k|#define				FILE_LONG		4
  ------------------
  |  Branch (1826:3): [True: 3.13k, False: 722k]
  ------------------
 1827|  3.13k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1827:8): [True: 308, False: 2.83k]
  ------------------
 1828|    308|				return 0;
 1829|  2.83k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  108|  2.83k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 2.83k]
  |  |  ------------------
  |  |  109|  2.83k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  2.83k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|  2.83k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1829:8): [True: 125, False: 2.70k]
  ------------------
 1830|    125|				return 0;
 1831|  2.70k|			break;
 1832|  2.70k|		case FILE_LEQUAD:
  ------------------
  |  |  270|    164|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1832:3): [True: 164, False: 725k]
  ------------------
 1833|    164|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1833:8): [True: 0, False: 164]
  ------------------
 1834|      0|				return 0;
 1835|    164|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p->hq)), off))	
  ------------------
  |  |  108|    164|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 164]
  |  |  ------------------
  |  |  109|    164|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    164|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    164|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1835:8): [True: 126, False: 38]
  ------------------
 1836|    126|				return 0;
 1837|     38|			break;
 1838|    252|		case FILE_BEQUAD:
  ------------------
  |  |  271|    252|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1838:3): [True: 252, False: 725k]
  ------------------
 1839|    252|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1839:8): [True: 0, False: 252]
  ------------------
 1840|      0|				return 0;
 1841|    252|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p->hq)), off))
  ------------------
  |  |  108|    252|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 252]
  |  |  ------------------
  |  |  109|    252|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    252|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    252|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1841:8): [True: 154, False: 98]
  ------------------
 1842|    154|				return 0;
 1843|     98|			break;
 1844|    220|		case FILE_OCTAL:
  ------------------
  |  |  306|    220|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1844:3): [True: 220, False: 725k]
  ------------------
 1845|    220|			if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1845:8): [True: 102, False: 118]
  ------------------
 1846|    102|				return 0;
 1847|    118|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1847:7): [True: 37, False: 81]
  ------------------
 1848|    118|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  108|    118|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 118]
  |  |  ------------------
  |  |  109|    118|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    118|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  452|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1849|     37|				return 0;
 1850|     81|			break;
 1851|     81|		default:
  ------------------
  |  Branch (1851:3): [True: 0, False: 725k]
  ------------------
 1852|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1852:8): [True: 0, False: 0]
  ------------------
 1853|      0|				fprintf(stderr, "bad in_type=%d\n", in_type);
 1854|      0|			return 0;
 1855|   725k|		}
 1856|       |
 1857|   476k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  228|   476k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1857:7): [True: 2.25k, False: 474k]
  ------------------
 1858|  2.25k|			if (cont_level == 0) {
  ------------------
  |  Branch (1858:8): [True: 0, False: 2.25k]
  ------------------
 1859|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1859:9): [True: 0, False: 0]
  ------------------
 1860|      0|					fprintf(stderr,
 1861|      0|					    "indirect *zero* cont_level\n");
 1862|      0|				return 0;
 1863|      0|			}
 1864|  2.25k|			offset += ms->c.li[cont_level - 1].off;
 1865|  2.25k|			if (offset == 0) {
  ------------------
  |  Branch (1865:8): [True: 84, False: 2.17k]
  ------------------
 1866|     84|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     84|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1866:9): [True: 0, False: 84]
  ------------------
 1867|      0|					fprintf(stderr,
 1868|      0|					    "indirect *zero* offset\n");
 1869|     84|				return 0;
 1870|     84|			}
 1871|  2.17k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.17k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1871:8): [True: 0, False: 2.17k]
  ------------------
 1872|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1873|  2.17k|		}
 1874|   476k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1874:7): [True: 0, False: 476k]
  ------------------
 1875|      0|			return -1;
 1876|   476k|		ms->offset = offset;
 1877|       |
 1878|   476k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   476k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1878:7): [True: 0, False: 476k]
  ------------------
 1879|      0|			mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  453|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1880|      0|			    sizeof(union VALUETYPE));
 1881|      0|#ifndef COMPILE_ONLY
 1882|      0|			file_mdump(m);
 1883|      0|#endif
 1884|      0|		}
 1885|   476k|	}
 1886|       |
 1887|       |	/* Verify we have enough data to match magic type */
 1888|  98.6M|	switch (m->type) {
 1889|  1.68M|	case FILE_BYTE:
  ------------------
  |  |  246|  1.68M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1889:2): [True: 1.68M, False: 96.9M]
  ------------------
 1890|  1.68M|		if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1890:7): [True: 160k, False: 1.52M]
  ------------------
 1891|   160k|			return 0;
 1892|  1.52M|		break;
 1893|       |
 1894|  1.87M|	case FILE_SHORT:
  ------------------
  |  |  247|  1.87M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1894:2): [True: 1.87M, False: 96.7M]
  ------------------
 1895|  5.91M|	case FILE_BESHORT:
  ------------------
  |  |  252|  5.91M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1895:2): [True: 4.04M, False: 94.6M]
  ------------------
 1896|  9.79M|	case FILE_LESHORT:
  ------------------
  |  |  255|  9.79M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1896:2): [True: 3.88M, False: 94.7M]
  ------------------
 1897|  9.79M|		if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1897:7): [True: 786k, False: 9.01M]
  ------------------
 1898|   786k|			return 0;
 1899|  9.01M|		break;
 1900|       |
 1901|  9.01M|	case FILE_LONG:
  ------------------
  |  |  249|  1.41M|#define				FILE_LONG		4
  ------------------
  |  Branch (1901:2): [True: 1.41M, False: 97.2M]
  ------------------
 1902|  13.6M|	case FILE_BELONG:
  ------------------
  |  |  253|  13.6M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1902:2): [True: 12.1M, False: 86.4M]
  ------------------
 1903|  19.9M|	case FILE_LELONG:
  ------------------
  |  |  256|  19.9M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1903:2): [True: 6.34M, False: 92.3M]
  ------------------
 1904|  19.9M|	case FILE_MELONG:
  ------------------
  |  |  268|  19.9M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1904:2): [True: 21, False: 98.6M]
  ------------------
 1905|  19.9M|	case FILE_DATE:
  ------------------
  |  |  251|  19.9M|#define				FILE_DATE		6
  ------------------
  |  Branch (1905:2): [True: 0, False: 98.6M]
  ------------------
 1906|  19.9M|	case FILE_BEDATE:
  ------------------
  |  |  254|  19.9M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1906:2): [True: 200, False: 98.6M]
  ------------------
 1907|  19.9M|	case FILE_LEDATE:
  ------------------
  |  |  257|  19.9M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1907:2): [True: 251, False: 98.6M]
  ------------------
 1908|  19.9M|	case FILE_MEDATE:
  ------------------
  |  |  266|  19.9M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1908:2): [True: 25, False: 98.6M]
  ------------------
 1909|  19.9M|	case FILE_LDATE:
  ------------------
  |  |  259|  19.9M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1909:2): [True: 0, False: 98.6M]
  ------------------
 1910|  19.9M|	case FILE_BELDATE:
  ------------------
  |  |  260|  19.9M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1910:2): [True: 294, False: 98.6M]
  ------------------
 1911|  19.9M|	case FILE_LELDATE:
  ------------------
  |  |  261|  19.9M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1911:2): [True: 0, False: 98.6M]
  ------------------
 1912|  19.9M|	case FILE_MELDATE:
  ------------------
  |  |  267|  19.9M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1912:2): [True: 0, False: 98.6M]
  ------------------
 1913|  19.9M|	case FILE_FLOAT:
  ------------------
  |  |  278|  19.9M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1913:2): [True: 0, False: 98.6M]
  ------------------
 1914|  19.9M|	case FILE_BEFLOAT:
  ------------------
  |  |  279|  19.9M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1914:2): [True: 0, False: 98.6M]
  ------------------
 1915|  19.9M|	case FILE_LEFLOAT:
  ------------------
  |  |  280|  19.9M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1915:2): [True: 2.32k, False: 98.6M]
  ------------------
 1916|  19.9M|		if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1916:7): [True: 1.81M, False: 18.1M]
  ------------------
 1917|  1.81M|			return 0;
 1918|  18.1M|		break;
 1919|       |
 1920|  18.1M|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1920:2): [True: 0, False: 98.6M]
  ------------------
 1921|    227|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|    227|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1921:2): [True: 227, False: 98.6M]
  ------------------
 1922|  1.01k|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|  1.01k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1922:2): [True: 783, False: 98.6M]
  ------------------
 1923|  1.01k|		if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1923:7): [True: 458, False: 552]
  ------------------
 1924|    458|			return 0;
 1925|    552|		break;
 1926|       |
 1927|    552|	case FILE_LEGUID:
  ------------------
  |  |  295|      0|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1927:2): [True: 0, False: 98.6M]
  ------------------
 1928|      0|	case FILE_BEGUID:
  ------------------
  |  |  296|      0|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1928:2): [True: 0, False: 98.6M]
  ------------------
 1929|   183k|	case FILE_GUID:
  ------------------
  |  |  294|   183k|#define				FILE_GUID		49
  ------------------
  |  Branch (1929:2): [True: 183k, False: 98.4M]
  ------------------
 1930|   183k|		if (offset_oob(nbytes, offset, 16))
  ------------------
  |  Branch (1930:7): [True: 19.1k, False: 164k]
  ------------------
 1931|  19.1k|			return 0;
 1932|   164k|		break;
 1933|       |
 1934|  63.5M|	case FILE_STRING:
  ------------------
  |  |  250|  63.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1934:2): [True: 63.5M, False: 35.1M]
  ------------------
 1935|  63.5M|	case FILE_PSTRING:
  ------------------
  |  |  258|  63.5M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1935:2): [True: 29.7k, False: 98.6M]
  ------------------
 1936|  64.4M|	case FILE_SEARCH:
  ------------------
  |  |  265|  64.4M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1936:2): [True: 889k, False: 97.7M]
  ------------------
 1937|  64.4M|	case FILE_OCTAL:
  ------------------
  |  |  306|  64.4M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1937:2): [True: 0, False: 98.6M]
  ------------------
 1938|  64.4M|		if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1938:7): [True: 10.8M, False: 53.6M]
  ------------------
 1939|  10.8M|			return 0;
 1940|  53.6M|		break;
 1941|       |
 1942|  53.6M|	case FILE_REGEX:
  ------------------
  |  |  262|   262k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1942:2): [True: 262k, False: 98.4M]
  ------------------
 1943|   262k|		if (nbytes < offset)
  ------------------
  |  Branch (1943:7): [True: 776, False: 262k]
  ------------------
 1944|    776|			return 0;
 1945|   262k|		break;
 1946|       |
 1947|   262k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  19.6k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1947:2): [True: 19.6k, False: 98.6M]
  ------------------
 1948|  19.6k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  382|  19.6k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  435|  19.6k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  395|  19.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1948:7): [True: 10.5k, False: 9.04k]
  ------------------
 1949|  10.5k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  452|  10.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1950|  19.6k|		if (offset == 0)
  ------------------
  |  Branch (1950:7): [True: 1.15k, False: 18.4k]
  ------------------
 1951|  1.15k|			return 0;
 1952|       |
 1953|  18.4k|		if (nbytes < offset)
  ------------------
  |  Branch (1953:7): [True: 2.83k, False: 15.6k]
  ------------------
 1954|  2.83k|			return 0;
 1955|       |
 1956|  15.6k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1956:7): [True: 0, False: 15.6k]
  ------------------
 1957|      0|			return -1;
 1958|       |
 1959|  15.6k|		(*indir_count)++;
 1960|  15.6k|		sbb = *b;
 1961|  15.6k|		sbb.fbuf = s + offset;
 1962|  15.6k|		sbb.flen = nbytes - offset;
 1963|  15.6k|		sbb.ebuf = NULL;
 1964|  15.6k|		sbb.elen = 0;
 1965|  15.6k|		rv = -1;
 1966|  18.2k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1966:34): [True: 15.6k, False: 2.65k]
  ------------------
 1967|  15.6k|		    mlp = mlp->next)
 1968|  15.6k|		{
 1969|  15.6k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1969:8): [True: 12.9k, False: 2.65k]
  ------------------
 1970|  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
  ------------------
 1971|  15.6k|			    name_count, printed_something, need_separator,
 1972|  15.6k|			    firstline, NULL, NULL)) != 0)
 1973|  12.9k|				break;
 1974|  15.6k|		}
 1975|  15.6k|		buffer_fini(&sbb);
 1976|       |
 1977|  15.6k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  15.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1977:7): [True: 0, False: 15.6k]
  ------------------
 1978|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1979|       |
 1980|  15.6k|		rbuf = file_pop_buffer(ms, pb);
 1981|  15.6k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  487|  2.87k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1981:7): [True: 2.87k, False: 12.7k]
  |  Branch (1981:23): [True: 874, False: 1.99k]
  ------------------
 1982|    874|			return -1;
 1983|       |
 1984|  14.7k|		if (rv == 1) {
  ------------------
  |  Branch (1984:7): [True: 12.0k, False: 2.65k]
  ------------------
 1985|  12.0k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  12.0k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  12.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  12.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  12.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  12.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1985:8): [True: 12.0k, False: 0]
  ------------------
 1986|  12.0k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  167|  12.0k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1986:8): [True: 0, False: 12.0k]
  ------------------
 1987|      0|			{
 1988|      0|				free(rbuf);
 1989|      0|				return -1;
 1990|      0|			}
 1991|  12.0k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1991:8): [True: 79, False: 12.0k]
  ------------------
 1992|     79|				free(rbuf);
 1993|     79|				return -1;
 1994|     79|			}
 1995|  12.0k|		}
 1996|  14.6k|		free(rbuf);
 1997|  14.6k|		return rv;
 1998|       |
 1999|  69.7k|	case FILE_USE:
  ------------------
  |  |  291|  69.7k|#define				FILE_USE		46
  ------------------
  |  Branch (1999:2): [True: 69.7k, False: 98.5M]
  ------------------
 2000|  69.7k|		if (nbytes < offset)
  ------------------
  |  Branch (2000:7): [True: 8.55k, False: 61.2k]
  ------------------
 2001|  8.55k|			return 0;
 2002|  61.2k|		rbuf = m->value.s;
 2003|  61.2k|		if (*rbuf == '^') {
  ------------------
  |  Branch (2003:7): [True: 581, False: 60.6k]
  ------------------
 2004|    581|			rbuf++;
 2005|    581|			flip = !flip;
 2006|    581|		}
 2007|  61.2k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (2007:7): [True: 0, False: 61.2k]
  ------------------
 2008|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 2009|      0|			return -1;
 2010|      0|		}
 2011|  61.2k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (2011:7): [True: 0, False: 61.2k]
  ------------------
 2012|      0|			file_error(ms, errno, "can't allocate continuation");
 2013|      0|			return -1;
 2014|      0|		}
 2015|       |
 2016|  61.2k|		oneed_separator = *need_separator;
 2017|  61.2k|		if (m->flag & NOSPACE)
  ------------------
  |  |  230|  61.2k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (2017:7): [True: 16.1k, False: 45.0k]
  ------------------
 2018|  16.1k|			*need_separator = 0;
 2019|       |
 2020|  61.2k|		nfound_match = 0;
 2021|  61.2k|		(*name_count)++;
 2022|  61.2k|		eoffset = ms->eoffset;
 2023|  61.2k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 2024|  61.2k|		    offset + o, mode, text, flip, indir_count, name_count,
 2025|  61.2k|		    printed_something, need_separator, firstline, returnval,
 2026|  61.2k|		    &nfound_match);
 2027|  61.2k|		ms->ms_value.q = nfound_match;
 2028|  61.2k|		(*name_count)--;
 2029|  61.2k|		*found_match |= nfound_match;
 2030|       |
 2031|  61.2k|		restore_cont(ms, &c);
 2032|       |
 2033|  61.2k|		if (rv != 1)
  ------------------
  |  Branch (2033:7): [True: 4.47k, False: 56.7k]
  ------------------
 2034|  4.47k|		    *need_separator = oneed_separator;
 2035|  61.2k|		ms->offset = offset;
 2036|  61.2k|		ms->eoffset = eoffset;
 2037|  61.2k|		return rv ? rv : *found_match;
  ------------------
  |  Branch (2037:10): [True: 57.6k, False: 3.52k]
  ------------------
 2038|       |
 2039|  61.2k|	case FILE_NAME:
  ------------------
  |  |  290|  61.2k|#define				FILE_NAME		45
  ------------------
  |  Branch (2039:2): [True: 61.2k, False: 98.6M]
  ------------------
 2040|  61.2k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  61.2k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  61.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  61.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  61.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  61.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  61.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (2040:7): [True: 0, False: 61.2k]
  ------------------
 2041|      0|			return 1;
 2042|  61.2k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (2042:7): [True: 0, False: 61.2k]
  ------------------
 2043|      0|			return -1;
 2044|  61.2k|		return 1;
 2045|   372k|	case FILE_DER:
  ------------------
  |  |  293|   372k|#define				FILE_DER		48
  ------------------
  |  Branch (2045:2): [True: 372k, False: 98.2M]
  ------------------
 2046|   385k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  248|   385k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2046:2): [True: 12.1k, False: 98.6M]
  ------------------
 2047|   388k|	case FILE_CLEAR:
  ------------------
  |  |  292|   388k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2047:2): [True: 3.22k, False: 98.6M]
  ------------------
 2048|  2.16M|	default:
  ------------------
  |  Branch (2048:2): [True: 1.77M, False: 96.8M]
  ------------------
 2049|  2.16M|		break;
 2050|  98.6M|	}
 2051|  84.8M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (2051:6): [True: 82, False: 84.8M]
  ------------------
 2052|     82|		return 0;
 2053|  84.8M|	return 1;
 2054|  84.8M|}
softmagic.c:mcopy:
 1378|  99.3M|{
 1379|  99.3M|	size_t size = sizeof(*p);
 1380|       |	/*
 1381|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1382|       |	 * anything, but setup pointers into the source
 1383|       |	 */
 1384|  99.3M|	if (indir == 0) {
  ------------------
  |  Branch (1384:6): [True: 98.6M, False: 726k]
  ------------------
 1385|  98.6M|		switch (type) {
 1386|   372k|		case FILE_DER:
  ------------------
  |  |  293|   372k|#define				FILE_DER		48
  ------------------
  |  Branch (1386:3): [True: 372k, False: 98.2M]
  ------------------
 1387|  1.26M|		case FILE_SEARCH:
  ------------------
  |  |  265|  1.26M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1387:3): [True: 889k, False: 97.7M]
  ------------------
 1388|  1.26M|			if (offset > nbytes)
  ------------------
  |  Branch (1388:8): [True: 59.8k, False: 1.20M]
  ------------------
 1389|  59.8k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  452|  59.8k|#define CAST(T, b)	((T)(b))
  ------------------
 1390|  1.26M|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  453|  1.26M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1391|  1.26M|			ms->search.s_len = nbytes - offset;
 1392|  1.26M|			ms->search.offset = offset;
 1393|  1.26M|			return 0;
 1394|       |
 1395|   262k|		case FILE_REGEX: {
  ------------------
  |  |  262|   262k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1395:3): [True: 262k, False: 98.4M]
  ------------------
 1396|   262k|			const char *b;
 1397|   262k|			const char *c;
 1398|   262k|			const char *last;	/* end of search region */
 1399|   262k|			const char *buf;	/* start of search region */
 1400|   262k|			const char *end;
 1401|   262k|			size_t lines, linecnt, bytecnt;
 1402|       |
 1403|   262k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1403:8): [True: 0, False: 262k]
  |  Branch (1403:21): [True: 791, False: 262k]
  ------------------
 1404|    791|				ms->search.s_len = 0;
 1405|    791|				ms->search.s = NULL;
 1406|    791|				return 0;
 1407|    791|			}
 1408|       |
 1409|   262k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  382|   262k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  409|   262k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  395|   262k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1409:8): [True: 51.1k, False: 210k]
  ------------------
 1410|  51.1k|				linecnt = m->str_range;
  ------------------
  |  |  381|  51.1k|#define str_range _u._s._count
  ------------------
 1411|  51.1k|				bytecnt = linecnt * 80;
 1412|   210k|			} else {
 1413|   210k|				linecnt = 0;
 1414|   210k|				bytecnt = m->str_range;
  ------------------
  |  |  381|   210k|#define str_range _u._s._count
  ------------------
 1415|   210k|			}
 1416|       |
 1417|   262k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1417:8): [True: 190k, False: 71.8k]
  |  Branch (1417:24): [True: 63.9k, False: 7.94k]
  ------------------
 1418|   254k|				bytecnt = nbytes - offset;
 1419|   262k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1419:8): [True: 20.4k, False: 241k]
  ------------------
 1420|  20.4k|				bytecnt = ms->regex_max;
 1421|       |
 1422|   262k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  453|   262k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1423|   262k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  453|   262k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1424|       |			/* mget() guarantees buf <= last */
 1425|   383k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1425:35): [True: 171k, False: 212k]
  |  Branch (1425:44): [True: 168k, False: 2.95k]
  ------------------
 1426|   168k|			     ((b = CAST(const char *,
  ------------------
  |  |  452|   168k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1426:10): [True: 67.4k, False: 101k]
  ------------------
 1427|   168k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1428|   101k|			     || (b = CAST(const char *,
  ------------------
  |  |  452|   101k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1428:12): [True: 53.8k, False: 47.1k]
  ------------------
 1429|   101k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1430|   262k|			     lines--, b++) {
 1431|   121k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1431:9): [True: 118k, False: 2.40k]
  |  Branch (1431:24): [True: 52.9k, False: 65.9k]
  |  Branch (1431:40): [True: 0, False: 52.9k]
  ------------------
 1432|      0|					b++;
 1433|   121k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1433:9): [True: 118k, False: 2.40k]
  |  Branch (1433:24): [True: 65.9k, False: 52.9k]
  ------------------
 1434|  65.9k|					b++;
 1435|   121k|				last = b;
 1436|   121k|			}
 1437|   262k|			if (lines)
  ------------------
  |  Branch (1437:8): [True: 50.1k, False: 212k]
  ------------------
 1438|  50.1k|				last = end;
 1439|       |
 1440|   262k|			ms->search.s = buf;
 1441|   262k|			ms->search.s_len = last - buf;
 1442|   262k|			ms->search.offset = offset;
 1443|   262k|			ms->search.rm_len = 0;
 1444|   262k|			return 0;
 1445|   262k|		}
 1446|    299|		case FILE_BESTRING16:
  ------------------
  |  |  263|    299|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1446:3): [True: 299, False: 98.6M]
  ------------------
 1447|  57.6k|		case FILE_LESTRING16: {
  ------------------
  |  |  264|  57.6k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1447:3): [True: 57.3k, False: 98.6M]
  ------------------
 1448|  57.6k|			const unsigned char *src = s + offset;
 1449|  57.6k|			const unsigned char *esrc = s + nbytes;
 1450|  57.6k|			char *dst = p->s;
 1451|  57.6k|			char *edst = &p->s[sizeof(p->s) - 1];
 1452|       |
 1453|  57.6k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  263|  57.6k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1453:8): [True: 299, False: 57.3k]
  ------------------
 1454|    299|				src++;
 1455|       |
 1456|       |			/* check that offset is within range */
 1457|  57.6k|			if (offset >= nbytes)
  ------------------
  |  Branch (1457:8): [True: 1.08k, False: 56.5k]
  ------------------
 1458|  1.08k|				break;
 1459|  3.12M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1459:20): [True: 3.08M, False: 41.0k]
  ------------------
 1460|  3.08M|				if (dst < edst)
  ------------------
  |  Branch (1460:9): [True: 3.06M, False: 15.4k]
  ------------------
 1461|  3.06M|					*dst = *src;
 1462|  15.4k|				else
 1463|  15.4k|					break;
 1464|  3.06M|				if (*dst == '\0') {
  ------------------
  |  Branch (1464:9): [True: 1.33M, False: 1.73M]
  ------------------
 1465|  1.33M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  263|  1.33M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1465:10): [True: 3.64k, False: 1.32M]
  |  Branch (1465:10): [True: 481k, False: 850k]
  ------------------
 1466|  3.64k|					    *(src - 1) != '\0' :
 1467|  1.33M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1467:11): [True: 1.32M, False: 5.25k]
  ------------------
 1468|  1.32M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1468:10): [True: 480k, False: 842k]
  ------------------
 1469|   481k|						*dst = ' ';
 1470|  1.33M|				}
 1471|  3.06M|			}
 1472|  56.5k|			*edst = '\0';
 1473|  56.5k|			*dst = '\0';
 1474|  56.5k|			return 0;
 1475|  57.6k|		}
 1476|  63.5M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  250|  63.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1476:3): [True: 63.5M, False: 35.1M]
  ------------------
 1477|  63.5M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  258|  63.5M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1477:3): [True: 29.7k, False: 98.6M]
  ------------------
 1478|  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.4k|#define str_range _u._s._count
  ------------------
  |  Branch (1478:8): [True: 56.4k, False: 63.5M]
  |  Branch (1478:29): [True: 56.4k, False: 0]
  ------------------
 1479|  56.4k|				size = m->str_range;
  ------------------
  |  |  381|  56.4k|#define str_range _u._s._count
  ------------------
 1480|  63.5M|			break;
 1481|  33.5M|		default:
  ------------------
  |  Branch (1481:3): [True: 33.5M, False: 65.1M]
  ------------------
 1482|  33.5M|			break;
 1483|  98.6M|		}
 1484|  98.6M|	}
 1485|       |
 1486|  97.8M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  297|  97.8M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1486:6): [True: 6.38k, False: 97.8M]
  ------------------
 1487|  6.38k|		(void)memset(p, '\0', sizeof(*p));
 1488|  6.38k|		p->q = offset;
 1489|  6.38k|		return 0;
 1490|  6.38k|	}
 1491|       |
 1492|  97.8M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1492:6): [True: 6.27M, False: 91.5M]
  ------------------
 1493|  6.27M|		(void)memset(p, '\0', sizeof(*p));
 1494|  6.27M|		return 0;
 1495|  6.27M|	}
 1496|  91.5M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1496:6): [True: 58.7M, False: 32.7M]
  ------------------
 1497|  58.7M|		nbytes = nbytes - offset;
 1498|  32.7M|	else
 1499|  32.7M|		nbytes = size;
 1500|       |
 1501|  91.5M|	(void)memcpy(p, s + offset, nbytes);
 1502|       |
 1503|       |	/*
 1504|       |	 * the usefulness of padding with zeroes eludes me, it
 1505|       |	 * might even cause problems
 1506|       |	 */
 1507|  91.5M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1507:6): [True: 58.8M, False: 32.7M]
  ------------------
 1508|  58.8M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  453|  58.8M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1509|  58.8M|		    sizeof(*p) - nbytes);
 1510|  91.5M|	return 0;
 1511|  97.8M|}
softmagic.c:offset_oob:
  114|  96.8M| {
  115|  96.8M|	if (o < 0)
  ------------------
  |  Branch (115:6): [True: 0, False: 96.8M]
  ------------------
  116|      0|		return 1;
  117|  96.8M|        if ((uintmax_t)o > n)
  ------------------
  |  Branch (117:13): [True: 5.54M, False: 91.2M]
  ------------------
  118|  5.54M|		return 1;
  119|  91.2M|        return i > n - (uintmax_t)o;
  120|  96.8M|}
softmagic.c:cvt_flip:
 1026|  85.6M|{
 1027|  85.6M|	if (flip == 0)
  ------------------
  |  Branch (1027:6): [True: 85.6M, False: 10.2k]
  ------------------
 1028|  85.6M|		return type;
 1029|  10.2k|	switch (type) {
 1030|     18|	case FILE_BESHORT:
  ------------------
  |  |  252|     18|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1030:2): [True: 18, False: 10.2k]
  ------------------
 1031|     18|		return FILE_LESHORT;
  ------------------
  |  |  255|     18|#define				FILE_LESHORT		10
  ------------------
 1032|  4.05k|	case FILE_BELONG:
  ------------------
  |  |  253|  4.05k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1032:2): [True: 4.05k, False: 6.21k]
  ------------------
 1033|  4.05k|		return FILE_LELONG;
  ------------------
  |  |  256|  4.05k|#define				FILE_LELONG		11
  ------------------
 1034|     50|	case FILE_BEDATE:
  ------------------
  |  |  254|     50|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1034:2): [True: 50, False: 10.2k]
  ------------------
 1035|     50|		return FILE_LEDATE;
  ------------------
  |  |  257|     50|#define				FILE_LEDATE		12
  ------------------
 1036|      0|	case FILE_BELDATE:
  ------------------
  |  |  260|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1036:2): [True: 0, False: 10.2k]
  ------------------
 1037|      0|		return FILE_LELDATE;
  ------------------
  |  |  261|      0|#define				FILE_LELDATE		16
  ------------------
 1038|     28|	case FILE_BEQUAD:
  ------------------
  |  |  271|     28|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1038:2): [True: 28, False: 10.2k]
  ------------------
 1039|     28|		return FILE_LEQUAD;
  ------------------
  |  |  270|     28|#define				FILE_LEQUAD		25
  ------------------
 1040|    518|	case FILE_BEQDATE:
  ------------------
  |  |  274|    518|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1040:2): [True: 518, False: 9.74k]
  ------------------
 1041|    518|		return FILE_LEQDATE;
  ------------------
  |  |  273|    518|#define				FILE_LEQDATE		28
  ------------------
 1042|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  277|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1042:2): [True: 0, False: 10.2k]
  ------------------
 1043|      0|		return FILE_LEQLDATE;
  ------------------
  |  |  276|      0|#define				FILE_LEQLDATE		31
  ------------------
 1044|      0|	case FILE_BEQWDATE:
  ------------------
  |  |  289|      0|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1044:2): [True: 0, False: 10.2k]
  ------------------
 1045|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  288|      0|#define				FILE_LEQWDATE		43
  ------------------
 1046|  3.73k|	case FILE_LESHORT:
  ------------------
  |  |  255|  3.73k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1046:2): [True: 3.73k, False: 6.52k]
  ------------------
 1047|  3.73k|		return FILE_BESHORT;
  ------------------
  |  |  252|  3.73k|#define				FILE_BESHORT		7
  ------------------
 1048|    177|	case FILE_LELONG:
  ------------------
  |  |  256|    177|#define				FILE_LELONG		11
  ------------------
  |  Branch (1048:2): [True: 177, False: 10.0k]
  ------------------
 1049|    177|		return FILE_BELONG;
  ------------------
  |  |  253|    177|#define				FILE_BELONG		8
  ------------------
 1050|     24|	case FILE_LEDATE:
  ------------------
  |  |  257|     24|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1050:2): [True: 24, False: 10.2k]
  ------------------
 1051|     24|		return FILE_BEDATE;
  ------------------
  |  |  254|     24|#define				FILE_BEDATE		9
  ------------------
 1052|      0|	case FILE_LELDATE:
  ------------------
  |  |  261|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1052:2): [True: 0, False: 10.2k]
  ------------------
 1053|      0|		return FILE_BELDATE;
  ------------------
  |  |  260|      0|#define				FILE_BELDATE		15
  ------------------
 1054|     32|	case FILE_LEQUAD:
  ------------------
  |  |  270|     32|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1054:2): [True: 32, False: 10.2k]
  ------------------
 1055|     32|		return FILE_BEQUAD;
  ------------------
  |  |  271|     32|#define				FILE_BEQUAD		26
  ------------------
 1056|      0|	case FILE_LEQDATE:
  ------------------
  |  |  273|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1056:2): [True: 0, False: 10.2k]
  ------------------
 1057|      0|		return FILE_BEQDATE;
  ------------------
  |  |  274|      0|#define				FILE_BEQDATE		29
  ------------------
 1058|      7|	case FILE_LEQLDATE:
  ------------------
  |  |  276|      7|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1058:2): [True: 7, False: 10.2k]
  ------------------
 1059|      7|		return FILE_BEQLDATE;
  ------------------
  |  |  277|      7|#define				FILE_BEQLDATE		32
  ------------------
 1060|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  288|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1060:2): [True: 0, False: 10.2k]
  ------------------
 1061|      0|		return FILE_BEQWDATE;
  ------------------
  |  |  289|      0|#define				FILE_BEQWDATE		44
  ------------------
 1062|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1062:2): [True: 0, False: 10.2k]
  ------------------
 1063|      0|		return FILE_LEFLOAT;
  ------------------
  |  |  280|      0|#define				FILE_LEFLOAT		35
  ------------------
 1064|      0|	case FILE_LEFLOAT:
  ------------------
  |  |  280|      0|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1064:2): [True: 0, False: 10.2k]
  ------------------
 1065|      0|		return FILE_BEFLOAT;
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
 1066|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1066:2): [True: 0, False: 10.2k]
  ------------------
 1067|      0|		return FILE_LEDOUBLE;
  ------------------
  |  |  283|      0|#define				FILE_LEDOUBLE		38
  ------------------
 1068|      0|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|      0|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1068:2): [True: 0, False: 10.2k]
  ------------------
 1069|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1070|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1070:2): [True: 0, False: 10.2k]
  ------------------
 1071|      0|		return FILE_LEMSDOSDATE;
  ------------------
  |  |  301|      0|#define				FILE_LEMSDOSDATE	56
  ------------------
 1072|      0|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|      0|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1072:2): [True: 0, False: 10.2k]
  ------------------
 1073|      0|		return FILE_BEMSDOSDATE;
  ------------------
  |  |  302|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
 1074|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1074:2): [True: 0, False: 10.2k]
  ------------------
 1075|      0|		return FILE_LEMSDOSTIME;
  ------------------
  |  |  304|      0|#define				FILE_LEMSDOSTIME	59
  ------------------
 1076|      0|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|      0|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1076:2): [True: 0, False: 10.2k]
  ------------------
 1077|      0|		return FILE_BEMSDOSTIME;
  ------------------
  |  |  305|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
 1078|  1.62k|	default:
  ------------------
  |  Branch (1078:2): [True: 1.62k, False: 8.63k]
  ------------------
 1079|  1.62k|		return type;
 1080|  10.2k|	}
 1081|  10.2k|}
softmagic.c:do_ops:
 1516|   485k|{
 1517|   485k|	intmax_t offset;
 1518|       |	// On purpose not INTMAX_MAX
 1519|   485k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1519:6): [True: 7.91k, False: 477k]
  |  Branch (1519:25): [True: 118, False: 477k]
  ------------------
 1520|   477k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1520:6): [True: 218, False: 477k]
  |  Branch (1520:25): [True: 0, False: 477k]
  ------------------
 1521|  8.25k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  8.25k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1521:7): [True: 0, False: 8.25k]
  ------------------
 1522|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1523|  8.25k|		return 1;
 1524|  8.25k|	}
 1525|       |	   
 1526|   477k|	if (off) {
  ------------------
  |  Branch (1526:6): [True: 80.1k, False: 397k]
  ------------------
 1527|  80.1k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  352|  80.1k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1527:11): [True: 80.1k, False: 0]
  ------------------
 1528|     34|		case FILE_OPAND:
  ------------------
  |  |  344|     34|#define				FILE_OPAND	0
  ------------------
  |  Branch (1528:3): [True: 34, False: 80.0k]
  ------------------
 1529|     34|			offset = lhs & off;
 1530|     34|			break;
 1531|      0|		case FILE_OPOR:
  ------------------
  |  |  345|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1531:3): [True: 0, False: 80.1k]
  ------------------
 1532|      0|			offset = lhs | off;
 1533|      0|			break;
 1534|      0|		case FILE_OPXOR:
  ------------------
  |  |  346|      0|#define				FILE_OPXOR	2
  ------------------
  |  Branch (1534:3): [True: 0, False: 80.1k]
  ------------------
 1535|      0|			offset = lhs ^ off;
 1536|      0|			break;
 1537|  67.9k|		case FILE_OPADD:
  ------------------
  |  |  347|  67.9k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1537:3): [True: 67.9k, False: 12.1k]
  ------------------
 1538|  67.9k|			offset = lhs + off;
 1539|  67.9k|			break;
 1540|  1.24k|		case FILE_OPMINUS:
  ------------------
  |  |  348|  1.24k|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1540:3): [True: 1.24k, False: 78.8k]
  ------------------
 1541|  1.24k|			offset = lhs - off;
 1542|  1.24k|			break;
 1543|  10.7k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  349|  10.7k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1543:3): [True: 10.7k, False: 69.3k]
  ------------------
 1544|  10.7k|			offset = lhs * off;
 1545|  10.7k|			break;
 1546|     69|		case FILE_OPDIVIDE:
  ------------------
  |  |  350|     69|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1546:3): [True: 69, False: 80.0k]
  ------------------
 1547|     69|			offset = lhs / off;
 1548|     69|			break;
 1549|      0|		case FILE_OPMODULO:
  ------------------
  |  |  351|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1549:3): [True: 0, False: 80.1k]
  ------------------
 1550|      0|			offset = lhs % off;
 1551|      0|			break;
 1552|  80.1k|		}
 1553|  80.1k|	} else
 1554|   397k|		offset = lhs;
 1555|   477k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  356|   477k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1555:6): [True: 0, False: 477k]
  ------------------
 1556|      0|		offset = ~offset;
 1557|   477k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1557:6): [True: 459, False: 476k]
  ------------------
 1558|    459|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    459|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1558:7): [True: 0, False: 459]
  ------------------
 1559|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1560|    459|		return 1;
 1561|    459|	}
 1562|   476k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  452|   476k|#define CAST(T, b)	((T)(b))
  ------------------
 1563|   476k|	return 0;
 1564|   477k|}
softmagic.c:cvt_id3:
 1014|    125|{
 1015|    125|	v = ((((v >>  0) & 0x7f) <<  0) |
 1016|    125|	     (((v >>  8) & 0x7f) <<  7) |
 1017|    125|	     (((v >> 16) & 0x7f) << 14) |
 1018|    125|	     (((v >> 24) & 0x7f) << 21));
 1019|    125|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    125|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1019:6): [True: 0, False: 125]
  ------------------
 1020|      0|		fprintf(stderr, "id3 offs=%u\n", v);
 1021|    125|	return v;
 1022|    125|}
softmagic.c:file_fmtcheck:
  172|   132k|{
  173|   132k|	const char *ptr;
  174|       |
  175|   132k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (175:6): [True: 93.1k, False: 39.0k]
  ------------------
  176|  93.1k|		return desc;
  177|       |
  178|  39.0k|	ptr = fmtcheck(desc, def);
  179|  39.0k|	if (ptr == def)
  ------------------
  |  Branch (179:6): [True: 0, False: 39.0k]
  ------------------
  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|  39.0k|	return ptr;
  184|   132k|}
softmagic.c:save_cont:
 1626|  61.2k|{
 1627|  61.2k|	size_t len;
 1628|  61.2k|	*c = ms->c;
 1629|  61.2k|	len = c->len * sizeof(*c->li);
 1630|  61.2k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  452|  61.2k|#define CAST(T, b)	((T)(b))
  ------------------
 1631|  61.2k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1631:6): [True: 0, False: 61.2k]
  ------------------
 1632|      0|		ms->c = *c;
 1633|      0|		return -1;
 1634|      0|	}
 1635|  61.2k|	memcpy(ms->c.li, c->li, len);
 1636|  61.2k|	return 0;
 1637|  61.2k|}
softmagic.c:restore_cont:
 1641|  61.2k|{
 1642|  61.2k|	free(ms->c.li);
 1643|  61.2k|	ms->c = *c;
 1644|  61.2k|}
softmagic.c:mconvert:
 1203|  84.8M|{
 1204|  84.8M|	union VALUETYPE *p = &ms->ms_value;
 1205|       |
 1206|  84.8M|	switch (cvt_flip(m->type, flip)) {
 1207|  1.52M|	case FILE_BYTE:
  ------------------
  |  |  246|  1.52M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1207:2): [True: 1.52M, False: 83.3M]
  ------------------
 1208|  1.52M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1208:7): [True: 0, False: 1.52M]
  ------------------
 1209|      0|			goto out;
 1210|  1.52M|		return 1;
 1211|  1.57M|	case FILE_SHORT:
  ------------------
  |  |  247|  1.57M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1211:2): [True: 1.57M, False: 83.3M]
  ------------------
 1212|  1.57M|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|  1.57M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1212:2): [True: 0, False: 84.8M]
  ------------------
 1213|  1.57M|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|  1.57M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1213:2): [True: 0, False: 84.8M]
  ------------------
 1214|  1.57M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1214:7): [True: 0, False: 1.57M]
  ------------------
 1215|      0|			goto out;
 1216|  1.57M|		return 1;
 1217|  1.32M|	case FILE_LONG:
  ------------------
  |  |  249|  1.32M|#define				FILE_LONG		4
  ------------------
  |  Branch (1217:2): [True: 1.32M, False: 83.5M]
  ------------------
 1218|  1.32M|	case FILE_DATE:
  ------------------
  |  |  251|  1.32M|#define				FILE_DATE		6
  ------------------
  |  Branch (1218:2): [True: 0, False: 84.8M]
  ------------------
 1219|  1.32M|	case FILE_LDATE:
  ------------------
  |  |  259|  1.32M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1219:2): [True: 0, False: 84.8M]
  ------------------
 1220|  1.32M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1220:7): [True: 0, False: 1.32M]
  ------------------
 1221|      0|			goto out;
 1222|  1.32M|		return 1;
 1223|  59.6k|	case FILE_QUAD:
  ------------------
  |  |  269|  59.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1223:2): [True: 59.6k, False: 84.8M]
  ------------------
 1224|  59.6k|	case FILE_QDATE:
  ------------------
  |  |  272|  59.6k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1224:2): [True: 0, False: 84.8M]
  ------------------
 1225|  59.6k|	case FILE_QLDATE:
  ------------------
  |  |  275|  59.6k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1225:2): [True: 0, False: 84.8M]
  ------------------
 1226|  59.8k|	case FILE_QWDATE:
  ------------------
  |  |  287|  59.8k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1226:2): [True: 160, False: 84.8M]
  ------------------
 1227|  66.2k|	case FILE_OFFSET:
  ------------------
  |  |  297|  66.2k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1227:2): [True: 6.38k, False: 84.8M]
  ------------------
 1228|  66.2k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1228:7): [True: 0, False: 66.2k]
  ------------------
 1229|      0|			goto out;
 1230|  66.2k|		return 1;
 1231|  53.0M|	case FILE_STRING:
  ------------------
  |  |  250|  53.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (1231:2): [True: 53.0M, False: 31.8M]
  ------------------
 1232|  53.0M|	case FILE_BESTRING16:
  ------------------
  |  |  263|  53.0M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1232:2): [True: 299, False: 84.8M]
  ------------------
 1233|  53.1M|	case FILE_LESTRING16:
  ------------------
  |  |  264|  53.1M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1233:2): [True: 57.3k, False: 84.8M]
  ------------------
 1234|  53.1M|	case FILE_OCTAL: {
  ------------------
  |  |  306|  53.1M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1234:2): [True: 0, False: 84.8M]
  ------------------
 1235|       |		/* Null terminate and eat *trailing* return */
 1236|  53.1M|		p->s[sizeof(p->s) - 1] = '\0';
 1237|  53.1M|		return 1;
 1238|  53.1M|	}
 1239|  22.6k|	case FILE_PSTRING: {
  ------------------
  |  |  258|  22.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1239:2): [True: 22.6k, False: 84.8M]
  ------------------
 1240|  22.6k|		char *ptr1, *ptr2;
 1241|  22.6k|		size_t len, sz = file_pstring_length_size(ms, m);
 1242|  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 (1242:7): [True: 0, False: 22.6k]
  ------------------
 1243|      0|			return 0;
 1244|  22.6k|		ptr1 = p->s;
 1245|  22.6k|		ptr2 = ptr1 + sz;
 1246|  22.6k|		len = file_pstring_get_length(ms, m, ptr1);
 1247|  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 (1247:7): [True: 82, False: 22.6k]
  ------------------
 1248|     82|			return 0;
 1249|  22.6k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1250|  22.6k|		if (len >= sz) {
  ------------------
  |  Branch (1250:7): [True: 13.9k, False: 8.64k]
  ------------------
 1251|       |			/*
 1252|       |			 * The size of the pascal string length (sz)
 1253|       |			 * is 1, 2, or 4. We need at least 1 byte for NUL
 1254|       |			 * termination, but we've already truncated the
 1255|       |			 * string by p->s, so we need to deduct sz.
 1256|       |			 * Because we can use one of the bytes of the length
 1257|       |			 * after we shifted as NUL termination.
 1258|       |			 */
 1259|  13.9k|			len = sz;
 1260|  13.9k|		}
 1261|  2.13M|		while (len--)
  ------------------
  |  Branch (1261:10): [True: 2.11M, False: 22.6k]
  ------------------
 1262|  2.11M|			*ptr1++ = *ptr2++;
 1263|  22.6k|		*ptr1 = '\0';
 1264|  22.6k|		return 1;
 1265|  22.6k|	}
 1266|  3.78M|	case FILE_BESHORT:
  ------------------
  |  |  252|  3.78M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1266:2): [True: 3.78M, False: 81.0M]
  ------------------
 1267|  3.78M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|  3.78M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1267:2): [True: 0, False: 84.8M]
  ------------------
 1268|  3.78M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|  3.78M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1268:2): [True: 0, False: 84.8M]
  ------------------
 1269|  3.78M|		p->h = CAST(short, BE16(p->hs));
  ------------------
  |  |  452|  3.78M|#define CAST(T, b)	((T)(b))
  ------------------
 1270|  3.78M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1270:7): [True: 0, False: 3.78M]
  ------------------
 1271|      0|			goto out;
 1272|  3.78M|		return 1;
 1273|  11.2M|	case FILE_BELONG:
  ------------------
  |  |  253|  11.2M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1273:2): [True: 11.2M, False: 73.6M]
  ------------------
 1274|  11.2M|	case FILE_BEDATE:
  ------------------
  |  |  254|  11.2M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1274:2): [True: 158, False: 84.8M]
  ------------------
 1275|  11.2M|	case FILE_BELDATE:
  ------------------
  |  |  260|  11.2M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1275:2): [True: 263, False: 84.8M]
  ------------------
 1276|  11.2M|		p->l = CAST(int32_t, BE32(p->hl));
  ------------------
  |  |  452|  11.2M|#define CAST(T, b)	((T)(b))
  ------------------
 1277|  11.2M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1277:7): [True: 0, False: 11.2M]
  ------------------
 1278|      0|			goto out;
 1279|  11.2M|		return 1;
 1280|   915k|	case FILE_BEQUAD:
  ------------------
  |  |  271|   915k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1280:2): [True: 915k, False: 83.9M]
  ------------------
 1281|   915k|	case FILE_BEQDATE:
  ------------------
  |  |  274|   915k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1281:2): [True: 38, False: 84.8M]
  ------------------
 1282|   915k|	case FILE_BEQLDATE:
  ------------------
  |  |  277|   915k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1282:2): [True: 7, False: 84.8M]
  ------------------
 1283|   915k|	case FILE_BEQWDATE:
  ------------------
  |  |  289|   915k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1283:2): [True: 0, False: 84.8M]
  ------------------
 1284|   915k|		p->q = CAST(uint64_t, BE64(p->hq));
  ------------------
  |  |  452|   915k|#define CAST(T, b)	((T)(b))
  ------------------
 1285|   915k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1285:7): [True: 0, False: 915k]
  ------------------
 1286|      0|			goto out;
 1287|   915k|		return 1;
 1288|  3.65M|	case FILE_LESHORT:
  ------------------
  |  |  255|  3.65M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1288:2): [True: 3.65M, False: 81.2M]
  ------------------
 1289|  3.65M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|  3.65M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1289:2): [True: 236, False: 84.8M]
  ------------------
 1290|  3.65M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|  3.65M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1290:2): [True: 236, False: 84.8M]
  ------------------
 1291|  3.65M|		p->h = CAST(short, LE16(p->hs));
  ------------------
  |  |  452|  3.65M|#define CAST(T, b)	((T)(b))
  ------------------
 1292|  3.65M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1292:7): [True: 0, False: 3.65M]
  ------------------
 1293|      0|			goto out;
 1294|  3.65M|		return 1;
 1295|  5.60M|	case FILE_LELONG:
  ------------------
  |  |  256|  5.60M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1295:2): [True: 5.60M, False: 79.2M]
  ------------------
 1296|  5.60M|	case FILE_LEDATE:
  ------------------
  |  |  257|  5.60M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1296:2): [True: 272, False: 84.8M]
  ------------------
 1297|  5.60M|	case FILE_LELDATE:
  ------------------
  |  |  261|  5.60M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1297:2): [True: 0, False: 84.8M]
  ------------------
 1298|  5.60M|		p->l = CAST(int32_t, LE32(p->hl));
  ------------------
  |  |  452|  5.60M|#define CAST(T, b)	((T)(b))
  ------------------
 1299|  5.60M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1299:7): [True: 0, False: 5.60M]
  ------------------
 1300|      0|			goto out;
 1301|  5.60M|		return 1;
 1302|   734k|	case FILE_LEQUAD:
  ------------------
  |  |  270|   734k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1302:2): [True: 734k, False: 84.1M]
  ------------------
 1303|   735k|	case FILE_LEQDATE:
  ------------------
  |  |  273|   735k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1303:2): [True: 518, False: 84.8M]
  ------------------
 1304|   735k|	case FILE_LEQLDATE:
  ------------------
  |  |  276|   735k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1304:2): [True: 6, False: 84.8M]
  ------------------
 1305|   736k|	case FILE_LEQWDATE:
  ------------------
  |  |  288|   736k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1305:2): [True: 1.02k, False: 84.8M]
  ------------------
 1306|   736k|		p->q = CAST(uint64_t, LE64(p->hq));
  ------------------
  |  |  452|   736k|#define CAST(T, b)	((T)(b))
  ------------------
 1307|   736k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1307:7): [True: 0, False: 736k]
  ------------------
 1308|      0|			goto out;
 1309|   736k|		return 1;
 1310|     21|	case FILE_MELONG:
  ------------------
  |  |  268|     21|#define				FILE_MELONG		23
  ------------------
  |  Branch (1310:2): [True: 21, False: 84.8M]
  ------------------
 1311|     46|	case FILE_MEDATE:
  ------------------
  |  |  266|     46|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1311:2): [True: 25, False: 84.8M]
  ------------------
 1312|     46|	case FILE_MELDATE:
  ------------------
  |  |  267|     46|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1312:2): [True: 0, False: 84.8M]
  ------------------
 1313|     46|		p->l = CAST(int32_t, ME32(p->hl));
  ------------------
  |  |  452|     46|#define CAST(T, b)	((T)(b))
  ------------------
 1314|     46|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1314:7): [True: 0, False: 46]
  ------------------
 1315|      0|			goto out;
 1316|     46|		return 1;
 1317|      0|	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1317:2): [True: 0, False: 84.8M]
  ------------------
 1318|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1318:7): [True: 0, False: 0]
  ------------------
 1319|      0|			goto out;
 1320|      0|		return 1;
 1321|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1321:2): [True: 0, False: 84.8M]
  ------------------
 1322|      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))
  |  |  ------------------
  ------------------
 1323|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1323:7): [True: 0, False: 0]
  ------------------
 1324|      0|			goto out;
 1325|      0|		return 1;
 1326|  2.32k|	case FILE_LEFLOAT:
  ------------------
  |  |  280|  2.32k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1326:2): [True: 2.32k, False: 84.8M]
  ------------------
 1327|  2.32k|		p->l = LE32(p->hl);
  ------------------
  |  |   90|  2.32k|#define LE32(p) ( \
  |  |   91|  2.32k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  452|  2.32k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|  2.32k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  452|  2.32k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  2.32k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  452|  2.32k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  2.32k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  452|  2.32k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1328|  2.32k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1328:7): [True: 0, False: 2.32k]
  ------------------
 1329|      0|			goto out;
 1330|  2.32k|		return 1;
 1331|      0|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1331:2): [True: 0, False: 84.8M]
  ------------------
 1332|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1332:7): [True: 0, False: 0]
  ------------------
 1333|      0|			goto out;
 1334|      0|		return 1;
 1335|    168|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|    168|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1335:2): [True: 168, False: 84.8M]
  ------------------
 1336|    168|		p->q = BE64(p->hq);
  ------------------
  |  |   72|    168|#define BE64(p) ( \
  |  |   73|    168|    (CAST(uint64_t, (p)[0])<<56)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   74|    168|    (CAST(uint64_t, (p)[1])<<48)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    168|    (CAST(uint64_t, (p)[2])<<40)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    168|    (CAST(uint64_t, (p)[3])<<32)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    168|    (CAST(uint64_t, (p)[4])<<24)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    168|    (CAST(uint64_t, (p)[5])<<16)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    168|    (CAST(uint64_t, (p)[6])<<8)| \
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   80|    168|    (CAST(uint64_t, (p)[7])))
  |  |  ------------------
  |  |  |  |  452|    168|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1337|    168|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1337:7): [True: 0, False: 168]
  ------------------
 1338|      0|			goto out;
 1339|    168|		return 1;
 1340|    384|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    384|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1340:2): [True: 384, False: 84.8M]
  ------------------
 1341|    384|		p->q = LE64(p->hq);
  ------------------
  |  |   81|    384|#define LE64(p) ( \
  |  |   82|    384|    (CAST(uint64_t, (p)[7])<<56)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   83|    384|    (CAST(uint64_t, (p)[6])<<48)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    384|    (CAST(uint64_t, (p)[5])<<40)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    384|    (CAST(uint64_t, (p)[4])<<32)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    384|    (CAST(uint64_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    384|    (CAST(uint64_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    384|    (CAST(uint64_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    384|    (CAST(uint64_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  452|    384|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1342|    384|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1342:7): [True: 0, False: 384]
  ------------------
 1343|      0|			goto out;
 1344|    384|		return 1;
 1345|   262k|	case FILE_REGEX:
  ------------------
  |  |  262|   262k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1345:2): [True: 262k, False: 84.6M]
  ------------------
 1346|   777k|	case FILE_SEARCH:
  ------------------
  |  |  265|   777k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1346:2): [True: 515k, False: 84.3M]
  ------------------
 1347|   789k|	case FILE_DEFAULT:
  ------------------
  |  |  248|   789k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1347:2): [True: 12.1k, False: 84.8M]
  ------------------
 1348|   792k|	case FILE_CLEAR:
  ------------------
  |  |  292|   792k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1348:2): [True: 3.22k, False: 84.8M]
  ------------------
 1349|   792k|	case FILE_NAME:
  ------------------
  |  |  290|   792k|#define				FILE_NAME		45
  ------------------
  |  Branch (1349:2): [True: 0, False: 84.8M]
  ------------------
 1350|   792k|	case FILE_USE:
  ------------------
  |  |  291|   792k|#define				FILE_USE		46
  ------------------
  |  Branch (1350:2): [True: 0, False: 84.8M]
  ------------------
 1351|  1.16M|	case FILE_DER:
  ------------------
  |  |  293|  1.16M|#define				FILE_DER		48
  ------------------
  |  Branch (1351:2): [True: 372k, False: 84.5M]
  ------------------
 1352|  1.33M|	case FILE_GUID:
  ------------------
  |  |  294|  1.33M|#define				FILE_GUID		49
  ------------------
  |  Branch (1352:2): [True: 164k, False: 84.7M]
  ------------------
 1353|  1.33M|	case FILE_LEGUID:
  ------------------
  |  |  295|  1.33M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1353:2): [True: 0, False: 84.8M]
  ------------------
 1354|  1.33M|	case FILE_BEGUID:
  ------------------
  |  |  296|  1.33M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1354:2): [True: 0, False: 84.8M]
  ------------------
 1355|  1.33M|		return 1;
 1356|      0|	default:
  ------------------
  |  Branch (1356:2): [True: 0, False: 84.8M]
  ------------------
 1357|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1358|      0|		return 0;
 1359|  84.8M|	}
 1360|      0|out:
 1361|      0|	file_magerror(ms, "zerodivide/overflow/underflow in mconvert()");
 1362|      0|	return 0;
 1363|  84.8M|}
softmagic.c:cvt_8:
 1137|  1.52M|{
 1138|  1.52M|	DO_CVT(m, b, 8);
  ------------------
  |  | 1129|  1.52M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  1.52M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1129:6): [True: 629k, False: 897k]
  |  |  ------------------
  |  | 1130|   629k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1092|   629k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|   629k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 81.7k, False: 547k]
  |  |  |  |  ------------------
  |  |  |  | 1093|   629k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  81.7k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 81.7k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|  68.7k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  68.7k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 68.7k, False: 12.9k]
  |  |  |  |  ------------------
  |  |  |  | 1095|  68.7k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  68.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|  68.7k|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 81.7k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 81.7k]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 0, False: 81.7k]
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|      0|			break; \
  |  |  |  | 1106|  11.7k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  11.7k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 11.7k, False: 69.9k]
  |  |  |  |  ------------------
  |  |  |  | 1107|  11.7k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  11.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|  11.7k|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 81.7k]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|    577|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    577|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 577, False: 81.1k]
  |  |  |  |  ------------------
  |  |  |  | 1113|    577|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|    577|	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|    577|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [Folded, False: 577]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|    577|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    577|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    577|		return -1; \
  |  |  |  |  |  | 1088|    577|	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|    577|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 577]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    577|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    577|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|    577|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|    577|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    577|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 577]
  |  |  |  |  ------------------
  |  |  |  | 1115|    577|				return -1; \
  |  |  |  | 1116|    577|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    577|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|    577|			break; \
  |  |  |  | 1118|    577|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    575|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 575, False: 81.1k]
  |  |  |  |  ------------------
  |  |  |  | 1119|    575|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|    575|	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|    575|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [Folded, False: 575]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|    575|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    575|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    575|		return -1; \
  |  |  |  |  |  | 1088|    575|	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|    575|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 575]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    575|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    575|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|    575|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|    575|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    575|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 575]
  |  |  |  |  ------------------
  |  |  |  | 1121|    575|				return -1; \
  |  |  |  | 1122|    575|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    575|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|    575|			break; \
  |  |  |  | 1124|  81.7k|		} \
  |  |  |  | 1125|   629k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|   629k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 629k]
  |  |  |  |  ------------------
  |  |  |  | 1126|   629k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1131|   897k|	} else { \
  |  | 1132|   897k|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1092|   897k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|   897k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 41.3k, False: 856k]
  |  |  |  |  ------------------
  |  |  |  | 1093|   897k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  41.3k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 41.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|  35.0k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  35.0k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 35.0k, False: 6.32k]
  |  |  |  |  ------------------
  |  |  |  | 1095|  35.0k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  35.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|  35.0k|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 41.3k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 41.3k]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 0, False: 41.3k]
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|      0|			break; \
  |  |  |  | 1106|  6.25k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  6.25k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 6.25k, False: 35.1k]
  |  |  |  |  ------------------
  |  |  |  | 1107|  6.25k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  6.25k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|  6.25k|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 41.3k]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|     70|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|     70|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 70, False: 41.3k]
  |  |  |  |  ------------------
  |  |  |  | 1113|     70|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|     70|	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|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [Folded, False: 70]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|     70|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|     70|		return -1; \
  |  |  |  |  |  | 1088|     70|	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|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 70]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|     70|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|     70|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|     70|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 70]
  |  |  |  |  ------------------
  |  |  |  | 1115|     70|				return -1; \
  |  |  |  | 1116|     70|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|     70|			break; \
  |  |  |  | 1118|     70|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|      0|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 0, False: 41.3k]
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|      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 (1085:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|      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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|		return -1; \
  |  |  |  |  |  | 1088|      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 (1088:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|      0|				return -1; \
  |  |  |  | 1122|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|			break; \
  |  |  |  | 1124|  41.3k|		} \
  |  |  |  | 1125|   897k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|   897k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 897k]
  |  |  |  |  ------------------
  |  |  |  | 1126|   897k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|   897k|	}
  ------------------
 1139|  1.52M|	return 0;
 1140|  1.52M|}
softmagic.c:cvt_16:
 1144|  9.01M|{
 1145|  9.01M|	DO_CVT(m, h, 16);
  ------------------
  |  | 1129|  9.01M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  9.01M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1129:6): [True: 1.15M, False: 7.86M]
  |  |  ------------------
  |  | 1130|  1.15M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1092|  1.15M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  1.15M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 115k, False: 1.03M]
  |  |  |  |  ------------------
  |  |  |  | 1093|  1.15M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   115k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 115k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|   114k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   114k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 114k, False: 750]
  |  |  |  |  ------------------
  |  |  |  | 1095|   114k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   114k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|   114k|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|     46|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     46|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 46, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1104|     46|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     46|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|     46|			break; \
  |  |  |  | 1106|    299|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    299|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 299, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1107|    299|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    299|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|    299|			break; \
  |  |  |  | 1109|     69|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|     69|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 69, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1110|     69|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     69|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|     69|			break; \
  |  |  |  | 1112|    270|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    270|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 270, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1113|    270|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|    270|	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|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [Folded, False: 270]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|    270|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    270|		return -1; \
  |  |  |  |  |  | 1088|    270|	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|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 270]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    270|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|    270|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|    270|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 270]
  |  |  |  |  ------------------
  |  |  |  | 1115|    270|				return -1; \
  |  |  |  | 1116|    270|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|    270|			break; \
  |  |  |  | 1118|    270|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|     66|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 66, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1119|     66|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|     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 (1085:6): [Folded, False: 66]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|     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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|     66|		return -1; \
  |  |  |  |  |  | 1088|     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 (1088:6): [Folded, False: 66]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|     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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|     66|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|     66|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  |  | 1121|     66|				return -1; \
  |  |  |  | 1122|     66|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|     66|			break; \
  |  |  |  | 1124|   115k|		} \
  |  |  |  | 1125|  1.15M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  1.15M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 1.15M]
  |  |  |  |  ------------------
  |  |  |  | 1126|  1.15M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1131|  7.86M|	} else { \
  |  | 1132|  7.86M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1092|  7.86M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.86M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 431k, False: 7.43M]
  |  |  |  |  ------------------
  |  |  |  | 1093|  7.86M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   431k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 431k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|   406k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   406k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 406k, False: 25.3k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   406k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   406k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|   406k|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 431k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 431k]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|     85|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     85|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 85, False: 431k]
  |  |  |  |  ------------------
  |  |  |  | 1104|     85|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     85|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|     85|			break; \
  |  |  |  | 1106|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 0, False: 431k]
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|      0|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 431k]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 0, False: 431k]
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|      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 (1085:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|      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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|		return -1; \
  |  |  |  |  |  | 1088|      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 (1088:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|				return -1; \
  |  |  |  | 1116|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|			break; \
  |  |  |  | 1118|  25.2k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|  25.2k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 25.2k, False: 406k]
  |  |  |  |  ------------------
  |  |  |  | 1119|  25.2k|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|  25.2k|	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.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [Folded, False: 25.2k]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|  25.2k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  25.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  25.2k|		return -1; \
  |  |  |  |  |  | 1088|  25.2k|	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.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 25.2k]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|  25.2k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  25.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|  25.2k|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|  25.2k|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  25.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 25.2k]
  |  |  |  |  ------------------
  |  |  |  | 1121|  25.2k|				return -1; \
  |  |  |  | 1122|  25.2k|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  25.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|  25.2k|			break; \
  |  |  |  | 1124|   431k|		} \
  |  |  |  | 1125|  7.86M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  7.86M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 7.86M]
  |  |  |  |  ------------------
  |  |  |  | 1126|  7.86M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  7.86M|	}
  ------------------
 1146|  9.01M|	return 0;
 1147|  9.01M|}
softmagic.c:cvt_32:
 1151|  18.1M|{
 1152|  18.1M|	DO_CVT(m, l, 32);
  ------------------
  |  | 1129|  18.1M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  18.1M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1129:6): [True: 2.67M, False: 15.4M]
  |  |  ------------------
  |  | 1130|  2.67M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1092|  2.67M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  2.67M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 411k, False: 2.26M]
  |  |  |  |  ------------------
  |  |  |  | 1093|  2.67M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   411k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 411k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|   410k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   410k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 410k, False: 971]
  |  |  |  |  ------------------
  |  |  |  | 1095|   410k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   410k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|   410k|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|     94|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|     94|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 94, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1101|     94|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     94|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|     94|			break; \
  |  |  |  | 1103|    143|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|    143|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 143, False: 410k]
  |  |  |  |  ------------------
  |  |  |  | 1104|    143|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    143|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|    143|			break; \
  |  |  |  | 1106|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 0, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|      0|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 411k]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|    461|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|    461|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 461, False: 410k]
  |  |  |  |  ------------------
  |  |  |  | 1113|    461|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|    461|	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|    461|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|    461|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    461|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    461|		return -1; \
  |  |  |  |  |  | 1088|    461|	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|    461|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 461]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    461|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    461|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|    461|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|    461|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    461|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 461]
  |  |  |  |  ------------------
  |  |  |  | 1115|    461|				return -1; \
  |  |  |  | 1116|    461|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    461|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|    461|			break; \
  |  |  |  | 1118|    461|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    273|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 273, False: 410k]
  |  |  |  |  ------------------
  |  |  |  | 1119|    273|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|    273|	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|    273|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|    273|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    273|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    273|		return -1; \
  |  |  |  |  |  | 1088|    273|	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|    273|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 273]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    273|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    273|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|    273|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|    273|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    273|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 273]
  |  |  |  |  ------------------
  |  |  |  | 1121|    273|				return -1; \
  |  |  |  | 1122|    273|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    273|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|    273|			break; \
  |  |  |  | 1124|   411k|		} \
  |  |  |  | 1125|  2.67M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  2.67M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 2.67M]
  |  |  |  |  ------------------
  |  |  |  | 1126|  2.67M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1131|  15.4M|	} else { \
  |  | 1132|  15.4M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1092|  15.4M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  15.4M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 2.81M, False: 12.6M]
  |  |  |  |  ------------------
  |  |  |  | 1093|  15.4M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  2.81M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 2.81M, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|  2.81M|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  2.81M|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 2.81M, False: 384]
  |  |  |  |  ------------------
  |  |  |  | 1095|  2.81M|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  2.81M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|  2.81M|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|      0|			break; \
  |  |  |  | 1106|    171|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    171|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 171, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1107|    171|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    171|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|    171|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 0, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|      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 (1085:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|      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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|		return -1; \
  |  |  |  |  |  | 1088|      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 (1088:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|				return -1; \
  |  |  |  | 1116|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|			break; \
  |  |  |  | 1118|    213|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|    213|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 213, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1119|    213|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|    213|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    213|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    426|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 93, False: 120]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|    213|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|     93|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    306|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 93]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    213|		return -1; \
  |  |  |  |  |  | 1088|    213|	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|    213|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [Folded, False: 213]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    213|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|    213|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|    213|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|    213|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    213|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 213]
  |  |  |  |  ------------------
  |  |  |  | 1121|    213|				return -1; \
  |  |  |  | 1122|    213|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|    213|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|    213|			break; \
  |  |  |  | 1124|  2.81M|		} \
  |  |  |  | 1125|  15.4M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  15.4M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 15.4M]
  |  |  |  |  ------------------
  |  |  |  | 1126|  15.4M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  15.4M|	}
  ------------------
 1153|  18.1M|	return 0;
 1154|  18.1M|}
softmagic.c:cvt_64:
 1158|  1.71M|{
 1159|  1.71M|	DO_CVT(m, q, 64);
  ------------------
  |  | 1129|  1.71M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  1.71M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1129:6): [True: 660k, False: 1.05M]
  |  |  ------------------
  |  | 1130|   660k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1092|   660k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|   660k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 199k, False: 460k]
  |  |  |  |  ------------------
  |  |  |  | 1093|   660k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   199k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 199k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|   199k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   199k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 199k, False: 31]
  |  |  |  |  ------------------
  |  |  |  | 1095|   199k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|   199k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|   199k|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|     31|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     31|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 31, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1104|     31|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     31|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|     31|			break; \
  |  |  |  | 1106|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|      0|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|      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 (1085:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|      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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|		return -1; \
  |  |  |  |  |  | 1088|      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 (1088:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|				return -1; \
  |  |  |  | 1116|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|			break; \
  |  |  |  | 1118|      0|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|      0|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 0, False: 199k]
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|      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 (1085:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|      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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|		return -1; \
  |  |  |  |  |  | 1088|      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 (1088:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|      0|				return -1; \
  |  |  |  | 1122|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|			break; \
  |  |  |  | 1124|   199k|		} \
  |  |  |  | 1125|   660k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|   660k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 660k]
  |  |  |  |  ------------------
  |  |  |  | 1126|   660k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1131|  1.05M|	} else { \
  |  | 1132|  1.05M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1092|  1.05M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  1.05M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1092:6): [True: 1.18k, False: 1.05M]
  |  |  |  |  ------------------
  |  |  |  | 1093|  1.05M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  1.18k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1093:11): [True: 1.18k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1094|     31|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|     31|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:3): [True: 31, False: 1.15k]
  |  |  |  |  ------------------
  |  |  |  | 1095|     31|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|     31|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1096|     31|			break; \
  |  |  |  | 1097|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1097:3): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  |  | 1098|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1099|      0|			break; \
  |  |  |  | 1100|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1100:3): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1102|      0|			break; \
  |  |  |  | 1103|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1103:3): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1105|      0|			break; \
  |  |  |  | 1106|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1106:3): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1108|      0|			break; \
  |  |  |  | 1109|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1109:3): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1111|      0|			break; \
  |  |  |  | 1112|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1112:3): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|      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 (1085:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|      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 (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|		return -1; \
  |  |  |  |  |  | 1088|      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 (1088:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      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 (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1114|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|				return -1; \
  |  |  |  | 1116|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|			break; \
  |  |  |  | 1118|  1.15k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  351|  1.15k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1118:3): [True: 1.15k, False: 31]
  |  |  |  |  ------------------
  |  |  |  | 1119|  1.15k|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1085|  1.15k|	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|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1085:6): [Folded, False: 1.15k]
  |  |  |  |  |  |  |  Branch (1085:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1085:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1086|  1.15k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1086:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  1.15k|		return -1; \
  |  |  |  |  |  | 1088|  1.15k|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  2.30k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1088:28): [True: 0, False: 1.15k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|  1.15k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  452|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1089:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1090|  1.15k|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1120|  1.15k|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:8): [True: 0, False: 1.15k]
  |  |  |  |  ------------------
  |  |  |  | 1121|  1.15k|				return -1; \
  |  |  |  | 1122|  1.15k|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  452|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1123|  1.15k|			break; \
  |  |  |  | 1124|  1.18k|		} \
  |  |  |  | 1125|  1.05M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  1.05M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:6): [True: 0, False: 1.05M]
  |  |  |  |  ------------------
  |  |  |  | 1126|  1.05M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  1.05M|	}
  ------------------
 1160|  1.71M|	return 0;
 1161|  1.71M|}
softmagic.c:cvt_float:
 1184|  2.32k|{
 1185|  2.32k|	DO_CVT2(f, float);
  ------------------
  |  | 1164|  2.32k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  380|  2.32k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1164:6): [True: 0, False: 2.32k]
  |  |  ------------------
  |  | 1165|  2.32k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  352|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1165:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1166|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1166:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1167|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1168|      0|			break; \
  |  | 1169|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1169:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1170|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1171|      0|			break; \
  |  | 1172|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1172:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1173|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1174|      0|			break; \
  |  | 1175|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1175:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1176|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1176:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1177|      0|				return -1; \
  |  | 1178|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1179|      0|			break; \
  |  | 1180|      0|		} \
  ------------------
 1186|  2.32k|	return 0;
 1187|  2.32k|}
softmagic.c:cvt_double:
 1191|    552|{
 1192|    552|	DO_CVT2(d, double);
  ------------------
  |  | 1164|    552|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  380|    552|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1164:6): [True: 0, False: 552]
  |  |  ------------------
  |  | 1165|    552|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  352|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1165:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1166|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  347|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1166:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1167|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1168|      0|			break; \
  |  | 1169|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  348|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1169:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1170|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1171|      0|			break; \
  |  | 1172|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  349|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1172:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1173|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1174|      0|			break; \
  |  | 1175|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  350|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1175:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1176|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1176:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1177|      0|				return -1; \
  |  | 1178|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1179|      0|			break; \
  |  | 1180|      0|		} \
  ------------------
 1193|    552|	return 0;
 1194|    552|}
softmagic.c:magiccheck:
 2169|  85.0M|{
 2170|  85.0M|	uint64_t l = m->value.q;
 2171|  85.0M|	uint64_t v;
 2172|  85.0M|	float fl, fv;
 2173|  85.0M|	double dl, dv;
 2174|  85.0M|	int matched;
 2175|  85.0M|	union VALUETYPE *p = &ms->ms_value;
 2176|       |
 2177|  85.0M|	switch (m->type) {
 2178|  1.52M|	case FILE_BYTE:
  ------------------
  |  |  246|  1.52M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2178:2): [True: 1.52M, False: 83.4M]
  ------------------
 2179|  1.52M|		v = p->b;
 2180|  1.52M|		break;
 2181|       |
 2182|  1.57M|	case FILE_SHORT:
  ------------------
  |  |  247|  1.57M|#define				FILE_SHORT		2
  ------------------
  |  Branch (2182:2): [True: 1.57M, False: 83.4M]
  ------------------
 2183|  5.35M|	case FILE_BESHORT:
  ------------------
  |  |  252|  5.35M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2183:2): [True: 3.78M, False: 81.2M]
  ------------------
 2184|  9.01M|	case FILE_LESHORT:
  ------------------
  |  |  255|  9.01M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2184:2): [True: 3.65M, False: 81.3M]
  ------------------
 2185|  9.01M|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|  9.01M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (2185:2): [True: 0, False: 85.0M]
  ------------------
 2186|  9.01M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|  9.01M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (2186:2): [True: 236, False: 85.0M]
  ------------------
 2187|  9.01M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|  9.01M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (2187:2): [True: 0, False: 85.0M]
  ------------------
 2188|  9.01M|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|  9.01M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (2188:2): [True: 0, False: 85.0M]
  ------------------
 2189|  9.01M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|  9.01M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (2189:2): [True: 236, False: 85.0M]
  ------------------
 2190|  9.01M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|  9.01M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (2190:2): [True: 0, False: 85.0M]
  ------------------
 2191|  9.01M|		v = p->h;
 2192|  9.01M|		break;
 2193|       |
 2194|  1.32M|	case FILE_LONG:
  ------------------
  |  |  249|  1.32M|#define				FILE_LONG		4
  ------------------
  |  Branch (2194:2): [True: 1.32M, False: 83.6M]
  ------------------
 2195|  12.5M|	case FILE_BELONG:
  ------------------
  |  |  253|  12.5M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2195:2): [True: 11.2M, False: 73.8M]
  ------------------
 2196|  18.1M|	case FILE_LELONG:
  ------------------
  |  |  256|  18.1M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2196:2): [True: 5.60M, False: 79.4M]
  ------------------
 2197|  18.1M|	case FILE_MELONG:
  ------------------
  |  |  268|  18.1M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2197:2): [True: 21, False: 85.0M]
  ------------------
 2198|  18.1M|	case FILE_DATE:
  ------------------
  |  |  251|  18.1M|#define				FILE_DATE		6
  ------------------
  |  Branch (2198:2): [True: 0, False: 85.0M]
  ------------------
 2199|  18.1M|	case FILE_BEDATE:
  ------------------
  |  |  254|  18.1M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2199:2): [True: 184, False: 85.0M]
  ------------------
 2200|  18.1M|	case FILE_LEDATE:
  ------------------
  |  |  257|  18.1M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2200:2): [True: 246, False: 85.0M]
  ------------------
 2201|  18.1M|	case FILE_MEDATE:
  ------------------
  |  |  266|  18.1M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2201:2): [True: 25, False: 85.0M]
  ------------------
 2202|  18.1M|	case FILE_LDATE:
  ------------------
  |  |  259|  18.1M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2202:2): [True: 0, False: 85.0M]
  ------------------
 2203|  18.1M|	case FILE_BELDATE:
  ------------------
  |  |  260|  18.1M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2203:2): [True: 263, False: 85.0M]
  ------------------
 2204|  18.1M|	case FILE_LELDATE:
  ------------------
  |  |  261|  18.1M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2204:2): [True: 0, False: 85.0M]
  ------------------
 2205|  18.1M|	case FILE_MELDATE:
  ------------------
  |  |  267|  18.1M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2205:2): [True: 0, False: 85.0M]
  ------------------
 2206|  18.1M|		v = p->l;
 2207|  18.1M|		break;
 2208|       |
 2209|  59.6k|	case FILE_QUAD:
  ------------------
  |  |  269|  59.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2209:2): [True: 59.6k, False: 84.9M]
  ------------------
 2210|   794k|	case FILE_LEQUAD:
  ------------------
  |  |  270|   794k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2210:2): [True: 734k, False: 84.2M]
  ------------------
 2211|  1.70M|	case FILE_BEQUAD:
  ------------------
  |  |  271|  1.70M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2211:2): [True: 915k, False: 84.1M]
  ------------------
 2212|  1.70M|	case FILE_QDATE:
  ------------------
  |  |  272|  1.70M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2212:2): [True: 0, False: 85.0M]
  ------------------
 2213|  1.71M|	case FILE_BEQDATE:
  ------------------
  |  |  274|  1.71M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2213:2): [True: 556, False: 85.0M]
  ------------------
 2214|  1.71M|	case FILE_LEQDATE:
  ------------------
  |  |  273|  1.71M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2214:2): [True: 0, False: 85.0M]
  ------------------
 2215|  1.71M|	case FILE_QLDATE:
  ------------------
  |  |  275|  1.71M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2215:2): [True: 0, False: 85.0M]
  ------------------
 2216|  1.71M|	case FILE_BEQLDATE:
  ------------------
  |  |  277|  1.71M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2216:2): [True: 0, False: 85.0M]
  ------------------
 2217|  1.71M|	case FILE_LEQLDATE:
  ------------------
  |  |  276|  1.71M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2217:2): [True: 13, False: 85.0M]
  ------------------
 2218|  1.71M|	case FILE_QWDATE:
  ------------------
  |  |  287|  1.71M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2218:2): [True: 160, False: 85.0M]
  ------------------
 2219|  1.71M|	case FILE_BEQWDATE:
  ------------------
  |  |  289|  1.71M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2219:2): [True: 0, False: 85.0M]
  ------------------
 2220|  1.71M|	case FILE_LEQWDATE:
  ------------------
  |  |  288|  1.71M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2220:2): [True: 1.02k, False: 85.0M]
  ------------------
 2221|  1.71M|	case FILE_OFFSET:
  ------------------
  |  |  297|  1.71M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (2221:2): [True: 6.38k, False: 85.0M]
  ------------------
 2222|  1.71M|		v = p->q;
 2223|  1.71M|		break;
 2224|       |
 2225|      0|	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2225:2): [True: 0, False: 85.0M]
  ------------------
 2226|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2226:2): [True: 0, False: 85.0M]
  ------------------
 2227|  2.32k|	case FILE_LEFLOAT:
  ------------------
  |  |  280|  2.32k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2227:2): [True: 2.32k, False: 85.0M]
  ------------------
 2228|  2.32k|		fl = m->value.f;
 2229|  2.32k|		fv = p->f;
 2230|  2.32k|		switch (m->reln) {
 2231|    420|		case 'x':
  ------------------
  |  Branch (2231:3): [True: 420, False: 1.90k]
  ------------------
 2232|    420|			matched = 1;
 2233|    420|			break;
 2234|       |
 2235|      0|		case '!':
  ------------------
  |  Branch (2235:3): [True: 0, False: 2.32k]
  ------------------
 2236|      0|			matched = isunordered(fl, fv) ? 1 : fv != fl;
  ------------------
  |  Branch (2236:14): [True: 0, False: 0]
  ------------------
 2237|      0|			break;
 2238|       |
 2239|      0|		case '=':
  ------------------
  |  Branch (2239:3): [True: 0, False: 2.32k]
  ------------------
 2240|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
  ------------------
  |  Branch (2240:14): [True: 0, False: 0]
  ------------------
 2241|      0|			break;
 2242|       |
 2243|  1.90k|		case '>':
  ------------------
  |  Branch (2243:3): [True: 1.90k, False: 420]
  ------------------
 2244|  1.90k|			matched = isgreater(fv, fl);
 2245|  1.90k|			break;
 2246|       |
 2247|      0|		case '<':
  ------------------
  |  Branch (2247:3): [True: 0, False: 2.32k]
  ------------------
 2248|      0|			matched = isless(fv, fl);
 2249|      0|			break;
 2250|       |
 2251|      0|		default:
  ------------------
  |  Branch (2251:3): [True: 0, False: 2.32k]
  ------------------
 2252|      0|			file_magerror(ms, "cannot happen with float: "
 2253|      0|			    "invalid relation `%c'", m->reln);
 2254|      0|			return -1;
 2255|  2.32k|		}
 2256|  2.32k|		return matched;
 2257|       |
 2258|      0|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2258:2): [True: 0, False: 85.0M]
  ------------------
 2259|    168|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|    168|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2259:2): [True: 168, False: 85.0M]
  ------------------
 2260|    552|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    552|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2260:2): [True: 384, False: 85.0M]
  ------------------
 2261|    552|		dl = m->value.d;
 2262|    552|		dv = p->d;
 2263|    552|		switch (m->reln) {
 2264|    282|		case 'x':
  ------------------
  |  Branch (2264:3): [True: 282, False: 270]
  ------------------
 2265|    282|			matched = 1;
 2266|    282|			break;
 2267|       |
 2268|      0|		case '!':
  ------------------
  |  Branch (2268:3): [True: 0, False: 552]
  ------------------
 2269|      0|			matched = isunordered(dv, dl) ? 1 : dv != dl;
  ------------------
  |  Branch (2269:14): [True: 0, False: 0]
  ------------------
 2270|      0|			break;
 2271|       |
 2272|    270|		case '=':
  ------------------
  |  Branch (2272:3): [True: 270, False: 282]
  ------------------
 2273|    270|			matched = isunordered(dv, dl) ? 0 : dv == dl;
  ------------------
  |  Branch (2273:14): [True: 116, False: 154]
  ------------------
 2274|    270|			break;
 2275|       |
 2276|      0|		case '>':
  ------------------
  |  Branch (2276:3): [True: 0, False: 552]
  ------------------
 2277|      0|			matched = isgreater(dv, dl);
 2278|      0|			break;
 2279|       |
 2280|      0|		case '<':
  ------------------
  |  Branch (2280:3): [True: 0, False: 552]
  ------------------
 2281|      0|			matched = isless(dv, dl);
 2282|      0|			break;
 2283|       |
 2284|      0|		default:
  ------------------
  |  Branch (2284:3): [True: 0, False: 552]
  ------------------
 2285|      0|			file_magerror(ms, "cannot happen with double: "
 2286|      0|			    "invalid relation `%c'", m->reln);
 2287|      0|			return -1;
 2288|    552|		}
 2289|    552|		return matched;
 2290|       |
 2291|  12.1k|	case FILE_DEFAULT:
  ------------------
  |  |  248|  12.1k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2291:2): [True: 12.1k, False: 85.0M]
  ------------------
 2292|  15.3k|	case FILE_CLEAR:
  ------------------
  |  |  292|  15.3k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2292:2): [True: 3.22k, False: 85.0M]
  ------------------
 2293|  15.3k|		l = 0;
 2294|  15.3k|		v = 0;
 2295|  15.3k|		break;
 2296|       |
 2297|  53.0M|	case FILE_STRING:
  ------------------
  |  |  250|  53.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (2297:2): [True: 53.0M, False: 31.9M]
  ------------------
 2298|  53.1M|	case FILE_PSTRING:
  ------------------
  |  |  258|  53.1M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2298:2): [True: 22.6k, False: 84.9M]
  ------------------
 2299|  53.1M|	case FILE_OCTAL:
  ------------------
  |  |  306|  53.1M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (2299:2): [True: 0, False: 85.0M]
  ------------------
 2300|  53.1M|		l = 0;
 2301|  53.1M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  452|  53.1M|#define CAST(T, b)	((T)(b))
  ------------------
 2302|  53.1M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  382|  53.1M|#define str_flags _u._s._flags
  ------------------
 2303|  53.1M|		break;
 2304|       |
 2305|    299|	case FILE_BESTRING16:
  ------------------
  |  |  263|    299|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2305:2): [True: 299, False: 85.0M]
  ------------------
 2306|  57.6k|	case FILE_LESTRING16:
  ------------------
  |  |  264|  57.6k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2306:2): [True: 57.3k, False: 84.9M]
  ------------------
 2307|  57.6k|		l = 0;
 2308|  57.6k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  452|  57.6k|#define CAST(T, b)	((T)(b))
  ------------------
 2309|  57.6k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  382|  57.6k|#define str_flags _u._s._flags
  ------------------
 2310|  57.6k|		break;
 2311|       |
 2312|   515k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  265|   515k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2312:2): [True: 515k, False: 84.5M]
  ------------------
 2313|   515k|		size_t slen;
 2314|   515k|		size_t idx;
 2315|       |
 2316|   515k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2316:7): [True: 0, False: 515k]
  ------------------
 2317|      0|			return 0;
 2318|       |
 2319|   515k|		slen = MIN(m->vallen, sizeof(m->value.s));
  ------------------
  |  Branch (2319:10): [True: 515k, False: 0]
  ------------------
 2320|   515k|		l = 0;
 2321|   515k|		v = 0;
 2322|   515k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   515k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2322:7): [True: 0, False: 515k]
  ------------------
 2323|      0|			size_t xlen = ms->search.s_len > 100 ? 100
  ------------------
  |  Branch (2323:18): [True: 0, False: 0]
  ------------------
 2324|      0|			    : ms->search.s_len;
 2325|       |
 2326|      0|			fprintf(stderr, "search: [");
 2327|      0|			file_showstr(stderr, ms->search.s, xlen);
 2328|      0|			fprintf(stderr, "%s] for [", ms->search.s_len == xlen
  ------------------
  |  Branch (2328:33): [True: 0, False: 0]
  ------------------
 2329|      0|			    ? "" : "...");
 2330|      0|			file_showstr(stderr, m->value.s, slen);
 2331|      0|		}
 2332|   515k|#ifdef HAVE_MEMMEM
 2333|   515k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  382|   515k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2333:7): [True: 515k, False: 0]
  |  Branch (2333:19): [True: 277k, False: 237k]
  ------------------
 2334|   277k|			const char *found;
 2335|   277k|			idx = m->str_range + slen;
  ------------------
  |  |  381|   277k|#define str_range _u._s._count
  ------------------
 2336|   277k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  381|   277k|#define str_range _u._s._count
  ------------------
  |  Branch (2336:8): [True: 3.47k, False: 274k]
  |  Branch (2336:29): [True: 100k, False: 173k]
  ------------------
 2337|   104k|				idx = ms->search.s_len;
 2338|   277k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  452|   277k|#define CAST(T, b)	((T)(b))
  ------------------
 2339|   277k|			    m->value.s, slen));
 2340|   277k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   277k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2340:8): [True: 0, False: 277k]
  ------------------
 2341|      0|				fprintf(stderr, "] %sfound\n",
 2342|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2342:9): [True: 0, False: 0]
  ------------------
 2343|      0|			}
 2344|   277k|			if (!found) {
  ------------------
  |  Branch (2344:8): [True: 275k, False: 2.08k]
  ------------------
 2345|   275k|				v = 1;
 2346|   275k|				break;
 2347|   275k|			}
 2348|  2.08k|			idx = found - ms->search.s;
 2349|  2.08k|			ms->search.offset += idx;
 2350|  2.08k|			ms->search.rm_len = ms->search.s_len - idx;
 2351|  2.08k|			break;
 2352|   277k|		}
 2353|   237k|#endif
 2354|       |
 2355|  2.55G|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  381|  2.55G|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  381|  2.55G|#define str_range _u._s._count
  ------------------
  |  Branch (2355:17): [True: 0, False: 2.55G]
  |  Branch (2355:38): [True: 2.55G, False: 104k]
  ------------------
 2356|  2.55G|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2356:8): [True: 132k, False: 2.55G]
  ------------------
 2357|   132k|				v = 1;
 2358|   132k|				break;
 2359|   132k|			}
 2360|       |
 2361|  2.55G|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2362|  2.55G|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  382|  2.55G|#define str_flags _u._s._flags
  ------------------
 2363|  2.55G|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2363:8): [True: 633, False: 2.55G]
  ------------------
 2364|    633|				ms->search.offset += idx;
 2365|    633|				ms->search.rm_len = ms->search.s_len - idx;
 2366|    633|				break;
 2367|    633|			}
 2368|  2.55G|		}
 2369|   237k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   237k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2369:7): [True: 0, False: 237k]
  ------------------
 2370|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2370:35): [True: 0, False: 0]
  ------------------
 2371|      0|		}
 2372|   237k|		break;
 2373|   515k|	}
 2374|   262k|	case FILE_REGEX: {
  ------------------
  |  |  262|   262k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2374:2): [True: 262k, False: 84.7M]
  ------------------
 2375|   262k|		int rc;
 2376|   262k|		file_regex_t *rx = *m_cache;
 2377|   262k|		const char *search;
 2378|   262k|		regmatch_t pmatch;
 2379|   262k|		size_t slen = ms->search.s_len;
 2380|   262k|		char *copy;
 2381|       |
 2382|   262k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2382:7): [True: 15, False: 262k]
  ------------------
 2383|     15|			return 0;
 2384|       |
 2385|   262k|		if (rx == NULL) {
  ------------------
  |  Branch (2385:7): [True: 163, False: 262k]
  ------------------
 2386|    163|			rx = *m_cache = alloc_regex(ms, m);
 2387|    163|			if (rx == NULL)
  ------------------
  |  Branch (2387:8): [True: 0, False: 163]
  ------------------
 2388|      0|				return -1;
 2389|    163|		}
 2390|   262k|		l = 0;
 2391|   262k|		if (slen != 0) {
  ------------------
  |  Branch (2391:7): [True: 260k, False: 1.82k]
  ------------------
 2392|   260k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  452|   260k|#define CAST(T, b)	((T)(b))
  ------------------
 2393|   260k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2393:11): [True: 0, False: 260k]
  ------------------
 2394|      0|			file_error(ms, errno,
 2395|      0|			    "can't allocate %" SIZE_T_FORMAT "u bytes",
 2396|      0|			    slen);
 2397|      0|			return -1;
 2398|      0|		    }
 2399|   260k|		    memcpy(copy, ms->search.s, slen);
 2400|   260k|		    copy[--slen] = '\0';
 2401|   260k|		    search = copy;
 2402|   260k|		} else {
 2403|  1.82k|		    search = CCAST(char *, "");
  ------------------
  |  |  454|  1.82k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2404|  1.82k|		    copy = NULL;
 2405|  1.82k|		}
 2406|   262k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  453|   262k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2407|   262k|		    1, &pmatch, 0);
 2408|   262k|		free(copy);
 2409|   262k|		switch (rc) {
 2410|  2.66k|		case 0:
  ------------------
  |  Branch (2410:3): [True: 2.66k, False: 259k]
  ------------------
 2411|  2.66k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  452|  2.66k|#define CAST(T, b)	((T)(b))
  ------------------
 2412|  2.66k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  452|  2.66k|#define CAST(T, b)	((T)(b))
  ------------------
 2413|  2.66k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  452|  2.66k|#define CAST(T, b)	((T)(b))
  ------------------
 2414|  2.66k|			    pmatch.rm_eo - pmatch.rm_so);
 2415|  2.66k|			v = 0;
 2416|  2.66k|			break;
 2417|       |
 2418|   259k|		case REG_NOMATCH:
  ------------------
  |  Branch (2418:3): [True: 259k, False: 2.66k]
  ------------------
 2419|   259k|			v = 1;
 2420|   259k|			break;
 2421|       |
 2422|      0|		default:
  ------------------
  |  Branch (2422:3): [True: 0, False: 262k]
  ------------------
 2423|      0|			return -1;
 2424|   262k|		}
 2425|   262k|		break;
 2426|   262k|	}
 2427|   262k|	case FILE_USE:
  ------------------
  |  |  291|  56.7k|#define				FILE_USE		46
  ------------------
  |  Branch (2427:2): [True: 56.7k, False: 84.9M]
  ------------------
 2428|  56.7k|		return ms->ms_value.q != 0;
 2429|  61.2k|	case FILE_NAME:
  ------------------
  |  |  290|  61.2k|#define				FILE_NAME		45
  ------------------
  |  Branch (2429:2): [True: 61.2k, False: 84.9M]
  ------------------
 2430|  73.2k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  73.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2430:2): [True: 12.0k, False: 85.0M]
  ------------------
 2431|  73.2k|		return 1;
 2432|   372k|	case FILE_DER:
  ------------------
  |  |  293|   372k|#define				FILE_DER		48
  ------------------
  |  Branch (2432:2): [True: 372k, False: 84.6M]
  ------------------
 2433|   372k|		matched = der_cmp(ms, m);
 2434|   372k|		if (matched == -1) {
  ------------------
  |  Branch (2434:7): [True: 128k, False: 244k]
  ------------------
 2435|   128k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   128k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2435:8): [True: 0, False: 128k]
  ------------------
 2436|      0|				(void) fprintf(stderr,
 2437|      0|				    "EOF comparing DER entries\n");
 2438|      0|			}
 2439|   128k|			return 0;
 2440|   128k|		}
 2441|   244k|		return matched;
 2442|      0|	case FILE_BEGUID:
  ------------------
  |  |  296|      0|#define				FILE_BEGUID		51
  ------------------
  |  Branch (2442:2): [True: 0, False: 85.0M]
  ------------------
 2443|      0|	case FILE_LEGUID:
  ------------------
  |  |  295|      0|#define				FILE_LEGUID		50
  ------------------
  |  Branch (2443:2): [True: 0, False: 85.0M]
  ------------------
 2444|   164k|	case FILE_GUID:
  ------------------
  |  |  294|   164k|#define				FILE_GUID		49
  ------------------
  |  Branch (2444:2): [True: 164k, False: 84.8M]
  ------------------
 2445|   164k|		l = 0;
 2446|   164k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2447|   164k|		break;
 2448|      0|	default:
  ------------------
  |  Branch (2448:2): [True: 0, False: 85.0M]
  ------------------
 2449|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2450|      0|		return -1;
 2451|  85.0M|	}
 2452|       |
 2453|  84.5M|	v = file_signextend(ms, m, v);
 2454|       |
 2455|  84.5M|	switch (m->reln) {
 2456|  87.5k|	case 'x':
  ------------------
  |  Branch (2456:2): [True: 87.5k, False: 84.4M]
  ------------------
 2457|  87.5k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  87.5k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2457:7): [True: 0, False: 87.5k]
  ------------------
 2458|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT
 2459|      0|			    "u == *any* = 1", CAST(unsigned long long, v));
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2460|  87.5k|		matched = 1;
 2461|  87.5k|		break;
 2462|       |
 2463|  62.0k|	case '!':
  ------------------
  |  Branch (2463:2): [True: 62.0k, False: 84.4M]
  ------------------
 2464|  62.0k|		matched = v != l;
 2465|  62.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  62.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2465:7): [True: 0, False: 62.0k]
  ------------------
 2466|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u != %"
 2467|      0|			    INT64_T_FORMAT "u = %d",
 2468|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2469|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2470|  62.0k|		break;
 2471|       |
 2472|  83.8M|	case '=':
  ------------------
  |  Branch (2472:2): [True: 83.8M, False: 703k]
  ------------------
 2473|  83.8M|		matched = v == l;
 2474|  83.8M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  83.8M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2474:7): [True: 0, False: 83.8M]
  ------------------
 2475|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u == %"
 2476|      0|			    INT64_T_FORMAT "u = %d",
 2477|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2478|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2479|  83.8M|		break;
 2480|       |
 2481|   232k|	case '>':
  ------------------
  |  Branch (2481:2): [True: 232k, False: 84.2M]
  ------------------
 2482|   232k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  229|   232k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2482:7): [True: 164k, False: 68.3k]
  ------------------
 2483|   164k|			matched = v > l;
 2484|   164k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   164k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2484:8): [True: 0, False: 164k]
  ------------------
 2485|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2486|      0|				    "u > %" INT64_T_FORMAT "u = %d",
 2487|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2488|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2489|   164k|		}
 2490|  68.3k|		else {
 2491|  68.3k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  452|  68.3k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  452|  68.3k|#define CAST(T, b)	((T)(b))
  ------------------
 2492|  68.3k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  68.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2492:8): [True: 0, False: 68.3k]
  ------------------
 2493|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2494|      0|				    "d > %" INT64_T_FORMAT "d = %d",
 2495|      0|				    CAST(long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2496|      0|				    CAST(long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2497|  68.3k|		}
 2498|   232k|		break;
 2499|       |
 2500|   288k|	case '<':
  ------------------
  |  Branch (2500:2): [True: 288k, False: 84.2M]
  ------------------
 2501|   288k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  229|   288k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2501:7): [True: 244k, False: 44.1k]
  ------------------
 2502|   244k|			matched = v < l;
 2503|   244k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   244k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2503:8): [True: 0, False: 244k]
  ------------------
 2504|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2505|      0|				    "u < %" INT64_T_FORMAT "u = %d",
 2506|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2507|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2508|   244k|		}
 2509|  44.1k|		else {
 2510|  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))
  ------------------
 2511|  44.1k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  44.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2511:8): [True: 0, False: 44.1k]
  ------------------
 2512|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2513|      0|				    "d < %" INT64_T_FORMAT "d = %d",
 2514|      0|				     CAST(long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2515|      0|				     CAST(long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2516|  44.1k|		}
 2517|   288k|		break;
 2518|       |
 2519|  32.0k|	case '&':
  ------------------
  |  Branch (2519:2): [True: 32.0k, False: 84.4M]
  ------------------
 2520|  32.0k|		matched = (v & l) == l;
 2521|  32.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  32.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2521:7): [True: 0, False: 32.0k]
  ------------------
 2522|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2523|      0|			    INT64_T_FORMAT "x) == %" INT64_T_FORMAT
 2524|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2525|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2526|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2527|      0|			    matched);
 2528|  32.0k|		break;
 2529|       |
 2530|    771|	case '^':
  ------------------
  |  Branch (2530:2): [True: 771, False: 84.5M]
  ------------------
 2531|    771|		matched = (v & l) != l;
 2532|    771|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    771|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2532:7): [True: 0, False: 771]
  ------------------
 2533|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2534|      0|			    INT64_T_FORMAT "x) != %" INT64_T_FORMAT
 2535|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2536|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2537|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  452|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2538|    771|		break;
 2539|       |
 2540|      0|	default:
  ------------------
  |  Branch (2540:2): [True: 0, False: 84.5M]
  ------------------
 2541|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2542|      0|		    m->reln);
 2543|      0|		return -1;
 2544|  84.5M|	}
 2545|  84.5M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  84.5M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2545:6): [True: 0, False: 84.5M]
  ------------------
 2546|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2547|      0|		    file_magic_strength(m, 1));
 2548|      0|	}
 2549|       |
 2550|  84.5M|	return matched;
 2551|  84.5M|}
softmagic.c:file_strncmp:
 2059|  2.60G|{
 2060|       |	/*
 2061|       |	 * Convert the source args to unsigned here so that (1) the
 2062|       |	 * compare will be unsigned as it is in strncmp() and (2) so
 2063|       |	 * the ctype functions will work correctly without extra
 2064|       |	 * casting.
 2065|       |	 */
 2066|  2.60G|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  453|  2.60G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2067|  2.60G|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  453|  2.60G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2068|  2.60G|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  396|  2.60G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  395|  2.60G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2069|  2.60G|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  397|  2.60G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  395|  2.60G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2070|  2.60G|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (2070:33): [True: 33.6M, False: 2.57G]
  ------------------
 2071|  2.60G|	uint64_t v;
 2072|       |
 2073|       |	/*
 2074|       |	 * What we want here is v = strncmp(s1, s2, len),
 2075|       |	 * but ignoring any nulls.
 2076|       |	 */
 2077|  2.60G|	v = 0;
 2078|  2.60G|	len++;
 2079|  2.60G|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2079:6): [True: 50.3M, False: 2.55G]
  ------------------
 2080|  51.1M|		while (--len > 0)
  ------------------
  |  Branch (2080:10): [True: 51.0M, False: 41.5k]
  ------------------
 2081|  51.0M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2081:8): [True: 50.3M, False: 769k]
  ------------------
 2082|  50.3M|				break;
 2083|  50.3M|	}
 2084|  2.55G|	else { /* combine the others */
 2085|  2.55G|		while (--len > 0) {
  ------------------
  |  Branch (2085:10): [True: 2.55G, False: 30.1k]
  ------------------
 2086|  2.55G|			if (b >= eb) {
  ------------------
  |  Branch (2086:8): [True: 157k, False: 2.55G]
  ------------------
 2087|   157k|				v = 1;
 2088|   157k|				break;
 2089|   157k|			}
 2090|  2.55G|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  398|  2.55G|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  395|  2.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2090:8): [True: 34.3M, False: 2.52G]
  ------------------
 2091|  2.55G|			    islower(*a)) {
  ------------------
  |  Branch (2091:8): [True: 2.90M, False: 31.4M]
  ------------------
 2092|  2.90M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2092:9): [True: 2.86M, False: 35.4k]
  |  Branch (2092:14): [True: 0, False: 0]
  |  Branch (2092:14): [Folded, False: 0]
  |  Branch (2092:14): [Folded, False: 2.90M]
  ------------------
 2093|  2.86M|					break;
 2094|  2.90M|			}
 2095|  2.55G|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  399|  2.55G|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  395|  2.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2095:13): [True: 19.8k, False: 2.55G]
  ------------------
 2096|  2.55G|			    isupper(*a)) {
  ------------------
  |  Branch (2096:8): [True: 11.4k, False: 8.33k]
  ------------------
 2097|  11.4k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2097:9): [True: 11.3k, False: 163]
  |  Branch (2097:14): [True: 0, False: 0]
  |  Branch (2097:14): [Folded, False: 0]
  |  Branch (2097:14): [Folded, False: 11.4k]
  ------------------
 2098|  11.3k|					break;
 2099|  11.4k|			}
 2100|  2.55G|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  396|  2.55G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  395|  2.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2100:13): [True: 25.8M, False: 2.53G]
  ------------------
 2101|  2.55G|			    isspace(*a)) {
  ------------------
  |  Branch (2101:8): [True: 927k, False: 24.8M]
  ------------------
 2102|   927k|				a++;
 2103|   927k|				if (isspace(*b)) {
  ------------------
  |  Branch (2103:9): [True: 168k, False: 759k]
  ------------------
 2104|   168k|					b++;
 2105|   168k|					if (!isspace(*a))
  ------------------
  |  Branch (2105:10): [True: 168k, False: 0]
  ------------------
 2106|  6.13G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2106:14): [True: 6.13G, False: 157k]
  |  Branch (2106:24): [True: 6.13G, False: 10.1k]
  ------------------
 2107|  6.13G|							b++;
 2108|   168k|				}
 2109|   759k|				else {
 2110|   759k|					v = 1;
 2111|   759k|					break;
 2112|   759k|				}
 2113|   927k|			}
 2114|  2.55G|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  397|  2.55G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  395|  2.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2114:13): [True: 7.88M, False: 2.54G]
  ------------------
 2115|  2.55G|			    isspace(*a)) {
  ------------------
  |  Branch (2115:8): [True: 1.93k, False: 7.87M]
  ------------------
 2116|  1.93k|				a++;
 2117|  6.07k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2117:12): [True: 6.03k, False: 40]
  |  Branch (2117:22): [True: 4.13k, False: 1.89k]
  ------------------
 2118|  4.13k|					b++;
 2119|  1.93k|			}
 2120|  2.55G|			else {
 2121|  2.55G|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2121:9): [True: 2.55G, False: 378k]
  ------------------
 2122|  2.55G|					break;
 2123|  2.55G|			}
 2124|  2.55G|		}
 2125|  2.55G|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  414|  30.1k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  395|  30.1k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2125:7): [True: 30.1k, False: 2.55G]
  |  Branch (2125:19): [True: 30.1k, False: 0]
  |  Branch (2125:29): [True: 70, False: 30.0k]
  ------------------
 2126|     70|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2126:8): [True: 54, False: 16]
  |  Branch (2126:14): [True: 39, False: 15]
  ------------------
 2127|     39|				v = 1;
 2128|     70|		}
 2129|  2.55G|	}
 2130|  2.60G|	return v;
 2131|  2.60G|}
softmagic.c:file_strncmp16:
 2136|  57.6k|{
 2137|       |	/*
 2138|       |	 * XXX - The 16-bit string compare probably needs to be done
 2139|       |	 * differently, especially if the flags are to be supported.
 2140|       |	 * At the moment, I am unsure.
 2141|       |	 */
 2142|  57.6k|	flags = 0;
 2143|  57.6k|	return file_strncmp(a, b, len, maxlen, flags);
 2144|  57.6k|}
softmagic.c:alloc_regex:
 2148|    163|{
 2149|    163|	int rc;
 2150|    163|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  452|    163|#define CAST(T, b)	((T)(b))
  ------------------
 2151|       |
 2152|    163|	if (rx == NULL) {
  ------------------
  |  Branch (2152:6): [True: 0, False: 163]
  ------------------
 2153|      0|		file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT
 2154|      0|		    "u bytes", sizeof(*rx));
 2155|      0|		return NULL;
 2156|      0|	}
 2157|       |
 2158|    163|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2159|    163|	    REGEX_ICASE(m));
  ------------------
  |  |  432|    163|#define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  382|    163|#define str_flags _u._s._flags
  |  |  ------------------
  |  |               #define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  431|    163|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  398|    163|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  395|    163|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    163|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  395|    163|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (432:25): [True: 20, False: 143]
  |  |  ------------------
  ------------------
 2160|    163|	if (rc == 0)
  ------------------
  |  Branch (2160:6): [True: 163, False: 0]
  ------------------
 2161|    163|		return rx;
 2162|       |
 2163|      0|	free(rx);
 2164|       |	return NULL;
 2165|    163|}
softmagic.c:handle_annotation:
 2555|   731k|{
 2556|   731k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   731k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2556:6): [True: 0, False: 731k]
  |  Branch (2556:35): [True: 0, False: 0]
  ------------------
 2557|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2557:7): [True: 0, False: 0]
  |  Branch (2557:21): [True: 0, False: 0]
  ------------------
 2558|      0|			return 1;
 2559|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2559:7): [True: 0, False: 0]
  ------------------
 2560|      0|			return -1;
 2561|      0|		if (file_printf(ms, "%.8s", m->apple) == -1)
  ------------------
  |  Branch (2561:7): [True: 0, False: 0]
  ------------------
 2562|      0|			return -1;
 2563|      0|		return 1;
 2564|      0|	}
 2565|   731k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   731k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2565:6): [True: 0, False: 731k]
  |  Branch (2565:39): [True: 0, False: 0]
  ------------------
 2566|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2566:7): [True: 0, False: 0]
  |  Branch (2566:21): [True: 0, False: 0]
  ------------------
 2567|      0|			return 1;
 2568|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2568:7): [True: 0, False: 0]
  ------------------
 2569|      0|			return -1;
 2570|      0|		if (file_printf(ms, "%s", m->ext) == -1)
  ------------------
  |  Branch (2570:7): [True: 0, False: 0]
  ------------------
 2571|      0|			return -1;
 2572|      0|		return 1;
 2573|      0|	}
 2574|   731k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   731k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2574:6): [True: 0, False: 731k]
  |  Branch (2574:39): [True: 0, False: 0]
  ------------------
 2575|      0|		char buf[1024];
 2576|      0|		const char *p;
 2577|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2577:7): [True: 0, False: 0]
  |  Branch (2577:21): [True: 0, False: 0]
  ------------------
 2578|      0|			return 1;
 2579|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2579:7): [True: 0, False: 0]
  ------------------
 2580|      0|			return -1;
 2581|      0|		if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
  ------------------
  |  Branch (2581:7): [True: 0, False: 0]
  ------------------
 2582|      0|			p = m->mimetype;
 2583|      0|		else
 2584|      0|			p = buf;
 2585|      0|		if (file_printf(ms, "%s", p) == -1)
  ------------------
  |  Branch (2585:7): [True: 0, False: 0]
  ------------------
 2586|      0|			return -1;
 2587|      0|		return 1;
 2588|      0|	}
 2589|   731k|	return 0;
 2590|   731k|}
softmagic.c:varexpand:
  550|   134k|{
  551|   134k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  552|   134k|	size_t l;
  553|       |
  554|   134k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (554:19): [True: 358, False: 134k]
  ------------------
  555|    358|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  452|    358|#define CAST(T, b)	((T)(b))
  ------------------
  556|    358|		if (l >= len)
  ------------------
  |  Branch (556:7): [True: 0, False: 358]
  ------------------
  557|      0|			return -1;
  558|    358|		memcpy(buf, sptr, l);
  559|    358|		buf += l;
  560|    358|		len -= l;
  561|    358|		ptr += 2;
  562|    358|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (562:7): [True: 0, False: 358]
  |  Branch (562:16): [True: 0, False: 358]
  ------------------
  563|      0|			return -1;
  564|  5.37k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (564:26): [True: 5.37k, False: 0]
  |  Branch (564:33): [True: 5.01k, False: 358]
  ------------------
  565|  5.01k|			continue;
  566|    358|		if (*et != ':')
  ------------------
  |  Branch (566:7): [True: 0, False: 358]
  ------------------
  567|      0|			return -1;
  568|  5.01k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (568:25): [True: 5.01k, False: 0]
  |  Branch (568:32): [True: 4.65k, False: 358]
  ------------------
  569|  4.65k|			continue;
  570|    358|		if (*ee != '}')
  ------------------
  |  Branch (570:7): [True: 0, False: 358]
  ------------------
  571|      0|			return -1;
  572|    358|		switch (*ptr) {
  573|    358|		case 'x':
  ------------------
  |  Branch (573:3): [True: 358, False: 0]
  ------------------
  574|    358|			if (ms->mode & 0111) {
  ------------------
  |  Branch (574:8): [True: 1, False: 357]
  ------------------
  575|      1|				ptr = t;
  576|      1|				l = et - t;
  577|    357|			} else {
  578|    357|				ptr = e;
  579|    357|				l = ee - e;
  580|    357|			}
  581|    358|			break;
  582|      0|		default:
  ------------------
  |  Branch (582:3): [True: 0, False: 358]
  ------------------
  583|      0|			return -1;
  584|    358|		}
  585|    358|		if (l >= len)
  ------------------
  |  Branch (585:7): [True: 0, False: 358]
  ------------------
  586|      0|			return -1;
  587|    358|		memcpy(buf, ptr, l);
  588|    358|		buf += l;
  589|    358|		len -= l;
  590|    358|		sptr = ee + 1;
  591|    358|	}
  592|       |
  593|   134k|	l = strlen(sptr);
  594|   134k|	if (l >= len)
  ------------------
  |  Branch (594:6): [True: 0, False: 134k]
  ------------------
  595|      0|		return -1;
  596|       |
  597|   134k|	memcpy(buf, sptr, l);
  598|   134k|	buf[l] = '\0';
  599|   134k|	return 0;
  600|   134k|}
softmagic.c:print_sep:
 2594|  48.8k|{
 2595|  48.8k|	if (firstline)
  ------------------
  |  Branch (2595:6): [True: 11.8k, False: 37.0k]
  ------------------
 2596|  11.8k|		return 0;
 2597|       |	/*
 2598|       |	 * we found another match
 2599|       |	 * put a newline and '-' to do some simple formatting
 2600|       |	 */
 2601|  37.0k|	return file_separator(ms);
 2602|  48.8k|}
softmagic.c:mprint:
  605|   134k|{
  606|   134k|	uint64_t v;
  607|   134k|	float vf;
  608|   134k|	double vd;
  609|   134k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  610|   134k|	const char *desc;
  611|   134k|	union VALUETYPE *p = &ms->ms_value;
  612|       |
  613|   134k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (613:6): [True: 0, False: 134k]
  ------------------
  614|      0|		desc = m->desc;
  615|   134k|	else
  616|   134k|		desc = ebuf;
  617|       |
  618|   134k|#define	PRINTER(value, format, stype, utype)	\
  619|   134k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  620|   134k|	switch (check_fmt(ms, desc)) { \
  621|   134k|	case -1: \
  622|   134k|		return -1; \
  623|   134k|	case 1: \
  624|   134k|		if (m->flag & UNSIGNED) { \
  625|   134k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  626|   134k|			    CAST(utype, v)); \
  627|   134k|		} else { \
  628|   134k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  629|   134k|			    CAST(stype, v)); \
  630|   134k|		} \
  631|   134k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  632|   134k|			return -1; \
  633|   134k|		break; \
  634|   134k|	default: \
  635|   134k|		if (m->flag & UNSIGNED) { \
  636|   134k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  637|   134k|			   CAST(utype, v)) == -1) \
  638|   134k|			   return -1; \
  639|   134k|		} else { \
  640|   134k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  641|   134k|			   CAST(stype, v)) == -1) \
  642|   134k|			   return -1; \
  643|   134k|		} \
  644|   134k|		break; \
  645|   134k|	} \
  646|   134k|	break
  647|       |
  648|   134k|  	switch (m->type) {
  649|  18.7k|  	case FILE_BYTE:
  ------------------
  |  |  246|  18.7k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (649:4): [True: 18.7k, False: 115k]
  ------------------
  650|  18.7k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  619|  18.7k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  620|  18.7k|	switch (check_fmt(ms, desc)) { \
  |  |  621|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (621:2): [True: 0, False: 18.7k]
  |  |  ------------------
  |  |  622|      0|		return -1; \
  |  |  623|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (623:2): [True: 0, False: 18.7k]
  |  |  ------------------
  |  |  624|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (624:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  625|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  626|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  627|      0|		} else { \
  |  |  628|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  629|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  630|      0|		} \
  |  |  631|      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 (631:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  632|      0|			return -1; \
  |  |  633|      0|		break; \
  |  |  634|  18.7k|	default: \
  |  |  ------------------
  |  |  |  Branch (634:2): [True: 18.7k, False: 0]
  |  |  ------------------
  |  |  635|  18.7k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  18.7k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (635:7): [True: 7.49k, False: 11.2k]
  |  |  ------------------
  |  |  636|  7.49k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  7.49k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (636:14): [True: 0, False: 7.49k]
  |  |  ------------------
  |  |  637|  7.49k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  7.49k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  638|  7.49k|			   return -1; \
  |  |  639|  11.2k|		} else { \
  |  |  640|  11.2k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  11.2k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (640:14): [True: 0, False: 11.2k]
  |  |  ------------------
  |  |  641|  11.2k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  11.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  642|  11.2k|			   return -1; \
  |  |  643|  11.2k|		} \
  |  |  644|  18.7k|		break; \
  |  |  645|  18.7k|	} \
  |  |  646|  18.7k|	break
  ------------------
  651|       |
  652|  18.7k|  	case FILE_SHORT:
  ------------------
  |  |  247|  1.81k|#define				FILE_SHORT		2
  ------------------
  |  Branch (652:4): [True: 1.81k, False: 132k]
  ------------------
  653|  8.82k|  	case FILE_BESHORT:
  ------------------
  |  |  252|  8.82k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (653:4): [True: 7.00k, False: 127k]
  ------------------
  654|  22.9k|  	case FILE_LESHORT:
  ------------------
  |  |  255|  22.9k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (654:4): [True: 14.1k, False: 119k]
  ------------------
  655|  22.9k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  619|  22.9k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  22.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  620|  22.9k|	switch (check_fmt(ms, desc)) { \
  |  |  621|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (621:2): [True: 0, False: 22.9k]
  |  |  ------------------
  |  |  622|      0|		return -1; \
  |  |  623|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (623:2): [True: 0, False: 22.9k]
  |  |  ------------------
  |  |  624|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (624:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  625|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  626|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  627|      0|		} else { \
  |  |  628|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  629|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  630|      0|		} \
  |  |  631|      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 (631:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  632|      0|			return -1; \
  |  |  633|      0|		break; \
  |  |  634|  22.9k|	default: \
  |  |  ------------------
  |  |  |  Branch (634:2): [True: 22.9k, False: 0]
  |  |  ------------------
  |  |  635|  22.9k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  22.9k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (635:7): [True: 12.5k, False: 10.3k]
  |  |  ------------------
  |  |  636|  12.5k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  12.5k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (636:14): [True: 0, False: 12.5k]
  |  |  ------------------
  |  |  637|  12.5k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  12.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  638|  12.5k|			   return -1; \
  |  |  639|  12.5k|		} else { \
  |  |  640|  10.3k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  10.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (640:14): [True: 0, False: 10.3k]
  |  |  ------------------
  |  |  641|  10.3k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  10.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  642|  10.3k|			   return -1; \
  |  |  643|  10.3k|		} \
  |  |  644|  22.9k|		break; \
  |  |  645|  22.9k|	} \
  |  |  646|  22.9k|	break
  ------------------
  656|       |
  657|  22.9k|  	case FILE_LONG:
  ------------------
  |  |  249|    367|#define				FILE_LONG		4
  ------------------
  |  Branch (657:4): [True: 367, False: 133k]
  ------------------
  658|  24.6k|  	case FILE_BELONG:
  ------------------
  |  |  253|  24.6k|#define				FILE_BELONG		8
  ------------------
  |  Branch (658:4): [True: 24.3k, False: 109k]
  ------------------
  659|  33.4k|  	case FILE_LELONG:
  ------------------
  |  |  256|  33.4k|#define				FILE_LELONG		11
  ------------------
  |  Branch (659:4): [True: 8.72k, False: 125k]
  ------------------
  660|  33.4k|  	case FILE_MELONG:
  ------------------
  |  |  268|  33.4k|#define				FILE_MELONG		23
  ------------------
  |  Branch (660:4): [True: 21, False: 134k]
  ------------------
  661|  33.4k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  619|  33.4k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  33.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  620|  33.4k|	switch (check_fmt(ms, desc)) { \
  |  |  621|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (621:2): [True: 0, False: 33.4k]
  |  |  ------------------
  |  |  622|      0|		return -1; \
  |  |  623|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (623:2): [True: 0, False: 33.4k]
  |  |  ------------------
  |  |  624|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (624:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  625|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  626|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  627|      0|		} else { \
  |  |  628|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  629|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  630|      0|		} \
  |  |  631|      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 (631:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  632|      0|			return -1; \
  |  |  633|      0|		break; \
  |  |  634|  33.4k|	default: \
  |  |  ------------------
  |  |  |  Branch (634:2): [True: 33.4k, False: 0]
  |  |  ------------------
  |  |  635|  33.4k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  33.4k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (635:7): [True: 7.58k, False: 25.8k]
  |  |  ------------------
  |  |  636|  7.58k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  7.58k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (636:14): [True: 0, False: 7.58k]
  |  |  ------------------
  |  |  637|  7.58k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  7.58k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  638|  7.58k|			   return -1; \
  |  |  639|  25.8k|		} else { \
  |  |  640|  25.8k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  25.8k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (640:14): [True: 0, False: 25.8k]
  |  |  ------------------
  |  |  641|  25.8k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  25.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  642|  25.8k|			   return -1; \
  |  |  643|  25.8k|		} \
  |  |  644|  33.4k|		break; \
  |  |  645|  33.4k|	} \
  |  |  646|  33.4k|	break
  ------------------
  662|       |
  663|  33.4k|  	case FILE_QUAD:
  ------------------
  |  |  269|    231|#define				FILE_QUAD		24
  ------------------
  |  Branch (663:4): [True: 231, False: 133k]
  ------------------
  664|  1.12k|  	case FILE_BEQUAD:
  ------------------
  |  |  271|  1.12k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (664:4): [True: 890, False: 133k]
  ------------------
  665|  1.24k|  	case FILE_LEQUAD:
  ------------------
  |  |  270|  1.24k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (665:4): [True: 127, False: 133k]
  ------------------
  666|  2.06k|	case FILE_OFFSET:
  ------------------
  |  |  297|  2.06k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (666:2): [True: 813, False: 133k]
  ------------------
  667|  2.06k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  619|  2.06k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  452|  2.06k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  620|  2.06k|	switch (check_fmt(ms, desc)) { \
  |  |  621|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (621:2): [True: 0, False: 2.06k]
  |  |  ------------------
  |  |  622|      0|		return -1; \
  |  |  623|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (623:2): [True: 0, False: 2.06k]
  |  |  ------------------
  |  |  624|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (624:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  625|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  626|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  627|      0|		} else { \
  |  |  628|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  629|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  452|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  630|      0|		} \
  |  |  631|      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 (631:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  632|      0|			return -1; \
  |  |  633|      0|		break; \
  |  |  634|  2.06k|	default: \
  |  |  ------------------
  |  |  |  Branch (634:2): [True: 2.06k, False: 0]
  |  |  ------------------
  |  |  635|  2.06k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  229|  2.06k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (635:7): [True: 880, False: 1.18k]
  |  |  ------------------
  |  |  636|    880|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|    880|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (636:14): [True: 0, False: 880]
  |  |  ------------------
  |  |  637|    880|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|    880|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  638|    880|			   return -1; \
  |  |  639|  1.18k|		} else { \
  |  |  640|  1.18k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  1.18k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (640:14): [True: 0, False: 1.18k]
  |  |  ------------------
  |  |  641|  1.18k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  452|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  642|  1.18k|			   return -1; \
  |  |  643|  1.18k|		} \
  |  |  644|  2.06k|		break; \
  |  |  645|  2.06k|	} \
  |  |  646|  2.06k|	break
  ------------------
  668|       |
  669|  36.3k|  	case FILE_STRING:
  ------------------
  |  |  250|  36.3k|#define				FILE_STRING		5
  ------------------
  |  Branch (669:4): [True: 36.3k, False: 97.7k]
  ------------------
  670|  37.6k|  	case FILE_PSTRING:
  ------------------
  |  |  258|  37.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (670:4): [True: 1.26k, False: 132k]
  ------------------
  671|  37.9k|  	case FILE_BESTRING16:
  ------------------
  |  |  263|  37.9k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (671:4): [True: 299, False: 133k]
  ------------------
  672|  38.4k|  	case FILE_LESTRING16:
  ------------------
  |  |  264|  38.4k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (672:4): [True: 506, False: 133k]
  ------------------
  673|  38.4k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (673:7): [True: 19.8k, False: 18.6k]
  |  Branch (673:25): [True: 296, False: 18.3k]
  ------------------
  674|  20.0k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  20.0k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (674:8): [True: 0, False: 20.0k]
  ------------------
  675|  20.0k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  676|  20.0k|			    sizeof(m->value.s))) == -1)
  677|      0|				return -1;
  678|  20.0k|		}
  679|  18.3k|		else {
  680|  18.3k|			char *str = p->s;
  681|       |
  682|       |			/* compute t before we mangle the string? */
  683|       |
  684|  18.3k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (684:8): [True: 18.2k, False: 115]
  ------------------
  685|  18.2k|				str[strcspn(str, "\r\n")] = '\0';
  686|       |
  687|  18.3k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  382|  18.3k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  413|  18.3k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  395|  18.3k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (687:8): [True: 259, False: 18.0k]
  ------------------
  688|    259|				str = file_strtrim(str);
  689|       |
  690|  18.3k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  18.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (690:8): [True: 0, False: 18.3k]
  ------------------
  691|  18.3k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  692|  18.3k|				sizeof(p->s) - (str - p->s))) == -1)
  693|      0|				return -1;
  694|       |
  695|  18.3k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  258|  18.3k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (695:8): [True: 1.26k, False: 17.0k]
  ------------------
  696|  1.26k|				size_t l = file_pstring_length_size(ms, m);
  697|  1.26k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.26k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  1.26k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (697:9): [True: 0, False: 1.26k]
  ------------------
  698|      0|					return -1;
  699|  1.26k|			}
  700|  18.3k|		}
  701|  38.4k|		break;
  702|       |
  703|  38.4k|	case FILE_DATE:
  ------------------
  |  |  251|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (703:2): [True: 0, False: 134k]
  ------------------
  704|     79|	case FILE_BEDATE:
  ------------------
  |  |  254|     79|#define				FILE_BEDATE		9
  ------------------
  |  Branch (704:2): [True: 79, False: 134k]
  ------------------
  705|    213|	case FILE_LEDATE:
  ------------------
  |  |  257|    213|#define				FILE_LEDATE		12
  ------------------
  |  Branch (705:2): [True: 134, False: 133k]
  ------------------
  706|    238|	case FILE_MEDATE:
  ------------------
  |  |  266|    238|#define				FILE_MEDATE		21
  ------------------
  |  Branch (706:2): [True: 25, False: 134k]
  ------------------
  707|    238|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    238|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (707:7): [True: 0, False: 238]
  ------------------
  708|    238|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  709|      0|			return -1;
  710|    238|		break;
  711|       |
  712|    238|	case FILE_LDATE:
  ------------------
  |  |  259|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (712:2): [True: 0, False: 134k]
  ------------------
  713|    263|	case FILE_BELDATE:
  ------------------
  |  |  260|    263|#define				FILE_BELDATE		15
  ------------------
  |  Branch (713:2): [True: 263, False: 133k]
  ------------------
  714|    263|	case FILE_LELDATE:
  ------------------
  |  |  261|    263|#define				FILE_LELDATE		16
  ------------------
  |  Branch (714:2): [True: 0, False: 134k]
  ------------------
  715|    263|	case FILE_MELDATE:
  ------------------
  |  |  267|    263|#define				FILE_MELDATE		22
  ------------------
  |  Branch (715:2): [True: 0, False: 134k]
  ------------------
  716|    263|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    263|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (716:7): [True: 0, False: 263]
  ------------------
  717|    263|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  540|    263|#define FILE_T_LOCAL	1
  ------------------
  718|    263|			== -1)
  719|      0|			return -1;
  720|    263|		break;
  721|       |
  722|    263|	case FILE_QDATE:
  ------------------
  |  |  272|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (722:2): [True: 0, False: 134k]
  ------------------
  723|    556|	case FILE_BEQDATE:
  ------------------
  |  |  274|    556|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (723:2): [True: 556, False: 133k]
  ------------------
  724|    556|	case FILE_LEQDATE:
  ------------------
  |  |  273|    556|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (724:2): [True: 0, False: 134k]
  ------------------
  725|    556|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    556|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (725:7): [True: 0, False: 556]
  ------------------
  726|    556|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  727|      0|			return -1;
  728|    556|		break;
  729|       |
  730|    556|	case FILE_QLDATE:
  ------------------
  |  |  275|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (730:2): [True: 0, False: 134k]
  ------------------
  731|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  277|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (731:2): [True: 0, False: 134k]
  ------------------
  732|     13|	case FILE_LEQLDATE:
  ------------------
  |  |  276|     13|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (732:2): [True: 13, False: 134k]
  ------------------
  733|     13|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|     13|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (733:7): [True: 0, False: 13]
  ------------------
  734|     13|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  540|     13|#define FILE_T_LOCAL	1
  ------------------
  735|      0|			return -1;
  736|     13|		break;
  737|       |
  738|    160|	case FILE_QWDATE:
  ------------------
  |  |  287|    160|#define				FILE_QWDATE		42
  ------------------
  |  Branch (738:2): [True: 160, False: 133k]
  ------------------
  739|    160|	case FILE_BEQWDATE:
  ------------------
  |  |  289|    160|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (739:2): [True: 0, False: 134k]
  ------------------
  740|    922|	case FILE_LEQWDATE:
  ------------------
  |  |  288|    922|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (740:2): [True: 762, False: 133k]
  ------------------
  741|    922|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    922|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (741:7): [True: 0, False: 922]
  ------------------
  742|    922|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  541|    922|#define FILE_T_WINDOWS	2
  ------------------
  743|    922|		    == -1)
  744|      0|			return -1;
  745|    922|		break;
  746|       |
  747|    922|	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (747:2): [True: 0, False: 134k]
  ------------------
  748|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (748:2): [True: 0, False: 134k]
  ------------------
  749|    560|	case FILE_LEFLOAT:
  ------------------
  |  |  280|    560|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (749:2): [True: 560, False: 133k]
  ------------------
  750|    560|		vf = p->f;
  751|    560|		switch (check_fmt(ms, desc)) {
  752|      0|		case -1:
  ------------------
  |  Branch (752:3): [True: 0, False: 560]
  ------------------
  753|      0|			return -1;
  754|      0|		case 1:
  ------------------
  |  Branch (754:3): [True: 0, False: 560]
  ------------------
  755|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  756|      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 (756:8): [True: 0, False: 0]
  ------------------
  757|      0|				return -1;
  758|      0|			break;
  759|    560|		default:
  ------------------
  |  Branch (759:3): [True: 560, False: 0]
  ------------------
  760|    560|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  167|    560|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (760:8): [True: 0, False: 560]
  ------------------
  761|      0|				return -1;
  762|    560|			break;
  763|    560|		}
  764|    560|  		break;
  765|       |
  766|    560|	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (766:2): [True: 0, False: 134k]
  ------------------
  767|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (767:2): [True: 0, False: 134k]
  ------------------
  768|    282|	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    282|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (768:2): [True: 282, False: 133k]
  ------------------
  769|    282|		vd = p->d;
  770|    282|		switch (check_fmt(ms, desc)) {
  771|      0|		case -1:
  ------------------
  |  Branch (771:3): [True: 0, False: 282]
  ------------------
  772|      0|			return -1;
  773|      0|		case 1:
  ------------------
  |  Branch (773:3): [True: 0, False: 282]
  ------------------
  774|      0|			(void)snprintf(buf, sizeof(buf), "%g", vd);
  775|      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 (775:8): [True: 0, False: 0]
  ------------------
  776|      0|				return -1;
  777|      0|			break;
  778|    282|		default:
  ------------------
  |  Branch (778:3): [True: 282, False: 0]
  ------------------
  779|    282|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  167|    282|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (779:8): [True: 0, False: 282]
  ------------------
  780|      0|				return -1;
  781|    282|			break;
  782|    282|		}
  783|    282|  		break;
  784|       |
  785|    317|	case FILE_SEARCH:
  ------------------
  |  |  265|    317|#define				FILE_SEARCH		20
  ------------------
  |  Branch (785:2): [True: 317, False: 133k]
  ------------------
  786|    676|	case FILE_REGEX: {
  ------------------
  |  |  262|    676|#define				FILE_REGEX		17
  ------------------
  |  Branch (786:2): [True: 359, False: 133k]
  ------------------
  787|    676|		char *cp, *scp;
  788|    676|		int rval;
  789|       |
  790|    676|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  453|    676|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  791|    676|		    ms->search.rm_len);
  792|    676|		if (cp == NULL) {
  ------------------
  |  Branch (792:7): [True: 0, False: 676]
  ------------------
  793|      0|			file_oomem(ms, ms->search.rm_len);
  794|      0|			return -1;
  795|      0|		}
  796|    676|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  382|    676|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  413|    676|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  395|    676|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (796:9): [True: 14, False: 662]
  ------------------
  797|       |
  798|    676|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  167|    676|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  799|    676|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  800|    676|		free(cp);
  801|       |
  802|    676|		if (rval == -1)
  ------------------
  |  Branch (802:7): [True: 0, False: 676]
  ------------------
  803|      0|			return -1;
  804|    676|		break;
  805|    676|	}
  806|       |
  807|  1.88k|	case FILE_DEFAULT:
  ------------------
  |  |  248|  1.88k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (807:2): [True: 1.88k, False: 132k]
  ------------------
  808|  2.33k|	case FILE_CLEAR:
  ------------------
  |  |  292|  2.33k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (808:2): [True: 450, False: 133k]
  ------------------
  809|  2.33k|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (809:9): [True: 0, False: 2.33k]
  ------------------
  810|      0|			return -1;
  811|  2.33k|		break;
  812|       |
  813|  3.25k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  3.25k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (813:2): [True: 3.25k, False: 130k]
  ------------------
  814|  3.31k|	case FILE_USE:
  ------------------
  |  |  291|  3.31k|#define				FILE_USE		46
  ------------------
  |  Branch (814:2): [True: 56, False: 134k]
  ------------------
  815|  11.6k|	case FILE_NAME:
  ------------------
  |  |  290|  11.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (815:2): [True: 8.33k, False: 125k]
  ------------------
  816|  11.6k|		break;
  817|    172|	case FILE_DER:
  ------------------
  |  |  293|    172|#define				FILE_DER		48
  ------------------
  |  Branch (817:2): [True: 172, False: 133k]
  ------------------
  818|    172|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    172|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (818:7): [True: 0, False: 172]
  ------------------
  819|    172|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  820|    172|			sizeof(ms->ms_value.s))) == -1)
  821|      0|			return -1;
  822|    172|		break;
  823|    275|	case FILE_GUID:
  ------------------
  |  |  294|    275|#define				FILE_GUID		49
  ------------------
  |  Branch (823:2): [True: 275, False: 133k]
  ------------------
  824|    275|	case FILE_LEGUID:
  ------------------
  |  |  295|    275|#define				FILE_LEGUID		50
  ------------------
  |  Branch (824:2): [True: 0, False: 134k]
  ------------------
  825|    275|		(void) file_print_leguid(buf, sizeof(buf), ms->ms_value.guid);
  826|    275|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|    275|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (826:7): [True: 0, False: 275]
  ------------------
  827|      0|			return -1;
  828|    275|		break;
  829|    275|	case FILE_BEGUID:
  ------------------
  |  |  296|      0|#define				FILE_BEGUID		51
  ------------------
  |  Branch (829:2): [True: 0, False: 134k]
  ------------------
  830|      0|		(void) file_print_beguid(buf, sizeof(buf), ms->ms_value.guid);
  831|      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 (831:7): [True: 0, False: 0]
  ------------------
  832|      0|			return -1;
  833|      0|		break;
  834|      0|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|      0|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (834:2): [True: 0, False: 134k]
  ------------------
  835|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (835:2): [True: 0, False: 134k]
  ------------------
  836|    236|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|    236|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (836:2): [True: 236, False: 133k]
  ------------------
  837|    236|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    236|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (837:7): [True: 0, False: 236]
  ------------------
  838|    236|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  839|      0|			return -1;
  840|    236|		break;
  841|    236|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|      0|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (841:2): [True: 0, False: 134k]
  ------------------
  842|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (842:2): [True: 0, False: 134k]
  ------------------
  843|    236|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|    236|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (843:2): [True: 236, False: 133k]
  ------------------
  844|    236|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    236|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (844:7): [True: 0, False: 236]
  ------------------
  845|    236|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  846|      0|			return -1;
  847|    236|		break;
  848|    236|	case FILE_OCTAL:
  ------------------
  |  |  306|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (848:2): [True: 0, False: 134k]
  ------------------
  849|      0|		file_fmtnum(buf, sizeof(buf), m->value.s, 8);
  850|      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 (850:7): [True: 0, False: 0]
  ------------------
  851|      0|			return -1;
  852|      0|		break;
  853|      0|	default:
  ------------------
  |  Branch (853:2): [True: 0, False: 134k]
  ------------------
  854|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  855|      0|		return -1;
  856|   134k|	}
  857|   134k|	return 0;
  858|   134k|}
softmagic.c:check_fmt:
  509|  78.0k|{
  510|  78.0k|	file_regex_t rx;
  511|  78.0k|	int rc, rv = -1;
  512|  78.0k|        const char* pat = "%[-0-9\\.]*s";
  513|       |
  514|  78.0k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (514:6): [True: 50.0k, False: 28.0k]
  ------------------
  515|  50.0k|		return 0;
  516|       |
  517|  28.0k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  518|  28.0k|	if (rc == 0) {
  ------------------
  |  Branch (518:6): [True: 28.0k, False: 0]
  ------------------
  519|  28.0k|		rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
  520|  28.0k|		rv = !rc;
  521|  28.0k|	}
  522|  28.0k|	file_regfree(&rx);
  523|  28.0k|	return rv;
  524|  78.0k|}
softmagic.c:moffset:
  863|   731k|{
  864|   731k|	int32_t o;
  865|   731k|	size_t vlen;
  866|       |
  867|   731k|  	switch (m->type) {
  868|   204k|  	case FILE_BYTE:
  ------------------
  |  |  246|   204k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (868:4): [True: 204k, False: 526k]
  ------------------
  869|   204k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  452|   204k|#define CAST(T, b)	((T)(b))
  ------------------
  870|   204k|		break;
  871|       |
  872|  16.2k|  	case FILE_SHORT:
  ------------------
  |  |  247|  16.2k|#define				FILE_SHORT		2
  ------------------
  |  Branch (872:4): [True: 16.2k, False: 714k]
  ------------------
  873|  66.9k|  	case FILE_BESHORT:
  ------------------
  |  |  252|  66.9k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (873:4): [True: 50.6k, False: 680k]
  ------------------
  874|   120k|  	case FILE_LESHORT:
  ------------------
  |  |  255|   120k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (874:4): [True: 53.5k, False: 677k]
  ------------------
  875|   120k|	case FILE_MSDOSDATE:
  ------------------
  |  |  300|   120k|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (875:2): [True: 0, False: 731k]
  ------------------
  876|   120k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  301|   120k|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (876:2): [True: 236, False: 730k]
  ------------------
  877|   120k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  302|   120k|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (877:2): [True: 0, False: 731k]
  ------------------
  878|   120k|	case FILE_MSDOSTIME:
  ------------------
  |  |  303|   120k|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (878:2): [True: 0, False: 731k]
  ------------------
  879|   120k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  304|   120k|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (879:2): [True: 236, False: 730k]
  ------------------
  880|   120k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  305|   120k|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (880:2): [True: 0, False: 731k]
  ------------------
  881|   120k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  452|   120k|#define CAST(T, b)	((T)(b))
  ------------------
  882|   120k|		break;
  883|       |
  884|  4.22k|  	case FILE_LONG:
  ------------------
  |  |  249|  4.22k|#define				FILE_LONG		4
  ------------------
  |  Branch (884:4): [True: 4.22k, False: 726k]
  ------------------
  885|  91.0k|  	case FILE_BELONG:
  ------------------
  |  |  253|  91.0k|#define				FILE_BELONG		8
  ------------------
  |  Branch (885:4): [True: 86.8k, False: 644k]
  ------------------
  886|   127k|  	case FILE_LELONG:
  ------------------
  |  |  256|   127k|#define				FILE_LELONG		11
  ------------------
  |  Branch (886:4): [True: 36.5k, False: 694k]
  ------------------
  887|   127k|  	case FILE_MELONG:
  ------------------
  |  |  268|   127k|#define				FILE_MELONG		23
  ------------------
  |  Branch (887:4): [True: 21, False: 731k]
  ------------------
  888|   127k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  452|   127k|#define CAST(T, b)	((T)(b))
  ------------------
  889|   127k|		break;
  890|       |
  891|  26.5k|  	case FILE_QUAD:
  ------------------
  |  |  269|  26.5k|#define				FILE_QUAD		24
  ------------------
  |  Branch (891:4): [True: 26.5k, False: 704k]
  ------------------
  892|  33.0k|  	case FILE_BEQUAD:
  ------------------
  |  |  271|  33.0k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (892:4): [True: 6.45k, False: 724k]
  ------------------
  893|  33.9k|  	case FILE_LEQUAD:
  ------------------
  |  |  270|  33.9k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (893:4): [True: 946, False: 730k]
  ------------------
  894|  33.9k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  452|  33.9k|#define CAST(T, b)	((T)(b))
  ------------------
  895|  33.9k|		break;
  896|       |
  897|  79.3k|  	case FILE_STRING:
  ------------------
  |  |  250|  79.3k|#define				FILE_STRING		5
  ------------------
  |  Branch (897:4): [True: 79.3k, False: 651k]
  ------------------
  898|  80.6k|  	case FILE_PSTRING:
  ------------------
  |  |  258|  80.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (898:4): [True: 1.27k, False: 729k]
  ------------------
  899|  80.9k|  	case FILE_BESTRING16:
  ------------------
  |  |  263|  80.9k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (899:4): [True: 299, False: 730k]
  ------------------
  900|  81.4k|  	case FILE_LESTRING16:
  ------------------
  |  |  264|  81.4k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (900:4): [True: 506, False: 730k]
  ------------------
  901|  81.4k|	case FILE_OCTAL:
  ------------------
  |  |  306|  81.4k|#define				FILE_OCTAL		61
  ------------------
  |  Branch (901:2): [True: 0, False: 731k]
  ------------------
  902|  81.4k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (902:7): [True: 29.4k, False: 51.9k]
  |  Branch (902:25): [True: 1.48k, False: 50.5k]
  ------------------
  903|  30.9k|			o = ms->offset + m->vallen;
  904|  50.5k|		} else {
  905|  50.5k|			union VALUETYPE *p = &ms->ms_value;
  906|       |
  907|  50.5k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (907:8): [True: 43.6k, False: 6.82k]
  ------------------
  908|  43.6k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  909|  50.5k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  452|  50.5k|#define CAST(T, b)	((T)(b))
  ------------------
  910|  50.5k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  258|  50.5k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (910:8): [True: 1.27k, False: 49.2k]
  ------------------
  911|  1.27k|				size_t l = file_pstring_length_size(ms, m);
  912|  1.27k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.27k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  452|  1.27k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (912:9): [True: 0, False: 1.27k]
  ------------------
  913|      0|					return -1;
  914|  1.27k|				o += CAST(uint32_t, l);
  ------------------
  |  |  452|  1.27k|#define CAST(T, b)	((T)(b))
  ------------------
  915|  1.27k|			}
  916|  50.5k|		}
  917|  81.4k|		break;
  918|       |
  919|  81.4k|	case FILE_DATE:
  ------------------
  |  |  251|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (919:2): [True: 0, False: 731k]
  ------------------
  920|     79|	case FILE_BEDATE:
  ------------------
  |  |  254|     79|#define				FILE_BEDATE		9
  ------------------
  |  Branch (920:2): [True: 79, False: 731k]
  ------------------
  921|    213|	case FILE_LEDATE:
  ------------------
  |  |  257|    213|#define				FILE_LEDATE		12
  ------------------
  |  Branch (921:2): [True: 134, False: 731k]
  ------------------
  922|    238|	case FILE_MEDATE:
  ------------------
  |  |  266|    238|#define				FILE_MEDATE		21
  ------------------
  |  Branch (922:2): [True: 25, False: 731k]
  ------------------
  923|    238|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  452|    238|#define CAST(T, b)	((T)(b))
  ------------------
  924|    238|		break;
  925|       |
  926|      0|	case FILE_LDATE:
  ------------------
  |  |  259|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (926:2): [True: 0, False: 731k]
  ------------------
  927|    263|	case FILE_BELDATE:
  ------------------
  |  |  260|    263|#define				FILE_BELDATE		15
  ------------------
  |  Branch (927:2): [True: 263, False: 730k]
  ------------------
  928|    263|	case FILE_LELDATE:
  ------------------
  |  |  261|    263|#define				FILE_LELDATE		16
  ------------------
  |  Branch (928:2): [True: 0, False: 731k]
  ------------------
  929|    263|	case FILE_MELDATE:
  ------------------
  |  |  267|    263|#define				FILE_MELDATE		22
  ------------------
  |  Branch (929:2): [True: 0, False: 731k]
  ------------------
  930|    263|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  452|    263|#define CAST(T, b)	((T)(b))
  ------------------
  931|    263|		break;
  932|       |
  933|      0|	case FILE_QDATE:
  ------------------
  |  |  272|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (933:2): [True: 0, False: 731k]
  ------------------
  934|    556|	case FILE_BEQDATE:
  ------------------
  |  |  274|    556|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (934:2): [True: 556, False: 730k]
  ------------------
  935|    556|	case FILE_LEQDATE:
  ------------------
  |  |  273|    556|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (935:2): [True: 0, False: 731k]
  ------------------
  936|    556|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  452|    556|#define CAST(T, b)	((T)(b))
  ------------------
  937|    556|		break;
  938|       |
  939|      0|	case FILE_QLDATE:
  ------------------
  |  |  275|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (939:2): [True: 0, False: 731k]
  ------------------
  940|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  277|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (940:2): [True: 0, False: 731k]
  ------------------
  941|     13|	case FILE_LEQLDATE:
  ------------------
  |  |  276|     13|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (941:2): [True: 13, False: 731k]
  ------------------
  942|     13|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  452|     13|#define CAST(T, b)	((T)(b))
  ------------------
  943|     13|		break;
  944|       |
  945|      0|  	case FILE_FLOAT:
  ------------------
  |  |  278|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (945:4): [True: 0, False: 731k]
  ------------------
  946|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  279|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (946:4): [True: 0, False: 731k]
  ------------------
  947|    560|  	case FILE_LEFLOAT:
  ------------------
  |  |  280|    560|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (947:4): [True: 560, False: 730k]
  ------------------
  948|    560|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  452|    560|#define CAST(T, b)	((T)(b))
  ------------------
  949|    560|		break;
  950|       |
  951|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  281|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (951:4): [True: 0, False: 731k]
  ------------------
  952|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  282|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (952:4): [True: 0, False: 731k]
  ------------------
  953|    282|  	case FILE_LEDOUBLE:
  ------------------
  |  |  283|    282|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (953:4): [True: 282, False: 730k]
  ------------------
  954|    282|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  452|    282|#define CAST(T, b)	((T)(b))
  ------------------
  955|    282|		break;
  956|       |
  957|    884|	case FILE_REGEX:
  ------------------
  |  |  262|    884|#define				FILE_REGEX		17
  ------------------
  |  Branch (957:2): [True: 884, False: 730k]
  ------------------
  958|       |		/* Why is regex and search different? */
  959|    884|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  382|    884|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  400|    884|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  395|    884|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (959:10): [True: 815, False: 69]
  ------------------
  960|    815|		    ms->search.rm_len : 0;
  961|    884|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  452|    884|#define CAST(T, b)	((T)(b))
  ------------------
  962|    884|		break;
  963|       |
  964|  6.64k|	case FILE_SEARCH:
  ------------------
  |  |  265|  6.64k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (964:2): [True: 6.64k, False: 724k]
  ------------------
  965|  6.64k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  382|  6.64k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  400|  6.64k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  395|  6.64k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (965:10): [True: 6.43k, False: 208]
  ------------------
  966|  6.64k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  452|  6.64k|#define CAST(T, b)	((T)(b))
  ------------------
  967|  6.64k|		break;
  968|       |
  969|  3.22k|	case FILE_CLEAR:
  ------------------
  |  |  292|  3.22k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (969:2): [True: 3.22k, False: 727k]
  ------------------
  970|  13.2k|	case FILE_DEFAULT:
  ------------------
  |  |  248|  13.2k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (970:2): [True: 9.98k, False: 721k]
  ------------------
  971|  25.2k|	case FILE_INDIRECT:
  ------------------
  |  |  286|  25.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (971:2): [True: 12.0k, False: 719k]
  ------------------
  972|  26.1k|	case FILE_OFFSET:
  ------------------
  |  |  297|  26.1k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (972:2): [True: 885, False: 730k]
  ------------------
  973|  61.8k|	case FILE_USE:
  ------------------
  |  |  291|  61.8k|#define				FILE_USE		46
  ------------------
  |  Branch (973:2): [True: 35.7k, False: 695k]
  ------------------
  974|  61.8k|		o = ms->offset;
  975|  61.8k|		break;
  976|       |
  977|  28.8k|	case FILE_DER:
  ------------------
  |  |  293|  28.8k|#define				FILE_DER		48
  ------------------
  |  Branch (977:2): [True: 28.8k, False: 702k]
  ------------------
  978|  28.8k|		o = der_offs(ms, m, nbytes);
  979|  28.8k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  452|  28.8k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (979:7): [True: 0, False: 28.8k]
  |  Branch (979:18): [True: 0, False: 28.8k]
  ------------------
  980|      0|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (980:8): [True: 0, False: 0]
  ------------------
  981|      0|				(void)fprintf(stderr,
  982|      0|				    "Bad DER offset %d nbytes=%"
  983|      0|				    SIZE_T_FORMAT "u", o, nbytes);
  984|      0|			}
  985|      0|			*op = 0;
  986|      0|			return 0;
  987|      0|		}
  988|  28.8k|		break;
  989|       |
  990|  28.8k|	case FILE_BEGUID:
  ------------------
  |  |  296|      0|#define				FILE_BEGUID		51
  ------------------
  |  Branch (990:2): [True: 0, False: 731k]
  ------------------
  991|      0|	case FILE_LEGUID:
  ------------------
  |  |  295|      0|#define				FILE_LEGUID		50
  ------------------
  |  Branch (991:2): [True: 0, False: 731k]
  ------------------
  992|    275|	case FILE_GUID:
  ------------------
  |  |  294|    275|#define				FILE_GUID		49
  ------------------
  |  Branch (992:2): [True: 275, False: 730k]
  ------------------
  993|    275|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  452|    275|#define CAST(T, b)	((T)(b))
  ------------------
  994|    275|		break;
  995|       |
  996|  62.1k|	default:
  ------------------
  |  Branch (996:2): [True: 62.1k, False: 669k]
  ------------------
  997|  62.1k|		o = 0;
  998|  62.1k|		break;
  999|   731k|	}
 1000|       |
 1001|   731k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  452|   731k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1001:6): [True: 27.5k, False: 703k]
  ------------------
 1002|       |#if 0
 1003|       |		file_error(ms, 0, "Offset out of range %" SIZE_T_FORMAT
 1004|       |		    "u > %" SIZE_T_FORMAT "u", (size_t)o, nbytes);
 1005|       |#endif
 1006|  27.5k|		return -1;
 1007|  27.5k|	}
 1008|   703k|	*op = o;
 1009|   703k|	return 1;
 1010|   731k|}

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

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

LLVMFuzzerInitialize:
   42|      2|extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
   43|      2|  char* exe_path = (*argv)[0];
   44|       |  // dirname() can modify its argument.
   45|      2|  char* exe_path_copy = strdup(exe_path);
   46|      2|  char* dir = dirname(exe_path_copy);
   47|      2|  env = new Environment(dir);
   48|      2|  free(exe_path_copy);
   49|      2|  return 0;
   50|      2|}
LLVMFuzzerTestOneInput:
   52|  10.5k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   53|  10.5k|  FuzzerTemporaryFile ftf (data, size);
   54|       |  int fd = open(ftf.filename(), O_RDONLY);
   55|  10.5k|  magic_descriptor(env->magic, fd);
   56|  10.5k|  close(fd);
   57|  10.5k|  return 0;
   58|  10.5k|}
_ZN11EnvironmentC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   28|      2|  Environment(std::string data_dir) {
   29|      2|    magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE|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|  }

