file_ms_alloc:
  541|      2|{
  542|      2|	struct magic_set *ms;
  543|      2|	size_t i, len;
  544|       |
  545|      2|	if ((ms = CAST(struct magic_set *, calloc(CAST(size_t, 1u),
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (545:6): [True: 0, False: 2]
  ------------------
  546|      2|	    sizeof(*ms)))) == NULL)
  547|      0|		return NULL;
  548|       |
  549|      2|	if (magic_setflags(ms, flags) == -1) {
  ------------------
  |  Branch (549:6): [True: 0, False: 2]
  ------------------
  550|      0|		errno = EINVAL;
  551|      0|		goto free;
  552|      0|	}
  553|       |
  554|      2|	ms->o.buf = ms->o.pbuf = NULL;
  555|      2|	ms->o.blen = 0;
  556|      2|	len = (ms->c.len = 10) * sizeof(*ms->c.li);
  557|       |
  558|      2|	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (558:6): [True: 0, False: 2]
  ------------------
  559|      0|		goto free;
  560|       |
  561|      2|	ms->event_flags = 0;
  562|      2|	ms->error = -1;
  563|      6|	for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  479|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (563:14): [True: 4, False: 2]
  ------------------
  564|      4|		ms->mlist[i] = NULL;
  565|      2|	ms->fnamebuf = NULL;
  566|      2|	ms->file = "unknown";
  567|      2|	ms->line = 0;
  568|      2|	ms->magwarn = 0;
  569|      2|	ms->indir_max = FILE_INDIR_MAX;
  ------------------
  |  |  530|      2|#define	FILE_INDIR_MAX			50
  ------------------
  570|      2|	ms->name_max = FILE_NAME_MAX;
  ------------------
  |  |  531|      2|#define	FILE_NAME_MAX			150
  ------------------
  571|      2|	ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
  ------------------
  |  |  528|      2|#define	FILE_ELF_SHNUM_MAX		32768
  ------------------
  572|      2|	ms->elf_shsize_max = FILE_ELF_SHSIZE_MAX;
  ------------------
  |  |  529|      2|#define	FILE_ELF_SHSIZE_MAX		(128 * 1024 * 1024)
  ------------------
  573|      2|	ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
  ------------------
  |  |  527|      2|#define	FILE_ELF_PHNUM_MAX		2048
  ------------------
  574|      2|	ms->elf_notes_max = FILE_ELF_NOTES_MAX;
  ------------------
  |  |  526|      2|#define	FILE_ELF_NOTES_MAX		256
  ------------------
  575|      2|	ms->regex_max = FILE_REGEX_MAX;
  ------------------
  |  |  532|      2|#define	FILE_REGEX_MAX			8192
  ------------------
  576|      2|	ms->bytes_max = FILE_BYTES_MAX;
  ------------------
  |  |  524|      2|# define FILE_BYTES_MAX (7 * 1024 * 1024)/* how much of the file to look at */
  ------------------
  577|      2|	ms->encoding_max = FILE_ENCODING_MAX;
  ------------------
  |  |  533|      2|#define	FILE_ENCODING_MAX		(64 * 1024)
  ------------------
  578|      2|	ms->magwarn_max = FILE_MAGWARN_MAX;
  ------------------
  |  |  534|      2|#define	FILE_MAGWARN_MAX		64
  ------------------
  579|      2|#ifdef USE_C_LOCALE
  580|      2|	ms->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
  581|      2|	assert(ms->c_lc_ctype != NULL);
  ------------------
  |  Branch (581:2): [True: 0, False: 2]
  |  Branch (581:2): [True: 2, False: 0]
  ------------------
  582|      2|#endif
  583|      2|	return ms;
  584|      0|free:
  585|      0|	free(ms);
  586|       |	return NULL;
  587|      2|}
file_apprentice:
  728|      2|{
  729|      2|	char *p, *sfn;
  730|      2|	int fileerr, errs = -1;
  731|      2|	size_t i, j;
  732|       |
  733|      2|	(void)file_reset(ms, 0);
  734|       |
  735|      2|	if ((fn = magic_getpath(fn, action)) == NULL)
  ------------------
  |  Branch (735:6): [True: 0, False: 2]
  ------------------
  736|      0|		return -1;
  737|       |
  738|      2|	init_file_tables();
  739|       |
  740|      2|	free(ms->fnamebuf);
  741|      2|	ms->file = NULL;
  742|      2|	if ((ms->fnamebuf = strdup(fn)) == NULL) {
  ------------------
  |  Branch (742:6): [True: 0, False: 2]
  ------------------
  743|      0|out:		file_oomem(ms, strlen(fn));
  744|      0|		return -1;
  745|      0|	}
  746|       |
  747|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  479|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (747:14): [True: 4, False: 2]
  ------------------
  748|      4|		mlist_free(ms->mlist[i]);
  749|      4|		if ((ms->mlist[i] = mlist_alloc()) == NULL) {
  ------------------
  |  Branch (749:7): [True: 0, False: 4]
  ------------------
  750|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  751|      0|			for (j = 0; j < i; j++) {
  ------------------
  |  Branch (751:16): [True: 0, False: 0]
  ------------------
  752|      0|				mlist_free(ms->mlist[j]);
  753|      0|				ms->mlist[j] = NULL;
  754|      0|			}
  755|      0|			return -1;
  756|      0|		}
  757|      4|	}
  758|      2|	fn = sfn = strdup(ms->fnamebuf);
  759|      2|	if (fn == NULL)
  ------------------
  |  Branch (759:6): [True: 0, False: 2]
  ------------------
  760|      0|		goto out;
  761|       |
  762|      4|	while (fn) {
  ------------------
  |  Branch (762:9): [True: 2, False: 2]
  ------------------
  763|      2|		p = CCAST(char *, strchr(fn, PATHSEP));
  ------------------
  |  |  462|      2|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  764|      2|		if (p)
  ------------------
  |  Branch (764:7): [True: 0, False: 2]
  ------------------
  765|      0|			*p++ = '\0';
  766|      2|		if (*fn == '\0')
  ------------------
  |  Branch (766:7): [True: 0, False: 2]
  ------------------
  767|      0|			break;
  768|      2|		fileerr = apprentice_1(ms, fn, action);
  769|      2|		errs = MAX(errs, fileerr);
  ------------------
  |  Branch (769:10): [True: 0, False: 2]
  ------------------
  770|      2|		fn = p;
  771|      2|	}
  772|      2|	free(sfn);
  773|       |
  774|      2|	if (errs == -1) {
  ------------------
  |  Branch (774:6): [True: 0, False: 2]
  ------------------
  775|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  479|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (775:15): [True: 0, False: 0]
  ------------------
  776|      0|			mlist_free(ms->mlist[i]);
  777|      0|			ms->mlist[i] = NULL;
  778|      0|		}
  779|      0|		file_error(ms, 0, "could not find any valid magic files!");
  780|      0|		return -1;
  781|      0|	}
  782|       |
  783|       |#if 0
  784|       |	/*
  785|       |	 * Always leave the database loaded
  786|       |	 */
  787|       |	if (action == FILE_LOAD)
  788|       |		return 0;
  789|       |
  790|       |	for (i = 0; i < MAGIC_SETS; i++) {
  791|       |		mlist_free(ms->mlist[i]);
  792|       |		ms->mlist[i] = NULL;
  793|       |	}
  794|       |#endif
  795|       |
  796|      2|	switch (action) {
  797|      2|	case FILE_LOAD:
  ------------------
  |  |  195|      2|#define	FILE_LOAD	0
  ------------------
  |  Branch (797:2): [True: 2, False: 0]
  ------------------
  798|      2|	case FILE_COMPILE:
  ------------------
  |  |  197|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (798:2): [True: 0, False: 2]
  ------------------
  799|      2|	case FILE_CHECK:
  ------------------
  |  |  196|      2|#define FILE_CHECK	1
  ------------------
  |  Branch (799:2): [True: 0, False: 2]
  ------------------
  800|      2|	case FILE_LIST:
  ------------------
  |  |  198|      2|#define FILE_LIST	3
  ------------------
  |  Branch (800:2): [True: 0, False: 2]
  ------------------
  801|      2|		return 0;
  802|      0|	default:
  ------------------
  |  Branch (802:2): [True: 0, False: 2]
  ------------------
  803|      0|		file_error(ms, 0, "Invalid action %d", action);
  804|      0|		return -1;
  805|      2|	}
  806|      2|}
file_signextend:
 1663|   100M|{
 1664|   100M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  237|   100M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1664:6): [True: 94.1M, False: 6.21M]
  ------------------
 1665|  94.1M|		switch(m->type) {
 1666|       |		/*
 1667|       |		 * Do not remove the casts below.  They are
 1668|       |		 * vital.  When later compared with the data,
 1669|       |		 * the sign extension must have happened.
 1670|       |		 */
 1671|  1.04M|		case FILE_BYTE:
  ------------------
  |  |  254|  1.04M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1671:3): [True: 1.04M, False: 93.0M]
  ------------------
 1672|  1.04M|			v = CAST(signed char,  v);
  ------------------
  |  |  460|  1.04M|#define CAST(T, b)	((T)(b))
  ------------------
 1673|  1.04M|			break;
 1674|  1.79M|		case FILE_SHORT:
  ------------------
  |  |  255|  1.79M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1674:3): [True: 1.79M, False: 92.3M]
  ------------------
 1675|  5.81M|		case FILE_BESHORT:
  ------------------
  |  |  260|  5.81M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1675:3): [True: 4.01M, False: 90.1M]
  ------------------
 1676|  9.40M|		case FILE_LESHORT:
  ------------------
  |  |  263|  9.40M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1676:3): [True: 3.59M, False: 90.5M]
  ------------------
 1677|  9.40M|			v = CAST(short, v);
  ------------------
  |  |  460|  9.40M|#define CAST(T, b)	((T)(b))
  ------------------
 1678|  9.40M|			break;
 1679|      0|		case FILE_DATE:
  ------------------
  |  |  259|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1679:3): [True: 0, False: 94.1M]
  ------------------
 1680|    388|		case FILE_BEDATE:
  ------------------
  |  |  262|    388|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1680:3): [True: 388, False: 94.1M]
  ------------------
 1681|  1.14k|		case FILE_LEDATE:
  ------------------
  |  |  265|  1.14k|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1681:3): [True: 753, False: 94.1M]
  ------------------
 1682|  1.18k|		case FILE_MEDATE:
  ------------------
  |  |  274|  1.18k|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1682:3): [True: 42, False: 94.1M]
  ------------------
 1683|  1.18k|		case FILE_LDATE:
  ------------------
  |  |  267|  1.18k|#define				FILE_LDATE		14
  ------------------
  |  Branch (1683:3): [True: 0, False: 94.1M]
  ------------------
 1684|  1.47k|		case FILE_BELDATE:
  ------------------
  |  |  268|  1.47k|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1684:3): [True: 294, False: 94.1M]
  ------------------
 1685|  1.51k|		case FILE_LELDATE:
  ------------------
  |  |  269|  1.51k|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1685:3): [True: 34, False: 94.1M]
  ------------------
 1686|  1.51k|		case FILE_MELDATE:
  ------------------
  |  |  275|  1.51k|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1686:3): [True: 0, False: 94.1M]
  ------------------
 1687|  1.55M|		case FILE_LONG:
  ------------------
  |  |  257|  1.55M|#define				FILE_LONG		4
  ------------------
  |  Branch (1687:3): [True: 1.54M, False: 92.5M]
  ------------------
 1688|  13.8M|		case FILE_BELONG:
  ------------------
  |  |  261|  13.8M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1688:3): [True: 12.3M, False: 81.8M]
  ------------------
 1689|  18.5M|		case FILE_LELONG:
  ------------------
  |  |  264|  18.5M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1689:3): [True: 4.70M, False: 89.4M]
  ------------------
 1690|  18.5M|		case FILE_MELONG:
  ------------------
  |  |  276|  18.5M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1690:3): [True: 68, False: 94.1M]
  ------------------
 1691|  18.5M|		case FILE_FLOAT:
  ------------------
  |  |  286|  18.5M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1691:3): [True: 0, False: 94.1M]
  ------------------
 1692|  18.5M|		case FILE_BEFLOAT:
  ------------------
  |  |  287|  18.5M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1692:3): [True: 0, False: 94.1M]
  ------------------
 1693|  18.5M|		case FILE_LEFLOAT:
  ------------------
  |  |  288|  18.5M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1693:3): [True: 0, False: 94.1M]
  ------------------
 1694|  18.5M|		case FILE_MSDOSDATE:
  ------------------
  |  |  308|  18.5M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1694:3): [True: 0, False: 94.1M]
  ------------------
 1695|  18.5M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|  18.5M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1695:3): [True: 0, False: 94.1M]
  ------------------
 1696|  18.5M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|  18.5M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1696:3): [True: 213, False: 94.1M]
  ------------------
 1697|  18.5M|		case FILE_MSDOSTIME:
  ------------------
  |  |  311|  18.5M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1697:3): [True: 0, False: 94.1M]
  ------------------
 1698|  18.5M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|  18.5M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1698:3): [True: 0, False: 94.1M]
  ------------------
 1699|  18.5M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|  18.5M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1699:3): [True: 213, False: 94.1M]
  ------------------
 1700|  18.5M|			v = CAST(int32_t, v);
  ------------------
  |  |  460|  18.5M|#define CAST(T, b)	((T)(b))
  ------------------
 1701|  18.5M|			break;
 1702|  70.4k|		case FILE_QUAD:
  ------------------
  |  |  277|  70.4k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1702:3): [True: 70.4k, False: 94.0M]
  ------------------
 1703|   841k|		case FILE_BEQUAD:
  ------------------
  |  |  279|   841k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1703:3): [True: 770k, False: 93.3M]
  ------------------
 1704|  1.27M|		case FILE_LEQUAD:
  ------------------
  |  |  278|  1.27M|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1704:3): [True: 431k, False: 93.6M]
  ------------------
 1705|  1.27M|		case FILE_QDATE:
  ------------------
  |  |  280|  1.27M|#define				FILE_QDATE		27
  ------------------
  |  Branch (1705:3): [True: 0, False: 94.1M]
  ------------------
 1706|  1.27M|		case FILE_QLDATE:
  ------------------
  |  |  283|  1.27M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1706:3): [True: 0, False: 94.1M]
  ------------------
 1707|  1.27M|		case FILE_QWDATE:
  ------------------
  |  |  295|  1.27M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1707:3): [True: 373, False: 94.1M]
  ------------------
 1708|  1.27M|		case FILE_BEQDATE:
  ------------------
  |  |  282|  1.27M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1708:3): [True: 386, False: 94.1M]
  ------------------
 1709|  1.27M|		case FILE_BEQLDATE:
  ------------------
  |  |  285|  1.27M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1709:3): [True: 176, False: 94.1M]
  ------------------
 1710|  1.27M|		case FILE_BEQWDATE:
  ------------------
  |  |  297|  1.27M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1710:3): [True: 0, False: 94.1M]
  ------------------
 1711|  1.27M|		case FILE_LEQDATE:
  ------------------
  |  |  281|  1.27M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1711:3): [True: 0, False: 94.1M]
  ------------------
 1712|  1.27M|		case FILE_LEQLDATE:
  ------------------
  |  |  284|  1.27M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1712:3): [True: 10, False: 94.1M]
  ------------------
 1713|  1.27M|		case FILE_LEQWDATE:
  ------------------
  |  |  296|  1.27M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1713:3): [True: 1.34k, False: 94.1M]
  ------------------
 1714|  1.27M|		case FILE_DOUBLE:
  ------------------
  |  |  289|  1.27M|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1714:3): [True: 0, False: 94.1M]
  ------------------
 1715|  1.27M|		case FILE_BEDOUBLE:
  ------------------
  |  |  290|  1.27M|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1715:3): [True: 0, False: 94.1M]
  ------------------
 1716|  1.27M|		case FILE_LEDOUBLE:
  ------------------
  |  |  291|  1.27M|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1716:3): [True: 0, False: 94.1M]
  ------------------
 1717|  1.28M|		case FILE_OFFSET:
  ------------------
  |  |  305|  1.28M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1717:3): [True: 7.42k, False: 94.1M]
  ------------------
 1718|  1.28M|		case FILE_BEVARINT:
  ------------------
  |  |  306|  1.28M|#define				FILE_BEVARINT		53
  ------------------
  |  Branch (1718:3): [True: 0, False: 94.1M]
  ------------------
 1719|  1.28M|		case FILE_LEVARINT:
  ------------------
  |  |  307|  1.28M|#define				FILE_LEVARINT		54
  ------------------
  |  Branch (1719:3): [True: 0, False: 94.1M]
  ------------------
 1720|  1.28M|			v = CAST(int64_t, v);
  ------------------
  |  |  460|  1.28M|#define CAST(T, b)	((T)(b))
  ------------------
 1721|  1.28M|			break;
 1722|  62.3M|		case FILE_STRING:
  ------------------
  |  |  258|  62.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1722:3): [True: 62.3M, False: 31.8M]
  ------------------
 1723|  62.3M|		case FILE_PSTRING:
  ------------------
  |  |  266|  62.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1723:3): [True: 26.2k, False: 94.1M]
  ------------------
 1724|  62.3M|		case FILE_BESTRING16:
  ------------------
  |  |  271|  62.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1724:3): [True: 148, False: 94.1M]
  ------------------
 1725|  62.4M|		case FILE_LESTRING16:
  ------------------
  |  |  272|  62.4M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1725:3): [True: 67.8k, False: 94.0M]
  ------------------
 1726|  62.9M|		case FILE_REGEX:
  ------------------
  |  |  270|  62.9M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1726:3): [True: 493k, False: 93.6M]
  ------------------
 1727|  63.6M|		case FILE_SEARCH:
  ------------------
  |  |  273|  63.6M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1727:3): [True: 704k, False: 93.4M]
  ------------------
 1728|  63.6M|		case FILE_DEFAULT:
  ------------------
  |  |  256|  63.6M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1728:3): [True: 12.8k, False: 94.1M]
  ------------------
 1729|  63.6M|		case FILE_INDIRECT:
  ------------------
  |  |  294|  63.6M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1729:3): [True: 0, False: 94.1M]
  ------------------
 1730|  63.6M|		case FILE_NAME:
  ------------------
  |  |  298|  63.6M|#define				FILE_NAME		45
  ------------------
  |  Branch (1730:3): [True: 0, False: 94.1M]
  ------------------
 1731|  63.6M|		case FILE_USE:
  ------------------
  |  |  299|  63.6M|#define				FILE_USE		46
  ------------------
  |  Branch (1731:3): [True: 0, False: 94.1M]
  ------------------
 1732|  63.6M|		case FILE_CLEAR:
  ------------------
  |  |  300|  63.6M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1732:3): [True: 3.24k, False: 94.1M]
  ------------------
 1733|  63.6M|		case FILE_DER:
  ------------------
  |  |  301|  63.6M|#define				FILE_DER		48
  ------------------
  |  Branch (1733:3): [True: 0, False: 94.1M]
  ------------------
 1734|  63.8M|		case FILE_GUID:
  ------------------
  |  |  302|  63.8M|#define				FILE_GUID		49
  ------------------
  |  Branch (1734:3): [True: 188k, False: 93.9M]
  ------------------
 1735|  63.8M|		case FILE_LEGUID:
  ------------------
  |  |  303|  63.8M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1735:3): [True: 0, False: 94.1M]
  ------------------
 1736|  63.8M|		case FILE_BEGUID:
  ------------------
  |  |  304|  63.8M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1736:3): [True: 84, False: 94.1M]
  ------------------
 1737|  63.8M|		case FILE_OCTAL:
  ------------------
  |  |  314|  63.8M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1737:3): [True: 0, False: 94.1M]
  ------------------
 1738|  63.8M|			break;
 1739|      0|		default:
  ------------------
  |  Branch (1739:3): [True: 0, False: 94.1M]
  ------------------
 1740|      0|			if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (1740:8): [True: 0, False: 0]
  ------------------
 1741|      0|			    file_magwarn(ms, "cannot happen: m->type=%d\n",
 1742|      0|				    m->type);
 1743|      0|			return FILE_BADSIZE;
  ------------------
  |  |  183|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1744|  94.1M|		}
 1745|  94.1M|	}
 1746|   100M|	return v;
 1747|   100M|}
file_pstring_length_size:
 3640|  31.0k|{
 3641|  31.0k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  390|  31.0k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  419|  31.0k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  411|  31.0k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  31.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  414|  31.0k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  31.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  413|  31.0k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  31.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  416|  31.0k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  31.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  415|  31.0k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  31.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3642|  24.8k|	case PSTRING_1_LE:
  ------------------
  |  |  412|  24.8k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  403|  24.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3642:2): [True: 24.8k, False: 6.16k]
  ------------------
 3643|  24.8k|		return 1;
 3644|    390|	case PSTRING_2_LE:
  ------------------
  |  |  414|    390|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  403|    390|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3644:2): [True: 390, False: 30.6k]
  ------------------
 3645|  5.50k|	case PSTRING_2_BE:
  ------------------
  |  |  413|  5.50k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  403|  5.50k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3645:2): [True: 5.11k, False: 25.9k]
  ------------------
 3646|  5.50k|		return 2;
 3647|    135|	case PSTRING_4_LE:
  ------------------
  |  |  416|    135|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  403|    135|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3647:2): [True: 135, False: 30.9k]
  ------------------
 3648|    657|	case PSTRING_4_BE:
  ------------------
  |  |  415|    657|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  403|    657|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3648:2): [True: 522, False: 30.5k]
  ------------------
 3649|    657|		return 4;
 3650|      0|	default:
  ------------------
  |  Branch (3650:2): [True: 0, False: 31.0k]
  ------------------
 3651|      0|		file_error(ms, 0, "corrupt magic file "
 3652|      0|		    "(bad pascal string length %d)",
 3653|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  390|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  419|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  411|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  414|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  413|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  416|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  415|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3654|      0|		return FILE_BADSIZE;
  ------------------
  |  |  183|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3655|  31.0k|	}
 3656|  31.0k|}
file_pstring_get_length:
 3661|  26.2k|{
 3662|  26.2k|	size_t len = 0;
 3663|  26.2k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  461|  26.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3664|  26.2k|	unsigned int s3, s2, s1, s0;
 3665|       |
 3666|  26.2k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  390|  26.2k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  419|  26.2k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  411|  26.2k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  26.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  414|  26.2k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  26.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  413|  26.2k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  26.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  416|  26.2k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  26.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  415|  26.2k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  26.2k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3667|  24.5k|	case PSTRING_1_LE:
  ------------------
  |  |  412|  24.5k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  403|  24.5k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3667:2): [True: 24.5k, False: 1.72k]
  ------------------
 3668|  24.5k|		len = *s;
 3669|  24.5k|		break;
 3670|    130|	case PSTRING_2_LE:
  ------------------
  |  |  414|    130|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  403|    130|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3670:2): [True: 130, False: 26.1k]
  ------------------
 3671|    130|		s0 = s[0];
 3672|    130|		s1 = s[1];
 3673|    130|		len = (s1 << 8) | s0;
 3674|    130|		break;
 3675|  1.37k|	case PSTRING_2_BE:
  ------------------
  |  |  413|  1.37k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  403|  1.37k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3675:2): [True: 1.37k, False: 24.9k]
  ------------------
 3676|  1.37k|		s0 = s[0];
 3677|  1.37k|		s1 = s[1];
 3678|  1.37k|		len = (s0 << 8) | s1;
 3679|  1.37k|		break;
 3680|     47|	case PSTRING_4_LE:
  ------------------
  |  |  416|     47|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  403|     47|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3680:2): [True: 47, False: 26.2k]
  ------------------
 3681|     47|		s0 = s[0];
 3682|     47|		s1 = s[1];
 3683|     47|		s2 = s[2];
 3684|     47|		s3 = s[3];
 3685|     47|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3686|     47|		break;
 3687|    174|	case PSTRING_4_BE:
  ------------------
  |  |  415|    174|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  403|    174|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3687:2): [True: 174, False: 26.1k]
  ------------------
 3688|    174|		s0 = s[0];
 3689|    174|		s1 = s[1];
 3690|    174|		s2 = s[2];
 3691|    174|		s3 = s[3];
 3692|    174|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3693|    174|		break;
 3694|      0|	default:
  ------------------
  |  Branch (3694:2): [True: 0, False: 26.2k]
  ------------------
 3695|      0|		file_error(ms, 0, "corrupt magic file "
 3696|      0|		    "(bad pascal string length %d)",
 3697|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  390|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  419|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  411|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  414|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  413|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  416|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  415|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3698|      0|		return FILE_BADSIZE;
  ------------------
  |  |  183|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3699|  26.2k|	}
 3700|       |
 3701|  26.2k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  390|  26.2k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  420|  26.2k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  403|  26.2k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3701:6): [True: 1.12k, False: 25.1k]
  ------------------
 3702|  1.12k|		size_t l = file_pstring_length_size(ms, m);
 3703|  1.12k|		if (l == FILE_BADSIZE)
  ------------------
  |  |  183|  1.12k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3703:7): [True: 0, False: 1.12k]
  ------------------
 3704|      0|			return l;
 3705|  1.12k|		len -= l;
 3706|  1.12k|	}
 3707|       |
 3708|  26.2k|	return len;
 3709|  26.2k|}
file_magicfind:
 3713|  66.6k|{
 3714|  66.6k|	uint32_t i, j;
 3715|  66.6k|	struct mlist *mlist, *ml;
 3716|       |
 3717|  66.6k|	mlist = ms->mlist[1];
 3718|       |
 3719|  66.6k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3719:25): [True: 66.6k, False: 0]
  ------------------
 3720|  66.6k|		struct magic *ma = ml->magic;
 3721|   274M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3721:15): [True: 274M, False: 0]
  ------------------
 3722|   274M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  298|   274M|#define				FILE_NAME		45
  ------------------
  |  Branch (3722:8): [True: 261M, False: 13.0M]
  ------------------
 3723|   261M|				continue;
 3724|  13.0M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3724:8): [True: 66.6k, False: 12.9M]
  ------------------
 3725|  66.6k|				v->magic = &ma[i];
 3726|  66.6k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3727|  2.74M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3727:21): [True: 2.74M, False: 66]
  ------------------
 3728|  2.74M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3728:13): [True: 66.5k, False: 2.67M]
  ------------------
 3729|  66.5k|					    break;
 3730|  66.6k|				v->nmagic = j - i;
 3731|  66.6k|				return 0;
 3732|  66.6k|			}
 3733|  13.0M|		}
 3734|  66.6k|	}
 3735|      0|	return -1;
 3736|  66.6k|}
apprentice.c:mlist_free:
  667|      4|{
  668|      4|	struct mlist *ml, *next;
  669|       |
  670|      4|	if (mlist == NULL)
  ------------------
  |  Branch (670:6): [True: 4, False: 0]
  ------------------
  671|      4|		return;
  672|       |
  673|      0|	for (ml = mlist->next; ml != mlist;) {
  ------------------
  |  Branch (673:25): [True: 0, False: 0]
  ------------------
  674|      0|		next = ml->next;
  675|      0|		mlist_free_one(ml);
  676|      0|		ml = next;
  677|      0|	}
  678|      0|	mlist_free_one(mlist);
  679|      0|}
apprentice.c:init_file_tables:
  415|      2|{
  416|      2|	static int done = 0;
  417|      2|	const struct type_tbl_s *p;
  418|       |
  419|      2|	if (done)
  ------------------
  |  Branch (419:6): [True: 0, False: 2]
  ------------------
  420|      0|		return;
  421|      2|	done++;
  422|       |
  423|    126|	for (p = type_tbl; p->len; p++) {
  ------------------
  |  Branch (423:21): [True: 124, False: 2]
  ------------------
  424|    124|		assert(p->type < FILE_NAMES_SIZE);
  ------------------
  |  Branch (424:3): [True: 0, False: 124]
  |  Branch (424:3): [True: 124, False: 0]
  ------------------
  425|    124|		file_names[p->type] = p->name;
  426|    124|		file_formats[p->type] = p->format;
  427|    124|	}
  428|      2|	assert(p - type_tbl == FILE_NAMES_SIZE);
  ------------------
  |  Branch (428:2): [True: 0, False: 2]
  |  Branch (428:2): [True: 2, False: 0]
  ------------------
  429|      2|}
apprentice.c:mlist_alloc:
  625|      4|{
  626|      4|	struct mlist *mlist;
  627|      4|	if ((mlist = CAST(struct mlist *, calloc(1, sizeof(*mlist)))) == NULL) {
  ------------------
  |  |  460|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (627:6): [True: 0, False: 4]
  ------------------
  628|      0|		return NULL;
  629|      0|	}
  630|      4|	mlist->next = mlist->prev = mlist;
  631|      4|	return mlist;
  632|      4|}
apprentice.c:add_mlist:
  433|      4|{
  434|      4|	struct mlist *ml;
  435|       |
  436|      4|	mlp->map = NULL;
  437|      4|	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
  ------------------
  |  |  460|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (437:6): [True: 0, False: 4]
  ------------------
  438|      0|		return -1;
  439|       |
  440|      4|	ml->map = idx == 0 ? map : NULL;
  ------------------
  |  Branch (440:12): [True: 2, False: 2]
  ------------------
  441|      4|	ml->magic = map->magic[idx];
  442|      4|	ml->nmagic = map->nmagic[idx];
  443|      4|	if (ml->nmagic) {
  ------------------
  |  Branch (443:6): [True: 4, False: 0]
  ------------------
  444|      4|		ml->magic_rxcomp = CAST(file_regex_t **,
  ------------------
  |  |  460|      4|#define CAST(T, b)	((T)(b))
  ------------------
  445|      4|		    calloc(ml->nmagic, sizeof(*ml->magic_rxcomp)));
  446|      4|		if (ml->magic_rxcomp == NULL) {
  ------------------
  |  Branch (446:7): [True: 0, False: 4]
  ------------------
  447|      0|			free(ml);
  448|      0|			return -1;
  449|      0|		}
  450|      4|	} else
  451|      0|		ml->magic_rxcomp = NULL;
  452|      4|	mlp->prev->next = ml;
  453|      4|	ml->prev = mlp->prev;
  454|      4|	ml->next = mlp;
  455|      4|	mlp->prev = ml;
  456|      4|	return 0;
  457|      4|}
apprentice.c:apprentice_1:
  464|      2|{
  465|      2|	struct magic_map *map;
  466|      2|#ifndef COMPILE_ONLY
  467|      2|	size_t i;
  468|      2|#endif
  469|       |
  470|      2|	if (magicsize != FILE_MAGICSIZE) {
  ------------------
  |  |  191|      2|#define FILE_MAGICSIZE	432
  ------------------
  |  Branch (470:6): [True: 0, False: 2]
  ------------------
  471|      0|		file_error(ms, 0, "magic element size %lu != %lu",
  472|      0|		    CAST(unsigned long, sizeof(*map->magic[0])),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  473|      0|		    CAST(unsigned long, FILE_MAGICSIZE));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  474|      0|		return -1;
  475|      0|	}
  476|       |
  477|      2|	if (action == FILE_COMPILE) {
  ------------------
  |  |  197|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (477:6): [True: 0, False: 2]
  ------------------
  478|      0|		map = apprentice_load(ms, fn, action);
  479|      0|		if (map == NULL)
  ------------------
  |  Branch (479:7): [True: 0, False: 0]
  ------------------
  480|      0|			return -1;
  481|      0|		return apprentice_compile(ms, map, fn);
  482|      0|	}
  483|       |
  484|      2|#ifndef COMPILE_ONLY
  485|      2|	map = apprentice_map(ms, fn);
  486|      2|	if (map == NULL) {
  ------------------
  |  Branch (486:6): [True: 0, False: 2]
  ------------------
  487|      0|		if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (487:7): [True: 0, False: 0]
  ------------------
  488|      0|			file_magwarn(ms, "using regular magic file `%s'", fn);
  489|      0|		map = apprentice_load(ms, fn, action);
  490|      0|		if (map == NULL)
  ------------------
  |  Branch (490:7): [True: 0, False: 0]
  ------------------
  491|      0|			return -1;
  492|      0|	}
  493|       |
  494|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  479|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (494:14): [True: 4, False: 2]
  ------------------
  495|      4|		if (add_mlist(ms->mlist[i], map, i) == -1) {
  ------------------
  |  Branch (495:7): [True: 0, False: 4]
  ------------------
  496|       |			/* failed to add to any list, free explicitly */
  497|      0|			if (i == 0)
  ------------------
  |  Branch (497:8): [True: 0, False: 0]
  ------------------
  498|      0|				apprentice_unmap(map);
  499|      0|			else
  500|      0|				mlist_free_all(ms);
  501|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  502|      0|			return -1;
  503|      0|		}
  504|      4|	}
  505|       |
  506|      2|	if (action == FILE_LIST) {
  ------------------
  |  |  198|      2|#define FILE_LIST	3
  ------------------
  |  Branch (506:6): [True: 0, False: 2]
  ------------------
  507|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  479|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (507:15): [True: 0, False: 0]
  ------------------
  508|      0|			printf("Set %" SIZE_T_FORMAT "u:\nBinary patterns:\n",
  509|      0|			    i);
  510|      0|			apprentice_list(ms->mlist[i], BINTEST);
  ------------------
  |  |  239|      0|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  511|      0|			printf("Text patterns:\n");
  512|      0|			apprentice_list(ms->mlist[i], TEXTTEST);
  ------------------
  |  |  241|      0|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  513|      0|		}
  514|      0|	}
  515|      2|	return 0;
  516|       |#else
  517|       |	return 0;
  518|       |#endif /* COMPILE_ONLY */
  519|      2|}
apprentice.c:mkdbname:
 3536|      2|{
 3537|      2|	const char *p, *q;
 3538|      2|	char *buf;
 3539|       |
 3540|      2|	if (strip) {
  ------------------
  |  Branch (3540:6): [True: 0, False: 2]
  ------------------
 3541|      0|		if ((p = strrchr(fn, '/')) != NULL)
  ------------------
  |  Branch (3541:7): [True: 0, False: 0]
  ------------------
 3542|      0|			fn = ++p;
 3543|      0|	}
 3544|       |
 3545|     94|	for (q = fn; *q; q++)
  ------------------
  |  Branch (3545:15): [True: 92, False: 2]
  ------------------
 3546|     92|		continue;
 3547|       |	/* Look for .mgc */
 3548|      6|	for (p = ext + sizeof(ext) - 1; p >= ext && q >= fn; p--, q--)
  ------------------
  |  Branch (3548:34): [True: 6, False: 0]
  |  Branch (3548:46): [True: 6, False: 0]
  ------------------
 3549|      6|		if (*p != *q)
  ------------------
  |  Branch (3549:7): [True: 2, False: 4]
  ------------------
 3550|      2|			break;
 3551|       |
 3552|       |	/* Did not find .mgc, restore q */
 3553|      2|	if (p >= ext)
  ------------------
  |  Branch (3553:6): [True: 2, False: 0]
  ------------------
 3554|     94|		for (q = fn; *q; q++)
  ------------------
  |  Branch (3554:16): [True: 92, False: 2]
  ------------------
 3555|     92|			continue;
 3556|       |
 3557|      2|	q++;
 3558|       |	/* Compatibility with old code that looked in .mime */
 3559|      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 (3559:6): [True: 0, False: 2]
  ------------------
 3560|      0|		if (asprintf(&buf, "%.*s.mime%s", CAST(int, q - fn), fn, ext)
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3560:7): [True: 0, False: 0]
  ------------------
 3561|      0|		    < 0)
 3562|      0|			return NULL;
 3563|      0|		if (access(buf, R_OK) != -1) {
  ------------------
  |  Branch (3563:7): [True: 0, False: 0]
  ------------------
 3564|      0|			ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3565|      0|			return buf;
 3566|      0|		}
 3567|      0|		free(buf);
 3568|      0|	}
 3569|      2|	if (asprintf(&buf, "%.*s%s", CAST(int, q - fn), fn, ext) < 0)
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3569:6): [True: 0, False: 2]
  ------------------
 3570|      0|		return NULL;
 3571|       |
 3572|       |	/* Compatibility with old code that looked in .mime */
 3573|      2|	if (strstr(fn, ".mime") != NULL)
  ------------------
  |  Branch (3573:6): [True: 0, False: 2]
  ------------------
 3574|      0|		ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3575|      2|	return buf;
 3576|      2|}
apprentice.c:apprentice_map:
 3333|      2|{
 3334|      2|	int fd;
 3335|      2|	struct stat st;
 3336|      2|	char *dbname = NULL;
 3337|      2|	struct magic_map *map;
 3338|      2|	struct magic_map *rv = NULL;
 3339|       |
 3340|      2|	fd = -1;
 3341|      2|	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3341:6): [True: 0, False: 2]
  ------------------
 3342|      0|		file_oomem(ms, sizeof(*map));
 3343|      0|		goto error;
 3344|      0|	}
 3345|      2|	map->type = MAP_TYPE_USER;	/* unspecified */
  ------------------
  |  |   83|      2|#define MAP_TYPE_USER	0
  ------------------
 3346|       |
 3347|      2|	dbname = mkdbname(ms, fn, 0);
 3348|      2|	if (dbname == NULL)
  ------------------
  |  Branch (3348:6): [True: 0, False: 2]
  ------------------
 3349|      0|		goto error;
 3350|       |
 3351|      2|	if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1)
  ------------------
  |  |  740|      2|#define O_BINARY	0
  ------------------
  |  Branch (3351:6): [True: 0, False: 2]
  ------------------
 3352|      0|		goto error;
 3353|       |
 3354|      2|	if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (3354:6): [True: 0, False: 2]
  ------------------
 3355|      0|		file_error(ms, errno, "cannot stat `%s'", dbname);
 3356|      0|		goto error;
 3357|      0|	}
 3358|      2|	if (st.st_size < 8 || st.st_size > maxoff_t()) {
  ------------------
  |  Branch (3358:6): [True: 0, False: 2]
  |  Branch (3358:24): [True: 0, False: 2]
  ------------------
 3359|      0|		file_error(ms, 0, "file `%s' is too %s", dbname,
 3360|      0|		    st.st_size < 8 ? "small" : "large");
  ------------------
  |  Branch (3360:7): [True: 0, False: 0]
  ------------------
 3361|      0|		goto error;
 3362|      0|	}
 3363|       |
 3364|      2|	map->len = CAST(size_t, st.st_size);
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3365|      2|#ifdef QUICK
 3366|      2|	map->type = MAP_TYPE_MMAP;
  ------------------
  |  |   85|      2|#define MAP_TYPE_MMAP	2
  ------------------
 3367|      2|	if ((map->p = mmap(0, CAST(size_t, st.st_size), PROT_READ|PROT_WRITE,
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3367:6): [True: 0, False: 2]
  ------------------
 3368|      2|	    MAP_PRIVATE|MAP_FILE, fd, CAST(off_t, 0))) == MAP_FAILED) {
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3369|      0|		file_error(ms, errno, "cannot map `%s'", dbname);
 3370|      0|		goto error;
 3371|      0|	}
 3372|       |#else
 3373|       |	map->type = MAP_TYPE_MALLOC;
 3374|       |	if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
 3375|       |		file_oomem(ms, map->len);
 3376|       |		goto error;
 3377|       |	}
 3378|       |	if (read(fd, map->p, map->len) != (ssize_t)map->len) {
 3379|       |		file_badread(ms);
 3380|       |		goto error;
 3381|       |	}
 3382|       |#endif
 3383|      2|	(void)close(fd);
 3384|      2|	fd = -1;
 3385|       |
 3386|      2|	if (check_buffer(ms, map, dbname) != 0) {
  ------------------
  |  Branch (3386:6): [True: 0, False: 2]
  ------------------
 3387|      0|		goto error;
 3388|      0|	}
 3389|      2|#ifdef QUICK
 3390|      2|	if (mprotect(map->p, CAST(size_t, st.st_size), PROT_READ) == -1) {
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3390:6): [True: 0, False: 2]
  ------------------
 3391|      0|		file_error(ms, errno, "cannot mprotect `%s'", dbname);
 3392|      0|		goto error;
 3393|      0|	}
 3394|      2|#endif
 3395|       |
 3396|      2|	free(dbname);
 3397|      2|	return map;
 3398|       |
 3399|      0|error:
 3400|      0|	if (fd != -1)
  ------------------
  |  Branch (3400:6): [True: 0, False: 0]
  ------------------
 3401|      0|		(void)close(fd);
 3402|      0|	apprentice_unmap(map);
 3403|      0|	free(dbname);
 3404|      0|	return rv;
 3405|      2|}
apprentice.c:maxoff_t:
  316|      2|maxoff_t(void) {
  317|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(int))
  ------------------
  |  Branch (317:19): [Folded, False: 2]
  ------------------
  318|      0|		return CAST(off_t, INT_MAX);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  319|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(long))
  ------------------
  |  Branch (319:19): [True: 2, Folded]
  ------------------
  320|      2|		return CAST(off_t, LONG_MAX);
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
  321|      0|	return 0x7fffffff;
  322|      2|}
apprentice.c:check_buffer:
 3409|      2|{
 3410|      2|	uint32_t *ptr;
 3411|      2|	uint32_t entries, nentries;
 3412|      2|	uint32_t version;
 3413|      2|	int i, needsbyteswap;
 3414|       |
 3415|      2|	entries = CAST(uint32_t, map->len / sizeof(struct magic));
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3416|      2|	if (entries < MAGIC_SETS) {
  ------------------
  |  |  479|      2|#define MAGIC_SETS	2
  ------------------
  |  Branch (3416:6): [True: 0, False: 2]
  ------------------
 3417|      0|		file_error(ms, 0, "Too few magic entries %u in `%s'",
 3418|      0|		    entries, dbname);
 3419|      0|		return -1;
 3420|      0|	}
 3421|      2|	if ((entries * sizeof(struct magic)) != map->len) {
  ------------------
  |  Branch (3421:6): [True: 0, False: 2]
  ------------------
 3422|      0|		file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not "
 3423|      0|		    "a multiple of %" SIZE_T_FORMAT "u",
 3424|      0|		    dbname, map->len, sizeof(struct magic));
 3425|      0|		return -1;
 3426|      0|	}
 3427|       |
 3428|      2|	ptr = CAST(uint32_t *, map->p);
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3429|      2|	if (*ptr != MAGICNO) {
  ------------------
  |  |  189|      2|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3429:6): [True: 0, False: 2]
  ------------------
 3430|      0|		if (file_swap4(*ptr) != MAGICNO) {
  ------------------
  |  |   38|      0|#define file_swap4(x)	bswap_32(x)
  ------------------
              		if (file_swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  189|      0|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3430:7): [True: 0, False: 0]
  ------------------
 3431|      0|			file_error(ms, 0, "bad magic in `%s'", dbname);
 3432|      0|			return -1;
 3433|      0|		}
 3434|      0|		needsbyteswap = 1;
 3435|      0|	} else
 3436|      2|		needsbyteswap = 0;
 3437|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3437:6): [True: 0, False: 2]
  ------------------
 3438|      0|		version = file_swap4(ptr[1]);
  ------------------
  |  |   38|      0|#define file_swap4(x)	bswap_32(x)
  ------------------
 3439|      2|	else
 3440|      2|		version = ptr[1];
 3441|      2|	if (version != VERSIONNO) {
  ------------------
  |  |  190|      2|#define VERSIONNO	21
  ------------------
  |  Branch (3441:6): [True: 0, False: 2]
  ------------------
 3442|      0|		file_error(ms, 0, "File %s supports only version %d magic "
 3443|      0|		    "files. `%s' is version %d", VERSION,
  ------------------
  |  |  432|      0|#define VERSION "5.48"
  ------------------
 3444|      0|		    VERSIONNO, dbname, version);
  ------------------
  |  |  190|      0|#define VERSIONNO	21
  ------------------
 3445|      0|		return -1;
 3446|      0|	}
 3447|      2|	map->magic[0] = CAST(struct magic *, map->p) + 1;
  ------------------
  |  |  460|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3448|      2|	nentries = 0;
 3449|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  479|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (3449:14): [True: 4, False: 2]
  ------------------
 3450|      4|		if (needsbyteswap)
  ------------------
  |  Branch (3450:7): [True: 0, False: 4]
  ------------------
 3451|      0|			map->nmagic[i] = file_swap4(ptr[i + 2]);
  ------------------
  |  |   38|      0|#define file_swap4(x)	bswap_32(x)
  ------------------
 3452|      4|		else
 3453|      4|			map->nmagic[i] = ptr[i + 2];
 3454|      4|		if (map->nmagic[i] > entries) {
  ------------------
  |  Branch (3454:7): [True: 0, False: 4]
  ------------------
 3455|      0|			file_error(ms, 0, "nmagic[%u] too large in `%s'", i,
 3456|      0|			    dbname);
 3457|      0|			return -1;
 3458|      0|		}
 3459|      4|		if (i != MAGIC_SETS - 1)
  ------------------
  |  |  479|      4|#define MAGIC_SETS	2
  ------------------
  |  Branch (3459:7): [True: 2, False: 2]
  ------------------
 3460|      2|			map->magic[i + 1] = map->magic[i] + map->nmagic[i];
 3461|      4|		nentries += map->nmagic[i];
 3462|      4|	}
 3463|      2|	if (entries != nentries + 1) {
  ------------------
  |  Branch (3463:6): [True: 0, False: 2]
  ------------------
 3464|      0|		file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
 3465|      0|		    dbname, entries, nentries + 1);
 3466|      0|		return -1;
 3467|      0|	}
 3468|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3468:6): [True: 0, False: 2]
  ------------------
 3469|      0|		for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  479|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (3469:15): [True: 0, False: 0]
  ------------------
 3470|      0|			byteswap(map->magic[i], map->nmagic[i]);
 3471|      2|	return 0;
 3472|      2|}

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

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

cdf_swap_header:
  230|  3.27k|{
  231|  3.27k|	size_t i;
  232|       |
  233|  3.27k|	h->h_magic = CDF_TOLE8(h->h_magic);
  ------------------
  |  |   82|  3.27k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  3.27k|	h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
  ------------------
  |  |   82|  3.27k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  3.27k|	h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
  ------------------
  |  |   82|  3.27k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  3.27k|	h->h_revision = CDF_TOLE2(h->h_revision);
  ------------------
  |  |   86|  3.27k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  3.27k|	h->h_version = CDF_TOLE2(h->h_version);
  ------------------
  |  |   86|  3.27k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  3.27k|	h->h_byte_order = CDF_TOLE2(h->h_byte_order);
  ------------------
  |  |   86|  3.27k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  3.27k|	h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
  ------------------
  |  |   86|  3.27k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  3.27k|	h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
  ------------------
  |  |   86|  3.27k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  3.27k|	h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|  3.27k|	h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|  3.27k|	h->h_min_size_standard_stream =
  244|  3.27k|	    CDF_TOLE4(h->h_min_size_standard_stream);
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  245|  3.27k|	h->h_secid_first_sector_in_short_sat =
  246|  3.27k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_short_sat));
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|  3.27k|	h->h_num_sectors_in_short_sat =
  248|  3.27k|	    CDF_TOLE4(h->h_num_sectors_in_short_sat);
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  3.27k|	h->h_secid_first_sector_in_master_sat =
  250|  3.27k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_master_sat));
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|  3.27k|	h->h_num_sectors_in_master_sat =
  252|  3.27k|	    CDF_TOLE4(h->h_num_sectors_in_master_sat);
  ------------------
  |  |   84|  3.27k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  253|   360k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  138|   360k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (253:14): [True: 356k, False: 3.27k]
  ------------------
  254|   356k|		h->h_master_sat[i] =
  255|   356k|		    CDF_TOLE4(CAST(uint32_t, h->h_master_sat[i]));
  ------------------
  |  |   84|   356k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|   713k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 356k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|   356k|	}
  257|  3.27k|}
cdf_unpack_header:
  261|  3.27k|{
  262|  3.27k|	size_t i;
  263|  3.27k|	size_t len = 0;
  264|       |
  265|  3.27k|	CDF_UNPACK(h->h_magic);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  266|  3.27k|	CDF_UNPACKA(h->h_uuid);
  ------------------
  |  |  208|  3.27k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  267|  3.27k|	CDF_UNPACK(h->h_revision);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  268|  3.27k|	CDF_UNPACK(h->h_version);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  269|  3.27k|	CDF_UNPACK(h->h_byte_order);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  270|  3.27k|	CDF_UNPACK(h->h_sec_size_p2);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  271|  3.27k|	CDF_UNPACK(h->h_short_sec_size_p2);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  272|  3.27k|	CDF_UNPACKA(h->h_unused0);
  ------------------
  |  |  208|  3.27k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  273|  3.27k|	CDF_UNPACK(h->h_num_sectors_in_sat);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  274|  3.27k|	CDF_UNPACK(h->h_secid_first_directory);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  275|  3.27k|	CDF_UNPACKA(h->h_unused1);
  ------------------
  |  |  208|  3.27k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  276|  3.27k|	CDF_UNPACK(h->h_min_size_standard_stream);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  277|  3.27k|	CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  278|  3.27k|	CDF_UNPACK(h->h_num_sectors_in_short_sat);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  279|  3.27k|	CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  280|  3.27k|	CDF_UNPACK(h->h_num_sectors_in_master_sat);
  ------------------
  |  |  206|  3.27k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  281|   360k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  138|   360k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (281:14): [True: 356k, False: 3.27k]
  ------------------
  282|   356k|		CDF_UNPACK(h->h_master_sat[i]);
  ------------------
  |  |  206|   356k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  283|  3.27k|}
cdf_swap_class:
  304|    112|{
  305|    112|	d->cl_dword = CDF_TOLE4(d->cl_dword);
  ------------------
  |  |   84|    112|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|    112|	d->cl_word[0] = CDF_TOLE2(d->cl_word[0]);
  ------------------
  |  |   86|    112|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|    112|	d->cl_word[1] = CDF_TOLE2(d->cl_word[1]);
  ------------------
  |  |   86|    112|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  308|    112|}
cdf_unpack_dir:
  312|  9.69k|{
  313|  9.69k|	size_t len = 0;
  314|       |
  315|  9.69k|	CDF_UNPACKA(d->d_name);
  ------------------
  |  |  208|  9.69k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  316|  9.69k|	CDF_UNPACK(d->d_namelen);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  317|  9.69k|	CDF_UNPACK(d->d_type);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  318|  9.69k|	CDF_UNPACK(d->d_color);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  319|  9.69k|	CDF_UNPACK(d->d_left_child);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  320|  9.69k|	CDF_UNPACK(d->d_right_child);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  321|  9.69k|	CDF_UNPACK(d->d_storage);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  322|  9.69k|	CDF_UNPACKA(d->d_storage_uuid);
  ------------------
  |  |  208|  9.69k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  323|  9.69k|	CDF_UNPACK(d->d_flags);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  324|  9.69k|	CDF_UNPACK(d->d_created);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  325|  9.69k|	CDF_UNPACK(d->d_modified);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  326|  9.69k|	CDF_UNPACK(d->d_stream_first_sector);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  327|  9.69k|	CDF_UNPACK(d->d_size);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  328|  9.69k|	CDF_UNPACK(d->d_unused0);
  ------------------
  |  |  206|  9.69k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  329|  9.69k|}
cdf_zero_stream:
  333|  1.67k|{
  334|  1.67k|	scn->sst_len = 0;
  335|  1.67k|	scn->sst_dirlen = 0;
  336|  1.67k|	scn->sst_ss = 0;
  337|  1.67k|	free(scn->sst_tab);
  338|       |	scn->sst_tab = NULL;
  339|  1.67k|	return -1;
  340|  1.67k|}
cdf_read_header:
  396|  15.3k|{
  397|  15.3k|	char buf[512];
  398|       |
  399|  15.3k|	(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
  400|  15.3k|	if (cdf_read(info, CAST(off_t, 0), buf, sizeof(buf)) == -1)
  ------------------
  |  |  460|  15.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (400:6): [True: 12.0k, False: 3.27k]
  ------------------
  401|  12.0k|		return -1;
  402|  3.27k|	cdf_unpack_header(h, buf);
  403|  3.27k|	cdf_swap_header(h);
  404|  3.27k|	if (h->h_magic != CDF_MAGIC) {
  ------------------
  |  |   62|  3.27k|#define CDF_MAGIC	0xE11AB1A1E011CFD0LL
  ------------------
  |  Branch (404:6): [True: 2.15k, False: 1.12k]
  ------------------
  405|  2.15k|		DPRINTF(("Bad magic %#" INT64_T_FORMAT "x != %#"
  406|  2.15k|		    INT64_T_FORMAT "x\n",
  407|  2.15k|		    (unsigned long long)h->h_magic,
  408|  2.15k|		    (unsigned long long)CDF_MAGIC));
  409|  2.15k|		goto out;
  410|  2.15k|	}
  411|  1.12k|	if (h->h_sec_size_p2 > 20) {
  ------------------
  |  Branch (411:6): [True: 13, False: 1.11k]
  ------------------
  412|     13|		DPRINTF(("Bad sector size %hu\n", h->h_sec_size_p2));
  413|     13|		goto out;
  414|     13|	}
  415|  1.11k|	if (h->h_short_sec_size_p2 > 20) {
  ------------------
  |  Branch (415:6): [True: 5, False: 1.10k]
  ------------------
  416|      5|		DPRINTF(("Bad short sector size %hu\n",
  417|      5|		    h->h_short_sec_size_p2));
  418|      5|		goto out;
  419|      5|	}
  420|  1.10k|	return 0;
  421|  2.16k|out:
  422|  2.16k|	errno = EFTYPE;
  ------------------
  |  |   59|  2.16k|#define EFTYPE EINVAL
  ------------------
  423|  2.16k|	return -1;
  424|  1.11k|}
cdf_read_sector:
  430|   315k|{
  431|   315k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   81|   315k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|   315k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  432|   315k|	size_t pos;
  433|       |
  434|   315k|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|   315k|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  460|   315k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  460|   315k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (434:6): [True: 0, False: 315k]
  ------------------
  435|      0|		return -1;
  436|       |
  437|   315k|	pos = CDF_SEC_POS(h, id);
  ------------------
  |  |   82|   315k|#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   81|   315k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   315k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   81|   315k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   315k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|   315k|	assert(ss == len);
  ------------------
  |  Branch (438:2): [True: 0, False: 315k]
  |  Branch (438:2): [True: 315k, False: 0]
  ------------------
  439|   315k|	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  460|   315k|#define CAST(T, b)	((T)(b))
  ------------------
              	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  461|   315k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  440|   315k|}
cdf_read_short_sector:
  445|    193|{
  446|    193|	size_t ss = CDF_SHORT_SEC_SIZE(h);
  ------------------
  |  |   83|    193|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  447|    193|	size_t pos;
  448|       |
  449|    193|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|    193|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  460|    193|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (449:6): [True: 0, False: 193]
  ------------------
  450|      0|		return -1;
  451|       |
  452|    193|	pos = CDF_SHORT_SEC_POS(h, id);
  ------------------
  |  |   84|    193|#define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   83|    193|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  453|    193|	assert(ss == len);
  ------------------
  |  Branch (453:2): [True: 0, False: 193]
  |  Branch (453:2): [True: 193, False: 0]
  ------------------
  454|    193|	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
  ------------------
  |  |   81|    193|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (454:6): [True: 9, False: 184]
  ------------------
  455|      9|		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
  456|      9|		    SIZE_T_FORMAT "u\n",
  457|      9|		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
  458|      9|		goto out;
  459|      9|	}
  460|    184|	(void)memcpy(RCAST(char *, buf) + offs,
  ------------------
  |  |  461|    184|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  461|    184|	    RCAST(const char *, sst->sst_tab) + pos, len);
  ------------------
  |  |  461|    184|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  462|    184|	return len;
  463|      9|out:
  464|      9|	errno = EFTYPE;
  ------------------
  |  |   59|      9|#define EFTYPE EINVAL
  ------------------
  465|      9|	return -1;
  466|    193|}
cdf_read_sat:
  473|  1.10k|{
  474|  1.10k|	size_t i, j, k;
  475|  1.10k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   81|  1.10k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|  1.10k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  476|  1.10k|	cdf_secid_t *msa, mid, sec;
  477|  1.10k|	size_t nsatpersec = (ss / sizeof(mid)) - 1;
  478|       |
  479|  93.3k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  138|  93.3k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (479:14): [True: 92.5k, False: 774]
  ------------------
  480|  92.5k|		if (h->h_master_sat[i] == CDF_SECID_FREE)
  ------------------
  |  |   55|  92.5k|#define CDF_SECID_FREE					-1
  ------------------
  |  Branch (480:7): [True: 331, False: 92.2k]
  ------------------
  481|    331|			break;
  482|       |
  483|  1.10k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  484|  1.10k|	if ((nsatpersec > 0 &&
  ------------------
  |  Branch (484:7): [True: 945, False: 160]
  ------------------
  485|    945|	    h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
  ------------------
  |  |  483|    945|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (485:6): [True: 19, False: 926]
  ------------------
  486|  1.08k|	    i > CDF_SEC_LIMIT) {
  ------------------
  |  |  483|  1.08k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (486:6): [True: 1, False: 1.08k]
  ------------------
  487|     20|		DPRINTF(("Number of sectors in master SAT too big %u %"
  488|     20|		    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));
  489|     20|		errno = EFTYPE;
  ------------------
  |  |   59|     20|#define EFTYPE EINVAL
  ------------------
  490|     20|		return -1;
  491|     20|	}
  492|       |
  493|  1.08k|	sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
  494|  1.08k|#define CDF_SAT_LIMIT	(16 * 1024 * 1024)
  495|  1.08k|	if (ss != 0 && sat->sat_len > CDF_SAT_LIMIT / ss) {
  ------------------
  |  |  494|  1.08k|#define CDF_SAT_LIMIT	(16 * 1024 * 1024)
  ------------------
  |  Branch (495:6): [True: 1.08k, False: 0]
  |  Branch (495:17): [True: 21, False: 1.06k]
  ------------------
  496|     21|		errno = EFTYPE;
  ------------------
  |  |   59|     21|#define EFTYPE EINVAL
  ------------------
  497|     21|		return -1;
  498|     21|	}
  499|  1.06k|	DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
  500|  1.06k|	    sat->sat_len, ss));
  501|  1.06k|	if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
  ------------------
  |  |  460|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (501:6): [True: 0, False: 1.06k]
  ------------------
  502|  1.06k|	    == NULL)
  503|      0|		return -1;
  504|       |
  505|  46.7k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  138|  46.7k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (505:14): [True: 46.3k, False: 402]
  ------------------
  506|  46.3k|		if (h->h_master_sat[i] < 0)
  ------------------
  |  Branch (506:7): [True: 636, False: 45.7k]
  ------------------
  507|    636|			break;
  508|  45.7k|		if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (508:7): [True: 26, False: 45.7k]
  ------------------
  509|  45.7k|		    h->h_master_sat[i]) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  45.7k|#define CAST(T, b)	((T)(b))
  ------------------
  510|     26|			DPRINTF(("Reading sector %d", h->h_master_sat[i]));
  511|     26|			goto out1;
  512|     26|		}
  513|  45.7k|	}
  514|       |
  515|  1.03k|	if ((msa = CAST(cdf_secid_t *, CDF_CALLOC(1, ss))) == NULL)
  ------------------
  |  |  460|  1.03k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (515:6): [True: 0, False: 1.03k]
  ------------------
  516|      0|		goto out1;
  517|       |
  518|  1.03k|	mid = h->h_secid_first_sector_in_master_sat;
  519|  27.8k|	for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
  ------------------
  |  Branch (519:14): [True: 27.3k, False: 470]
  ------------------
  520|  27.3k|		if (mid < 0)
  ------------------
  |  Branch (520:7): [True: 107, False: 27.2k]
  ------------------
  521|    107|			goto out;
  522|  27.2k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  27.2k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (522:7): [True: 2, False: 27.2k]
  ------------------
  523|      2|			DPRINTF(("Reading master sector loop limit"));
  524|      2|			goto out3;
  525|      2|		}
  526|  27.2k|		if (cdf_read_sector(info, msa, 0, ss, h, mid) !=
  ------------------
  |  Branch (526:7): [True: 64, False: 27.2k]
  ------------------
  527|  27.2k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  27.2k|#define CAST(T, b)	((T)(b))
  ------------------
  528|     64|			DPRINTF(("Reading master sector %d", mid));
  529|     64|			goto out2;
  530|     64|		}
  531|   265k|		for (k = 0; k < nsatpersec; k++, i++) {
  ------------------
  |  Branch (531:15): [True: 238k, False: 26.8k]
  ------------------
  532|   238k|			sec = CDF_TOLE4(CAST(uint32_t, msa[k]));
  ------------------
  |  |   84|   238k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|   476k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 238k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  533|   238k|			if (sec < 0)
  ------------------
  |  Branch (533:8): [True: 359, False: 237k]
  ------------------
  534|    359|				goto out;
  535|   237k|			if (i >= sat->sat_len) {
  ------------------
  |  Branch (535:8): [True: 0, False: 237k]
  ------------------
  536|      0|			    DPRINTF(("Out of bounds reading MSA %"
  537|      0|				SIZE_T_FORMAT "u >= %" SIZE_T_FORMAT "u",
  538|      0|				i, sat->sat_len));
  539|      0|			    goto out3;
  540|      0|			}
  541|   237k|			if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (541:8): [True: 36, False: 237k]
  ------------------
  542|   237k|			    sec) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|   237k|#define CAST(T, b)	((T)(b))
  ------------------
  543|     36|				DPRINTF(("Reading sector %d",
  544|     36|				    CDF_TOLE4(msa[k])));
  545|     36|				goto out2;
  546|     36|			}
  547|   237k|		}
  548|  26.8k|		mid = CDF_TOLE4(CAST(uint32_t, msa[nsatpersec]));
  ------------------
  |  |   84|  26.8k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  53.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 26.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  549|  26.8k|	}
  550|    936|out:
  551|    936|	sat->sat_len = i;
  552|    936|	free(msa);
  553|    936|	return 0;
  554|      2|out3:
  555|      2|	errno = EFTYPE;
  ------------------
  |  |   59|      2|#define EFTYPE EINVAL
  ------------------
  556|    102|out2:
  557|    102|	free(msa);
  558|    128|out1:
  559|    128|	free(sat->sat_tab);
  560|    128|	return -1;
  561|    102|}
cdf_count_chain:
  565|  2.23k|{
  566|  2.23k|	size_t i, j;
  567|  2.23k|	cdf_secid_t maxsector;
  568|       |
  569|  2.23k|	if (size == 0 || sat->sat_len > SIZE_MAX / size)
  ------------------
  |  Branch (569:6): [True: 0, False: 2.23k]
  |  Branch (569:19): [True: 0, False: 2.23k]
  ------------------
  570|      0|		goto out;
  571|  2.23k|	maxsector = CAST(cdf_secid_t, (sat->sat_len * size) /
  ------------------
  |  |  460|  2.23k|#define CAST(T, b)	((T)(b))
  ------------------
  572|  2.23k|	    sizeof(maxsector));
  573|       |
  574|  2.23k|	DPRINTF(("Chain:"));
  575|  2.23k|	if (sid == CDF_SECID_END_OF_CHAIN) {
  ------------------
  |  |   56|  2.23k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (575:6): [True: 29, False: 2.20k]
  ------------------
  576|       |		/* 0-length chain. */
  577|     29|		DPRINTF((" empty\n"));
  578|     29|		return 0;
  579|     29|	}
  580|       |
  581|   274k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (581:18): [True: 273k, False: 1.83k]
  ------------------
  582|   273k|		DPRINTF((" %d", sid));
  583|   273k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   273k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (583:7): [True: 25, False: 272k]
  ------------------
  584|     25|			DPRINTF(("Counting chain loop limit"));
  585|     25|			goto out;
  586|     25|		}
  587|   272k|		if (i >= CDF_MEMORY_LIMIT / size) {
  ------------------
  |  |   52|   272k|#define CDF_MEMORY_LIMIT				(16 * 1024 * 1024)
  ------------------
  |  Branch (587:7): [True: 5, False: 272k]
  ------------------
  588|      5|			DPRINTF(("Counting chain size limit"));
  589|      5|			goto out;
  590|      5|		}
  591|   272k|		if (sid >= maxsector) {
  ------------------
  |  Branch (591:7): [True: 337, False: 272k]
  ------------------
  592|    337|			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
  593|    337|			goto out;
  594|    337|		}
  595|   272k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|   272k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|   545k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 272k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  596|   272k|	}
  597|  1.83k|	if (i == 0) {
  ------------------
  |  Branch (597:6): [True: 211, False: 1.62k]
  ------------------
  598|    211|		DPRINTF((" none, sid: %d\n", sid));
  599|    211|		goto out;
  600|       |
  601|    211|	}
  602|  1.62k|	DPRINTF(("\n"));
  603|  1.62k|	return i;
  604|    578|out:
  605|    578|	errno = EFTYPE;
  ------------------
  |  |   59|    578|#define EFTYPE EINVAL
  ------------------
  606|    578|	return CAST(size_t, -1);
  ------------------
  |  |  460|    578|#define CAST(T, b)	((T)(b))
  ------------------
  607|  1.83k|}
cdf_read_long_sector_chain:
  612|    471|{
  613|    471|	size_t ss = CDF_SEC_SIZE(h), i, j;
  ------------------
  |  |   81|    471|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    471|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  614|    471|	ssize_t nr;
  615|    471|	scn->sst_tab = NULL;
  616|    471|	scn->sst_len = cdf_count_chain(sat, sid, ss);
  617|    471|	scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
  ------------------
  |  Branch (617:20): [True: 312, False: 159]
  ------------------
  618|    471|	scn->sst_ss = ss;
  619|       |
  620|    471|	if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
  ------------------
  |  |   56|    942|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (620:6): [True: 3, False: 468]
  |  Branch (620:39): [True: 91, False: 377]
  ------------------
  621|     94|		return cdf_zero_stream(scn);
  622|       |
  623|    377|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  460|    377|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (623:6): [True: 73, False: 304]
  ------------------
  624|     73|		goto out;
  625|       |
  626|    304|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|    304|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  627|    304|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (627:6): [True: 0, False: 304]
  ------------------
  628|      0|		return cdf_zero_stream(scn);
  629|       |
  630|  1.46k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (630:18): [True: 1.18k, False: 284]
  ------------------
  631|  1.18k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.18k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (631:7): [True: 0, False: 1.18k]
  ------------------
  632|      0|			DPRINTF(("Read long sector chain loop limit"));
  633|      0|			goto out;
  634|      0|		}
  635|  1.18k|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (635:7): [True: 0, False: 1.18k]
  ------------------
  636|      0|			DPRINTF(("Out of bounds reading long sector chain "
  637|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  638|      0|			    scn->sst_len));
  639|      0|			goto out;
  640|      0|		}
  641|  1.18k|		if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (641:7): [True: 20, False: 1.16k]
  ------------------
  642|  1.18k|		    sid)) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  1.18k|#define CAST(T, b)	((T)(b))
  ------------------
  643|     20|			if (i == scn->sst_len - 1 && nr > 0) {
  ------------------
  |  Branch (643:8): [True: 8, False: 12]
  |  Branch (643:33): [True: 0, False: 8]
  ------------------
  644|       |				/* Last sector might be truncated */
  645|      0|				return 0;
  646|      0|			}
  647|     20|			DPRINTF(("Reading long sector chain %d", sid));
  648|     20|			goto out;
  649|     20|		}
  650|  1.16k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.16k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  2.32k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 1.16k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  651|  1.16k|	}
  652|    284|	return 0;
  653|     93|out:
  654|     93|	errno = EFTYPE;
  ------------------
  |  |   59|     93|#define EFTYPE EINVAL
  ------------------
  655|     93|	return cdf_zero_stream(scn);
  656|    304|}
cdf_read_short_sector_chain:
  662|    171|{
  663|    171|	size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
  ------------------
  |  |   83|    171|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    171|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  664|    171|	scn->sst_tab = NULL;
  665|    171|	scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
  ------------------
  |  |   81|    171|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    171|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  666|    171|	scn->sst_dirlen = len;
  667|    171|	scn->sst_ss = ss;
  668|       |
  669|    171|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  460|    171|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (669:6): [True: 102, False: 69]
  ------------------
  670|    102|		goto out;
  671|       |
  672|     69|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|     69|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  673|     69|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (673:6): [True: 0, False: 69]
  ------------------
  674|      0|		return cdf_zero_stream(scn);
  675|       |
  676|    253|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (676:18): [True: 193, False: 60]
  ------------------
  677|    193|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    193|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (677:7): [True: 0, False: 193]
  ------------------
  678|      0|			DPRINTF(("Read short sector chain loop limit"));
  679|      0|			goto out;
  680|      0|		}
  681|    193|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (681:7): [True: 0, False: 193]
  ------------------
  682|      0|			DPRINTF(("Out of bounds reading short sector chain "
  683|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n",
  684|      0|			    i, scn->sst_len));
  685|      0|			goto out;
  686|      0|		}
  687|    193|		if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (687:7): [True: 9, False: 184]
  ------------------
  688|    193|		    sid) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|    193|#define CAST(T, b)	((T)(b))
  ------------------
  689|      9|			DPRINTF(("Reading short sector chain %d", sid));
  690|      9|			goto out;
  691|      9|		}
  692|    184|		sid = CDF_TOLE4(CAST(uint32_t, ssat->sat_tab[sid]));
  ------------------
  |  |   84|    184|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    368|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 184]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  693|    184|	}
  694|     60|	return 0;
  695|    111|out:
  696|    111|	errno = EFTYPE;
  ------------------
  |  |   59|    111|#define EFTYPE EINVAL
  ------------------
  697|    111|	return cdf_zero_stream(scn);
  698|     69|}
cdf_read_sector_chain:
  704|    363|{
  705|       |
  706|    363|	if (len < h->h_min_size_standard_stream && sst->sst_tab != NULL)
  ------------------
  |  Branch (706:6): [True: 253, False: 110]
  |  Branch (706:45): [True: 171, False: 82]
  ------------------
  707|    171|		return cdf_read_short_sector_chain(h, ssat, sst, sid, len,
  708|    171|		    scn);
  709|    192|	else
  710|    192|		return cdf_read_long_sector_chain(info, h, sat, sid, len, scn);
  711|    363|}
cdf_read_dir:
  716|    656|{
  717|    656|	size_t i, j;
  718|    656|	size_t ss = CDF_SEC_SIZE(h), ns, nd;
  ------------------
  |  |   81|    656|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    656|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  719|    656|	char *buf;
  720|    656|	cdf_secid_t sid = h->h_secid_first_directory;
  721|       |
  722|    656|	ns = cdf_count_chain(sat, sid, ss);
  723|    656|	if (ns == CAST(size_t, -1))
  ------------------
  |  |  460|    656|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (723:6): [True: 84, False: 572]
  ------------------
  724|     84|		return -1;
  725|       |
  726|    572|	nd = ss / CDF_DIRECTORY_SIZE;
  ------------------
  |  |  118|    572|#define CDF_DIRECTORY_SIZE	128
  ------------------
  727|    572|	if (nd != 0 && ns > CDF_MEMORY_LIMIT / nd / sizeof(dir->dir_tab[0])) {
  ------------------
  |  |   52|    533|#define CDF_MEMORY_LIMIT				(16 * 1024 * 1024)
  ------------------
  |  Branch (727:6): [True: 533, False: 39]
  |  Branch (727:17): [True: 0, False: 533]
  ------------------
  728|      0|		DPRINTF(("Directory size limit"));
  729|      0|		errno = EFTYPE;
  ------------------
  |  |   59|      0|#define EFTYPE EINVAL
  ------------------
  730|      0|		return -1;
  731|      0|	}
  732|       |
  733|    572|	dir->dir_len = ns * nd;
  734|    572|	dir->dir_tab = CAST(cdf_directory_t *,
  ------------------
  |  |  460|    572|#define CAST(T, b)	((T)(b))
  ------------------
  735|    572|	    CDF_CALLOC(dir->dir_len, sizeof(dir->dir_tab[0])));
  736|    572|	if (dir->dir_tab == NULL)
  ------------------
  |  Branch (736:6): [True: 0, False: 572]
  ------------------
  737|      0|		return -1;
  738|       |
  739|    572|	if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
  ------------------
  |  |  460|    572|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (739:6): [True: 0, False: 572]
  ------------------
  740|      0|		free(dir->dir_tab);
  741|      0|		return -1;
  742|      0|	}
  743|       |
  744|  2.56k|	for (j = i = 0; i < ns; i++, j++) {
  ------------------
  |  Branch (744:18): [True: 1.99k, False: 565]
  ------------------
  745|  1.99k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.99k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (745:7): [True: 0, False: 1.99k]
  ------------------
  746|      0|			DPRINTF(("Read dir loop limit"));
  747|      0|			goto out;
  748|      0|		}
  749|  1.99k|		if (cdf_read_sector(info, buf, 0, ss, h, sid) !=
  ------------------
  |  Branch (749:7): [True: 7, False: 1.98k]
  ------------------
  750|  1.99k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  1.99k|#define CAST(T, b)	((T)(b))
  ------------------
  751|      7|			DPRINTF(("Reading directory sector %d", sid));
  752|      7|			goto out;
  753|      7|		}
  754|  11.6k|		for (j = 0; j < nd; j++) {
  ------------------
  |  Branch (754:15): [True: 9.69k, False: 1.98k]
  ------------------
  755|  9.69k|			cdf_unpack_dir(&dir->dir_tab[i * nd + j],
  756|  9.69k|			    &buf[j * CDF_DIRECTORY_SIZE]);
  ------------------
  |  |  118|  9.69k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  757|  9.69k|		}
  758|  1.98k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.98k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  3.97k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  759|  1.98k|	}
  760|    565|	if (NEED_SWAP)
  ------------------
  |  |   79|    565|#define NEED_SWAP	(cdf_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  460|    565|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (79:19): [True: 0, False: 565]
  |  |  ------------------
  ------------------
  761|      0|		for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (761:15): [True: 0, False: 0]
  ------------------
  762|      0|			cdf_swap_dir(&dir->dir_tab[i]);
  763|    565|	free(buf);
  764|    565|	return 0;
  765|      7|out:
  766|      7|	free(dir->dir_tab);
  767|      7|	free(buf);
  768|      7|	errno = EFTYPE;
  ------------------
  |  |   59|      7|#define EFTYPE EINVAL
  ------------------
  769|      7|	return -1;
  770|    572|}
cdf_read_ssat:
  776|    936|{
  777|    936|	size_t i, j;
  778|    936|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   81|    936|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    936|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  779|    936|	cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
  780|       |
  781|    936|	ssat->sat_tab = NULL;
  782|    936|	ssat->sat_len = cdf_count_chain(sat, sid, ss);
  783|    936|	if (ssat->sat_len == CAST(size_t, -1))
  ------------------
  |  |  460|    936|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (783:6): [True: 256, False: 680]
  ------------------
  784|    256|		goto out;
  785|       |
  786|    680|	ssat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(ssat->sat_len, ss));
  ------------------
  |  |  460|    680|#define CAST(T, b)	((T)(b))
  ------------------
  787|    680|	if (ssat->sat_tab == NULL)
  ------------------
  |  Branch (787:6): [True: 0, False: 680]
  ------------------
  788|      0|		goto out1;
  789|       |
  790|  2.17k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (790:18): [True: 1.51k, False: 656]
  ------------------
  791|  1.51k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.51k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (791:7): [True: 0, False: 1.51k]
  ------------------
  792|      0|			DPRINTF(("Read short sat sector loop limit"));
  793|      0|			goto out;
  794|      0|		}
  795|  1.51k|		if (i >= ssat->sat_len) {
  ------------------
  |  Branch (795:7): [True: 0, False: 1.51k]
  ------------------
  796|      0|			DPRINTF(("Out of bounds reading short sector chain "
  797|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  798|      0|			    ssat->sat_len));
  799|      0|			goto out;
  800|      0|		}
  801|  1.51k|		if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
  ------------------
  |  Branch (801:7): [True: 24, False: 1.49k]
  ------------------
  802|  1.51k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  1.51k|#define CAST(T, b)	((T)(b))
  ------------------
  803|     24|			DPRINTF(("Reading short sat sector %d", sid));
  804|     24|			goto out1;
  805|     24|		}
  806|  1.49k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.49k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  2.98k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 1.49k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  807|  1.49k|	}
  808|    656|	return 0;
  809|    256|out:
  810|    256|	errno = EFTYPE;
  ------------------
  |  |   59|    256|#define EFTYPE EINVAL
  ------------------
  811|    280|out1:
  812|    280|	free(ssat->sat_tab);
  813|    280|	return -1;
  814|    256|}
cdf_read_short_stream:
  820|    565|{
  821|    565|	size_t i;
  822|    565|	const cdf_directory_t *d;
  823|       |
  824|    565|	*root = NULL;
  825|  5.39k|	for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (825:14): [True: 5.15k, False: 241]
  ------------------
  826|  5.15k|		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
  ------------------
  |  |  102|  5.15k|#define CDF_DIR_TYPE_ROOT_STORAGE	5
  ------------------
  |  Branch (826:7): [True: 324, False: 4.83k]
  ------------------
  827|    324|			break;
  828|       |
  829|       |	/* If the it is not there, just fake it; some docs don't have it */
  830|    565|	if (i == dir->dir_len) {
  ------------------
  |  Branch (830:6): [True: 241, False: 324]
  ------------------
  831|    241|		DPRINTF(("Cannot find root storage dir\n"));
  832|    241|		goto out;
  833|    241|	}
  834|    324|	d = &dir->dir_tab[i];
  835|    324|	*root = d;
  836|       |
  837|       |	/* If the it is not there, just fake it; some docs don't have it */
  838|    324|	if (d->d_stream_first_sector < 0) {
  ------------------
  |  Branch (838:6): [True: 45, False: 279]
  ------------------
  839|     45|		DPRINTF(("No first secror in dir\n"));
  840|     45|		goto out;
  841|     45|	}
  842|       |
  843|    279|	return cdf_read_long_sector_chain(info, h, sat,
  844|    279|	    d->d_stream_first_sector, d->d_size, scn);
  845|    286|out:
  846|       |	scn->sst_tab = NULL;
  847|    286|	(void)cdf_zero_stream(scn);
  848|    286|	return 0;
  849|    324|}
cdf_namecmp:
  853|  9.47k|{
  854|  17.3k|	for (; l--; d++, s++)
  ------------------
  |  Branch (854:9): [True: 16.9k, False: 367]
  ------------------
  855|  16.9k|		if (*d != CDF_TOLE2(*s))
  ------------------
  |  |   86|  16.9k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  33.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 16.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (855:7): [True: 9.11k, False: 7.86k]
  ------------------
  856|  9.11k|			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |  460|  9.11k|#define CAST(T, b)	((T)(b))
  ------------------
              			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |   86|  9.11k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  18.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 9.11k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  857|    367|	return 0;
  858|  9.47k|}
cdf_read_doc_summary_info:
  864|    477|{
  865|    477|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  866|    477|	    "\05DocumentSummaryInformation", scn);
  867|    477|}
cdf_read_summary_info:
  873|    477|{
  874|    477|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  875|    477|	    "\05SummaryInformation", scn);
  876|    477|}
cdf_read_user_stream:
  882|  1.43k|{
  883|  1.43k|	const cdf_directory_t *d;
  884|  1.43k|	int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
  ------------------
  |  |   99|  1.43k|#define CDF_DIR_TYPE_USER_STREAM	2
  ------------------
  885|       |
  886|  1.43k|	if (i <= 0) {
  ------------------
  |  Branch (886:6): [True: 1.06k, False: 363]
  ------------------
  887|  1.06k|		memset(scn, 0, sizeof(*scn));
  888|  1.06k|		return -1;
  889|  1.06k|	}
  890|       |
  891|    363|	d = &dir->dir_tab[i - 1];
  892|    363|	return cdf_read_sector_chain(info, h, sat, ssat, sst,
  893|    363|	    d->d_stream_first_sector, d->d_size, scn);
  894|  1.43k|}
cdf_find_stream:
  898|  1.43k|{
  899|  1.43k|	size_t i, name_len = strlen(name) + 1;
  900|       |
  901|  20.8k|	for (i = 1; i <= dir->dir_len; i++)
  ------------------
  |  Branch (901:14): [True: 19.8k, False: 1.06k]
  ------------------
  902|  19.8k|		if (dir->dir_tab[i-1].d_type == type &&
  ------------------
  |  Branch (902:7): [True: 2.47k, False: 17.3k]
  ------------------
  903|  2.47k|		    cdf_namecmp(name, dir->dir_tab[i-1].d_name, name_len)
  ------------------
  |  Branch (903:7): [True: 363, False: 2.10k]
  ------------------
  904|  2.47k|		    == 0)
  905|    363|			break;
  906|  1.43k|	if (i <= dir->dir_len)
  ------------------
  |  Branch (906:6): [True: 363, False: 1.06k]
  ------------------
  907|    363|		return CAST(int, i);
  ------------------
  |  |  460|    363|#define CAST(T, b)	((T)(b))
  ------------------
  908|       |
  909|  1.06k|	DPRINTF(("Cannot find type %d `%s'\n", type, name));
  910|  1.06k|	errno = ESRCH;
  911|  1.06k|	return 0;
  912|  1.43k|}
cdf_read_property_info:
 1011|    112|{
 1012|    112|	const cdf_section_header_t *shp;
 1013|    112|	cdf_section_header_t sh;
 1014|    112|	const uint8_t *p, *q, *e;
 1015|    112|	size_t i, o4, nelements, j, slen, left;
 1016|    112|	cdf_property_info_t *inp;
 1017|       |
 1018|    112|	if (offs > UINT32_MAX / 4) {
  ------------------
  |  Branch (1018:6): [True: 12, False: 100]
  ------------------
 1019|     12|		errno = EFTYPE;
  ------------------
  |  |   59|     12|#define EFTYPE EINVAL
  ------------------
 1020|     12|		goto out;
 1021|     12|	}
 1022|    100|	shp = CAST(const cdf_section_header_t *,
  ------------------
  |  |  460|    100|#define CAST(T, b)	((T)(b))
  ------------------
 1023|    100|	    cdf_offset(sst->sst_tab, offs));
 1024|    100|	if (cdf_check_stream_offset(sst, h, &sh, sizeof(sh), __LINE__) == -1)
  ------------------
  |  Branch (1024:6): [True: 100, False: 0]
  ------------------
 1025|    100|		goto out;
 1026|      0|	memcpy(&sh, shp, sizeof(sh));
 1027|      0|	sh.sh_len = CDF_TOLE4(sh.sh_len);
  ------------------
  |  |   84|      0|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1028|      0|	if (sh.sh_len > CDF_SHLEN_LIMIT) {
  ------------------
  |  |  914|      0|#define CDF_SHLEN_LIMIT (UINT32_MAX / 64)
  ------------------
  |  Branch (1028:6): [True: 0, False: 0]
  ------------------
 1029|      0|		errno = EFTYPE;
  ------------------
  |  |   59|      0|#define EFTYPE EINVAL
  ------------------
 1030|      0|		goto out;
 1031|      0|	}
 1032|       |
 1033|      0|	if (cdf_check_stream_offset(sst, h, &sh, sh.sh_len, __LINE__) == -1)
  ------------------
  |  Branch (1033:6): [True: 0, False: 0]
  ------------------
 1034|      0|		goto out;
 1035|       |
 1036|      0|	sh.sh_properties = CDF_TOLE4(sh.sh_properties);
  ------------------
  |  |   84|      0|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1037|      0|	DPRINTF(("section len: %u properties %u\n", sh.sh_len,
 1038|      0|	    sh.sh_properties));
 1039|      0|	if (sh.sh_properties > CDF_PROP_LIMIT)
  ------------------
  |  |  915|      0|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (1039:6): [True: 0, False: 0]
  ------------------
 1040|      0|		goto out;
 1041|      0|	inp = cdf_grow_info(info, maxcount, sh.sh_properties);
 1042|      0|	if (inp == NULL)
  ------------------
  |  Branch (1042:6): [True: 0, False: 0]
  ------------------
 1043|      0|		goto out;
 1044|      0|	inp += *count;
 1045|      0|	*count += sh.sh_properties;
 1046|      0|	p = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1047|      0|	e = CAST(const uint8_t *, cdf_offset(&sh, sh.sh_len));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1048|      0|	if (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
  ------------------
  |  Branch (1048:6): [True: 0, False: 0]
  |  Branch (1048:16): [True: 0, False: 0]
  ------------------
 1049|      0|		goto out;
 1050|       |
 1051|      0|	for (i = 0; i < sh.sh_properties; i++) {
  ------------------
  |  Branch (1051:14): [True: 0, False: 0]
  ------------------
 1052|      0|		if ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)
  ------------------
  |  Branch (1052:7): [True: 0, False: 0]
  ------------------
 1053|      0|			goto out;
 1054|      0|		inp[i].pi_id = CDF_GETUINT32(p, i << 1);
  ------------------
  |  |   92|      0|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1055|      0|		left = CAST(size_t, e - q);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1056|      0|		if (left < sizeof(uint32_t)) {
  ------------------
  |  Branch (1056:7): [True: 0, False: 0]
  ------------------
 1057|      0|			DPRINTF(("short info (no type)_\n"));
 1058|      0|			goto out;
 1059|      0|		}
 1060|      0|		inp[i].pi_type = CDF_GETUINT32(q, 0);
  ------------------
  |  |   92|      0|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1061|      0|		DPRINTF(("%" SIZE_T_FORMAT "u) id=%#x type=%#x offs=%#tx,%#x\n",
 1062|      0|		    i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
 1063|      0|		if (inp[i].pi_type & CDF_VECTOR) {
  ------------------
  |  |  238|      0|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1063:7): [True: 0, False: 0]
  ------------------
 1064|      0|			if (left < sizeof(uint32_t) * 2) {
  ------------------
  |  Branch (1064:8): [True: 0, False: 0]
  ------------------
 1065|      0|				DPRINTF(("missing CDF_VECTOR length\n"));
 1066|      0|				goto out;
 1067|      0|			}
 1068|      0|			nelements = CDF_GETUINT32(q, 1);
  ------------------
  |  |   92|      0|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1069|      0|			if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
  ------------------
  |  |   51|      0|#define CDF_ELEMENT_LIMIT				100000
  ------------------
  |  Branch (1069:8): [True: 0, False: 0]
  |  Branch (1069:41): [True: 0, False: 0]
  ------------------
 1070|      0|				DPRINTF(("CDF_VECTOR with nelements == %"
 1071|      0|				    SIZE_T_FORMAT "u\n", nelements));
 1072|      0|				goto out;
 1073|      0|			}
 1074|      0|			slen = 2;
 1075|      0|		} else {
 1076|      0|			nelements = 1;
 1077|      0|			slen = 1;
 1078|      0|		}
 1079|      0|		o4 = slen * sizeof(uint32_t);
 1080|      0|		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  239|      0|#define CDF_ARRAY		0x00002000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  240|      0|#define CDF_BYREF		0x00004000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  241|      0|#define CDF_RESERVED		0x00008000
  ------------------
  |  Branch (1080:7): [True: 0, False: 0]
  ------------------
 1081|      0|			goto unknown;
 1082|      0|		switch (inp[i].pi_type & CDF_TYPEMASK) {
  ------------------
  |  |  244|      0|#define CDF_TYPEMASK		0x00000fff
  ------------------
 1083|      0|		case CDF_NULL:
  ------------------
  |  |  199|      0|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (1083:3): [True: 0, False: 0]
  ------------------
 1084|      0|		case CDF_EMPTY:
  ------------------
  |  |  198|      0|#define CDF_EMPTY		0x00000000
  ------------------
  |  Branch (1084:3): [True: 0, False: 0]
  ------------------
 1085|      0|			break;
 1086|      0|		case CDF_SIGNED16:
  ------------------
  |  |  200|      0|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (1086:3): [True: 0, False: 0]
  ------------------
 1087|      0|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))
  ------------------
  |  Branch (1087:8): [True: 0, False: 0]
  ------------------
 1088|      0|				goto unknown;
 1089|      0|			break;
 1090|      0|		case CDF_SIGNED32:
  ------------------
  |  |  201|      0|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (1090:3): [True: 0, False: 0]
  ------------------
 1091|      0|		case CDF_BOOL:
  ------------------
  |  |  209|      0|#define CDF_BOOL		0x0000000b
  ------------------
  |  Branch (1091:3): [True: 0, False: 0]
  ------------------
 1092|      0|		case CDF_UNSIGNED32:
  ------------------
  |  |  216|      0|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (1092:3): [True: 0, False: 0]
  ------------------
 1093|      0|		case CDF_FLOAT:
  ------------------
  |  |  202|      0|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (1093:3): [True: 0, False: 0]
  ------------------
 1094|      0|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))
  ------------------
  |  Branch (1094:8): [True: 0, False: 0]
  ------------------
 1095|      0|				goto unknown;
 1096|      0|			break;
 1097|      0|		case CDF_SIGNED64:
  ------------------
  |  |  217|      0|#define CDF_SIGNED64		0x00000014
  ------------------
  |  Branch (1097:3): [True: 0, False: 0]
  ------------------
 1098|      0|		case CDF_UNSIGNED64:
  ------------------
  |  |  218|      0|#define CDF_UNSIGNED64		0x00000015
  ------------------
  |  Branch (1098:3): [True: 0, False: 0]
  ------------------
 1099|      0|		case CDF_DOUBLE:
  ------------------
  |  |  203|      0|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (1099:3): [True: 0, False: 0]
  ------------------
 1100|      0|		case CDF_FILETIME:
  ------------------
  |  |  229|      0|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (1100:3): [True: 0, False: 0]
  ------------------
 1101|      0|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))
  ------------------
  |  Branch (1101:8): [True: 0, False: 0]
  ------------------
 1102|      0|				goto unknown;
 1103|      0|			break;
 1104|      0|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  227|      0|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (1104:3): [True: 0, False: 0]
  ------------------
 1105|      0|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  228|      0|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (1105:3): [True: 0, False: 0]
  ------------------
 1106|      0|			if (nelements > 1) {
  ------------------
  |  Branch (1106:8): [True: 0, False: 0]
  ------------------
 1107|      0|				size_t nelem = inp - *info;
 1108|      0|				inp = cdf_grow_info(info, maxcount, nelements);
 1109|      0|				if (inp == NULL)
  ------------------
  |  Branch (1109:9): [True: 0, False: 0]
  ------------------
 1110|      0|					goto out;
 1111|      0|				inp += nelem;
 1112|      0|			}
 1113|      0|			for (j = 0; j < nelements && i < sh.sh_properties;
  ------------------
  |  Branch (1113:16): [True: 0, False: 0]
  |  Branch (1113:33): [True: 0, False: 0]
  ------------------
 1114|      0|			    j++, i++)
 1115|      0|			{
 1116|      0|				uint32_t l;
 1117|       |
 1118|      0|				if (o4 + sizeof(uint32_t) > left)
  ------------------
  |  Branch (1118:9): [True: 0, False: 0]
  ------------------
 1119|      0|					goto out;
 1120|       |
 1121|      0|				l = CDF_GETUINT32(q, slen);
  ------------------
  |  |   92|      0|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1122|      0|				o4 += sizeof(uint32_t);
 1123|      0|				if (o4 + l > left)
  ------------------
  |  Branch (1123:9): [True: 0, False: 0]
  ------------------
 1124|      0|					goto out;
 1125|       |
 1126|      0|				inp[i].pi_str.s_len = l;
  ------------------
  |  |  192|      0|#define pi_str	pi_val._pi_str
  ------------------
 1127|      0|				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  192|      0|#define pi_str	pi_val._pi_str
  ------------------
              				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1128|      0|				    CAST(const void *, &q[o4]));
 1129|       |
 1130|      0|				DPRINTF(("o=%" SIZE_T_FORMAT "u l=%d(%"
 1131|      0|				    SIZE_T_FORMAT "u), t=%" SIZE_T_FORMAT
 1132|      0|				    "u s=%.*s\n", o4, l,
 1133|      0|				    CDF_ROUND(l, sizeof(l)),
 1134|      0|				    left, (int)l, inp[i].pi_str.s_buf));
 1135|       |
 1136|      0|				if (l & 1)
  ------------------
  |  Branch (1136:9): [True: 0, False: 0]
  ------------------
 1137|      0|					l++;
 1138|       |
 1139|      0|				slen += l >> 1;
 1140|      0|				o4 = slen * sizeof(uint32_t);
 1141|      0|			}
 1142|      0|			i--;
 1143|      0|			break;
 1144|      0|		case CDF_CLIPBOARD:
  ------------------
  |  |  236|      0|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (1144:3): [True: 0, False: 0]
  ------------------
 1145|      0|			if (inp[i].pi_type & CDF_VECTOR)
  ------------------
  |  |  238|      0|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1145:8): [True: 0, False: 0]
  ------------------
 1146|      0|				goto unknown;
 1147|      0|			break;
 1148|      0|		default:
  ------------------
  |  Branch (1148:3): [True: 0, False: 0]
  ------------------
 1149|      0|		unknown:
 1150|      0|			memset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));
 1151|      0|			DPRINTF(("Don't know how to deal with %#x\n",
 1152|      0|			    inp[i].pi_type));
 1153|      0|			break;
 1154|      0|		}
 1155|      0|	}
 1156|      0|	return 0;
 1157|    112|out:
 1158|    112|	free(*info);
 1159|    112|	*info = NULL;
 1160|    112|	*count = 0;
 1161|    112|	*maxcount = 0;
 1162|    112|	errno = EFTYPE;
  ------------------
  |  |   59|    112|#define EFTYPE EINVAL
  ------------------
 1163|    112|	return -1;
 1164|      0|}
cdf_unpack_summary_info:
 1169|    139|{
 1170|    139|	size_t maxcount;
 1171|    139|	const cdf_summary_info_header_t *si =
 1172|    139|	    CAST(const cdf_summary_info_header_t *, sst->sst_tab);
  ------------------
  |  |  460|    139|#define CAST(T, b)	((T)(b))
  ------------------
 1173|    139|	const cdf_section_declaration_t *sd =
 1174|    139|	    CAST(const cdf_section_declaration_t *, RCAST(const void *,
  ------------------
  |  |  460|    139|#define CAST(T, b)	((T)(b))
  ------------------
 1175|    139|	    RCAST(const char *, sst->sst_tab)
 1176|    139|	    + CDF_SECTION_DECLARATION_OFFSET));
 1177|       |
 1178|    139|	if (cdf_check_stream_offset(sst, h, si, sizeof(*si), __LINE__) == -1 ||
  ------------------
  |  Branch (1178:6): [True: 22, False: 117]
  ------------------
 1179|    117|	    cdf_check_stream_offset(sst, h, sd, sizeof(*sd), __LINE__) == -1)
  ------------------
  |  Branch (1179:6): [True: 5, False: 112]
  ------------------
 1180|     27|		return -1;
 1181|    112|	ssi->si_byte_order = CDF_TOLE2(si->si_byte_order);
  ------------------
  |  |   86|    112|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1182|    112|	ssi->si_os_version = CDF_TOLE2(si->si_os_version);
  ------------------
  |  |   86|    112|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1183|    112|	ssi->si_os = CDF_TOLE2(si->si_os);
  ------------------
  |  |   86|    112|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1184|    112|	ssi->si_class = si->si_class;
 1185|    112|	cdf_swap_class(&ssi->si_class);
 1186|    112|	ssi->si_count = CDF_TOLE4(si->si_count);
  ------------------
  |  |   84|    112|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1187|    112|	*count = 0;
 1188|    112|	maxcount = 0;
 1189|    112|	*info = NULL;
 1190|    112|	if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
  ------------------
  |  |   84|    112|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    224|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1190:6): [True: 112, False: 0]
  ------------------
 1191|    112|	    count, &maxcount) == -1)
 1192|    112|		return -1;
 1193|      0|	return 0;
 1194|    112|}
cdf.c:cdf_read:
  371|   330k|{
  372|   330k|	size_t siz = CAST(size_t, off + len);
  ------------------
  |  |  460|   330k|#define CAST(T, b)	((T)(b))
  ------------------
  373|       |
  374|   330k|	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  460|   330k|#define CAST(T, b)	((T)(b))
  ------------------
              	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  460|   330k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (374:6): [True: 0, False: 330k]
  ------------------
  375|      0|		goto out;
  376|       |
  377|   330k|	if (info->i_buf != NULL && info->i_len >= siz) {
  ------------------
  |  Branch (377:6): [True: 330k, False: 0]
  |  Branch (377:29): [True: 318k, False: 12.2k]
  ------------------
  378|   318k|		(void)memcpy(buf, &info->i_buf[off], len);
  379|   318k|		return CAST(ssize_t, len);
  ------------------
  |  |  460|   318k|#define CAST(T, b)	((T)(b))
  ------------------
  380|   318k|	}
  381|       |
  382|  12.2k|	if (info->i_fd == -1)
  ------------------
  |  Branch (382:6): [True: 3.96k, False: 8.29k]
  ------------------
  383|  3.96k|		goto out;
  384|       |
  385|  8.29k|	if (pread(info->i_fd, buf, len, off) != CAST(ssize_t, len))
  ------------------
  |  |  460|  8.29k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (385:6): [True: 8.29k, False: 0]
  ------------------
  386|  8.29k|		return -1;
  387|       |
  388|      0|	return CAST(ssize_t, len);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  389|  3.96k|out:
  390|  3.96k|	errno = EINVAL;
  391|  3.96k|	return -1;
  392|  8.29k|}
cdf.c:cdf_calloc:
  125|  3.72k|{
  126|  3.72k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u %"
  127|  3.72k|	    SIZE_T_FORMAT "u\n", file, line, __func__, n, u));
  128|  3.72k|	if (n == 0)
  ------------------
  |  Branch (128:6): [True: 66, False: 3.66k]
  ------------------
  129|     66|	    n++;
  130|  3.72k|	return calloc(n, u);
  131|  3.72k|}
cdf.c:cdf_malloc:
  103|    572|{
  104|    572|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  105|    572|	    file, line, __func__, n));
  106|    572|	if (n == 0)
  ------------------
  |  Branch (106:6): [True: 0, False: 572]
  ------------------
  107|      0|	    n++;
  108|    572|	return malloc(n);
  109|    572|}
cdf.c:cdf_offset:
  919|    100|{
  920|    100|	return CAST(const void *, CAST(const uint8_t *, p) + l);
  ------------------
  |  |  460|    100|#define CAST(T, b)	((T)(b))
  ------------------
  921|    100|}
cdf.c:cdf_check_stream_offset:
  354|    356|{
  355|    356|	const char *b = RCAST(const char *, sst->sst_tab);
  ------------------
  |  |  461|    356|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  356|    356|	const char *e = RCAST(const char *, p) + tail;
  ------------------
  |  |  461|    356|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  357|    356|	size_t ss = cdf_check_stream(sst, h);
  358|    356|	/*LINTED*/(void)&line;
  359|    356|	if (e >= b && CAST(size_t, e - b) <= ss * sst->sst_len)
  ------------------
  |  |  460|    356|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (359:6): [True: 356, False: 0]
  |  Branch (359:16): [True: 229, False: 127]
  ------------------
  360|    229|		return 0;
  361|    127|	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
  362|    127|	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
  363|    127|	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
  364|    127|	    ss * sst->sst_len, ss, sst->sst_len));
  365|    127|	errno = EFTYPE;
  ------------------
  |  |   59|    127|#define EFTYPE EINVAL
  ------------------
  366|    127|	return -1;
  367|    356|}
cdf.c:cdf_check_stream:
  344|    356|{
  345|    356|	size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
  ------------------
  |  Branch (345:14): [True: 110, False: 246]
  ------------------
  346|    356|	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   83|    110|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    110|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   81|    246|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    246|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  347|    356|	assert(ss == sst->sst_ss);
  ------------------
  |  Branch (347:2): [True: 0, False: 356]
  |  Branch (347:2): [True: 356, False: 0]
  ------------------
  348|    356|	return sst->sst_ss;
  349|    356|}

cdf_timestamp_to_timespec:
  100|  1.40k|{
  101|  1.40k|	struct tm tm;
  102|  1.40k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  103|  1.40k|	file_private char UTC[] = "UTC";
  ------------------
  |  |  116|  1.40k|#define file_private static
  ------------------
  104|  1.40k|#endif
  105|  1.40k|	int rdays;
  106|       |
  107|       |	/* Unit is 100's of nanoseconds */
  108|  1.40k|	ts->tv_nsec = (t % CDF_TIME_PREC) * 100;
  ------------------
  |  |   91|  1.40k|#define CDF_TIME_PREC	10000000
  ------------------
  109|       |
  110|  1.40k|	t /= CDF_TIME_PREC;
  ------------------
  |  |   91|  1.40k|#define CDF_TIME_PREC	10000000
  ------------------
  111|  1.40k|	tm.tm_sec = CAST(int, t % 60);
  ------------------
  |  |  460|  1.40k|#define CAST(T, b)	((T)(b))
  ------------------
  112|  1.40k|	t /= 60;
  113|       |
  114|  1.40k|	tm.tm_min = CAST(int, t % 60);
  ------------------
  |  |  460|  1.40k|#define CAST(T, b)	((T)(b))
  ------------------
  115|  1.40k|	t /= 60;
  116|       |
  117|  1.40k|	tm.tm_hour = CAST(int, t % 24);
  ------------------
  |  |  460|  1.40k|#define CAST(T, b)	((T)(b))
  ------------------
  118|  1.40k|	t /= 24;
  119|       |
  120|       |	/* XXX: Approx */
  121|  1.40k|	tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
  ------------------
  |  |  460|  1.40k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  1.40k|	if (tm.tm_year > 9999)
  ------------------
  |  Branch (123:6): [True: 132, False: 1.26k]
  ------------------
  124|    132|		goto out;
  125|       |
  126|  1.26k|	rdays = cdf_getdays(tm.tm_year);
  127|  1.26k|	t -= rdays - 1;
  128|  1.26k|	tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
  ------------------
  |  |  460|  1.26k|#define CAST(T, b)	((T)(b))
  ------------------
  129|  1.26k|	tm.tm_mon = cdf_getmonth(tm.tm_year, CAST(int, t));
  ------------------
  |  |  460|  1.26k|#define CAST(T, b)	((T)(b))
  ------------------
  130|  1.26k|	tm.tm_wday = 0;
  131|  1.26k|	tm.tm_yday = 0;
  132|  1.26k|	tm.tm_isdst = 0;
  133|  1.26k|#ifdef HAVE_STRUCT_TM_TM_GMTOFF
  134|  1.26k|	tm.tm_gmtoff = 0;
  135|  1.26k|#endif
  136|  1.26k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  137|  1.26k|	tm.tm_zone = UTC;
  138|  1.26k|#endif
  139|  1.26k|	tm.tm_year -= 1900;
  140|  1.26k|	ts->tv_sec = mktime(&tm);
  141|  1.26k|	if (ts->tv_sec == -1)
  ------------------
  |  Branch (141:6): [True: 0, False: 1.26k]
  ------------------
  142|      0|		goto out;
  143|  1.26k|	return 0;
  144|    132|out:
  145|    132|	errno = EINVAL;
  146|    132|	return -1;
  147|  1.26k|}
cdf_time.c:cdf_getdays:
   53|  1.26k|{
   54|  1.26k|	int days = 0;
   55|  1.26k|	int y;
   56|       |
   57|   701k|	for (y = CDF_BASE_YEAR; y < year; y++)
  ------------------
  |  |   90|  1.26k|#define CDF_BASE_YEAR	1601
  ------------------
  |  Branch (57:26): [True: 700k, False: 1.26k]
  ------------------
   58|   700k|		days += isleap(y) + 365;
  ------------------
  |  |   41|   700k|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 174k, False: 525k]
  |  |  ------------------
  |  |   42|   700k|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 168k, False: 6.60k]
  |  |  |  Branch (42:28): [True: 1.49k, False: 5.11k]
  |  |  ------------------
  ------------------
   59|       |
   60|  1.26k|	return days;
   61|  1.26k|}
cdf_time.c:cdf_getday:
   68|  1.26k|{
   69|  1.26k|	size_t m;
   70|       |
   71|  5.06k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  138|  5.06k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (71:14): [True: 5.01k, False: 52]
  ------------------
   72|  5.01k|		int sub = mdays[m] + (m == 1 && isleap(year));
  ------------------
  |  |   41|    628|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 273, False: 355]
  |  |  ------------------
  |  |   42|    628|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 127, False: 146]
  |  |  |  Branch (42:28): [True: 74, False: 72]
  |  |  ------------------
  ------------------
  |  Branch (72:25): [True: 628, False: 4.38k]
  ------------------
   73|  5.01k|		if (days < sub)
  ------------------
  |  Branch (73:7): [True: 1.21k, False: 3.80k]
  ------------------
   74|  1.21k|			return days;
   75|  3.80k|		days -= sub;
   76|  3.80k|	}
   77|     52|	return days;
   78|  1.26k|}
cdf_time.c:cdf_getmonth:
   85|  1.26k|{
   86|  1.26k|	size_t m;
   87|       |
   88|  4.99k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  138|  4.99k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (88:14): [True: 4.99k, False: 0]
  ------------------
   89|  4.99k|		days -= mdays[m];
   90|  4.99k|		if (m == 1 && isleap(year))
  ------------------
  |  |   41|    628|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 273, False: 355]
  |  |  ------------------
  |  |   42|    628|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 127, False: 146]
  |  |  |  Branch (42:28): [True: 74, False: 72]
  |  |  ------------------
  ------------------
  |  Branch (90:7): [True: 628, False: 4.37k]
  ------------------
   91|    201|			days--;
   92|  4.99k|		if (days <= 0)
  ------------------
  |  Branch (92:7): [True: 1.26k, False: 3.73k]
  ------------------
   93|  1.26k|			return CAST(int, m);
  ------------------
  |  |  460|  1.26k|#define CAST(T, b)	((T)(b))
  ------------------
   94|  4.99k|	}
   95|      0|	return CAST(int, m);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
   96|  1.26k|}

file_zmagic:
  306|  18.3k|{
  307|  18.3k|	unsigned char *newbuf = NULL;
  308|  18.3k|	size_t i, nsz;
  309|  18.3k|	char *rbuf;
  310|  18.3k|	file_pushbuf_t *pb;
  311|  18.3k|	int urv, prv, rv = 0;
  312|  18.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  18.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  18.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  18.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  313|  18.3k|	int fd = b->fd;
  314|  18.3k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  18.3k|#define CAST(T, b)	((T)(b))
  ------------------
  315|  18.3k|	size_t nbytes = b->flen;
  316|  18.3k|#ifdef HAVE_SIGACTION
  317|  18.3k|	int sa_saved = 0;
  318|  18.3k|	struct sigaction sig_act;
  319|  18.3k|#endif
  320|       |
  321|  18.3k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  18.3k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (321:6): [True: 6.33k, False: 11.9k]
  ------------------
  322|  6.33k|		return 0;
  323|       |
  324|   191k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (324:14): [True: 179k, False: 11.9k]
  ------------------
  325|   179k|		int zm;
  326|   179k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  460|   179k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (326:7): [True: 8.03k, False: 171k]
  ------------------
  327|  8.03k|			continue;
  328|   171k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (328:7): [True: 20.7k, False: 151k]
  ------------------
  329|  20.7k|			zm = (*compr[i].u.func)(buf);
  330|   151k|		} else {
  331|   151k|			zm = memcmp(buf, compr[i].u.magic,
  332|   151k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  460|   151k|#define CAST(T, b)	((T)(b))
  ------------------
  333|   151k|		}
  334|       |
  335|   171k|		if (!zm)
  ------------------
  |  Branch (335:7): [True: 168k, False: 3.35k]
  ------------------
  336|   168k|			continue;
  337|       |
  338|  3.35k|#ifdef HAVE_SIGACTION
  339|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  340|  3.35k|		if (!sa_saved) {
  ------------------
  |  Branch (340:7): [True: 2.96k, False: 396]
  ------------------
  341|       |			//We can use sig_act for both new and old, but
  342|  2.96k|			struct sigaction new_act;
  343|  2.96k|			memset(&new_act, 0, sizeof(new_act));
  344|  2.96k|			new_act.sa_handler = SIG_IGN;
  345|  2.96k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  346|  2.96k|		}
  347|  3.35k|#endif
  348|       |
  349|  3.35k|		nsz = nbytes;
  350|  3.35k|		free(newbuf);
  351|  3.35k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  352|  3.35k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  3.35k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  353|  3.35k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  354|  3.35k|		    (char *)newbuf, nsz);
  355|  3.35k|		switch (urv) {
  356|  3.12k|		case OKDATA:
  ------------------
  |  |  242|  3.12k|#define OKDATA 	0
  ------------------
  |  Branch (356:3): [True: 3.12k, False: 235]
  ------------------
  357|  3.35k|		case ERRDATA:
  ------------------
  |  |  244|  3.35k|#define ERRDATA	2
  ------------------
  |  Branch (357:3): [True: 235, False: 3.12k]
  ------------------
  358|  3.35k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  3.35k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  359|  3.35k|			if (urv == ERRDATA)
  ------------------
  |  |  244|  3.35k|#define ERRDATA	2
  ------------------
  |  Branch (359:8): [True: 235, False: 3.12k]
  ------------------
  360|    235|				prv = format_decompression_error(ms, i, newbuf);
  361|  3.12k|			else
  362|  3.12k|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  363|  3.12k|				    nsz);
  364|  3.35k|			if (prv == -1)
  ------------------
  |  Branch (364:8): [True: 0, False: 3.35k]
  ------------------
  365|      0|				goto error;
  366|  3.35k|			rv = 1;
  367|  3.35k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  3.35k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (367:8): [True: 0, False: 3.35k]
  ------------------
  368|      0|				goto out;
  369|  3.35k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  6.71k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  3.35k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  3.35k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (369:8): [True: 3.35k, False: 0]
  |  Branch (369:30): [True: 0, False: 3.35k]
  ------------------
  370|      0|				goto out;
  371|  3.35k|			if ((file_printf(ms,
  ------------------
  |  Branch (371:8): [True: 0, False: 3.35k]
  ------------------
  372|  3.35k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (372:8): [True: 0, False: 3.35k]
  ------------------
  373|      0|				goto error;
  374|  3.35k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (374:8): [True: 126, False: 3.23k]
  ------------------
  375|    126|				goto error;
  376|       |			/*
  377|       |			 * XXX: If file_buffer fails here, we overwrite
  378|       |			 * the compressed text. FIXME.
  379|       |			 */
  380|  3.23k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (380:8): [True: 0, False: 3.23k]
  ------------------
  381|      0|			{
  382|      0|				if (file_pop_buffer(ms, pb) != NULL)
  ------------------
  |  Branch (382:9): [True: 0, False: 0]
  ------------------
  383|      0|					abort();
  384|      0|				goto error;
  385|      0|			}
  386|  3.23k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (386:8): [True: 3.23k, False: 0]
  ------------------
  387|  3.23k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (387:9): [True: 6, False: 3.22k]
  ------------------
  388|      6|					free(rbuf);
  389|      6|					goto error;
  390|      6|				}
  391|  3.22k|				free(rbuf);
  392|  3.22k|			}
  393|  3.22k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (393:8): [True: 3.22k, False: 0]
  |  Branch (393:17): [True: 0, False: 3.22k]
  ------------------
  394|      0|				goto error;
  395|       |			/*FALLTHROUGH*/
  396|  3.22k|		case NODATA:
  ------------------
  |  |  243|  3.22k|#define NODATA	1
  ------------------
  |  Branch (396:3): [True: 0, False: 3.35k]
  ------------------
  397|  3.22k|			break;
  398|      0|		default:
  ------------------
  |  Branch (398:3): [True: 0, False: 3.35k]
  ------------------
  399|      0|			abort();
  400|       |			/*NOTREACHED*/
  401|    132|		error:
  402|    132|			rv = -1;
  403|    132|			break;
  404|  3.35k|		}
  405|  3.35k|	}
  406|  11.9k|out:
  407|  11.9k|	DPRINTF("rv = %d\n", rv);
  408|       |
  409|  11.9k|#ifdef HAVE_SIGACTION
  410|  11.9k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (410:6): [True: 2.96k, False: 9.03k]
  |  Branch (410:18): [True: 2.96k, False: 0]
  ------------------
  411|  2.96k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  412|  11.9k|#endif
  413|       |
  414|  11.9k|	free(newbuf);
  415|  11.9k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  11.9k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  416|  11.9k|	DPRINTF("Zmagic returns %d\n", rv);
  417|  11.9k|	return rv;
  418|  11.9k|}
sread:
  450|  6.44k|{
  451|  6.44k|	ssize_t rv;
  452|  6.44k|#if defined(FIONREAD) && defined(HAVE_IOCTL) && !defined(__MINGW32__)
  453|  6.44k|	int t = 0;
  454|  6.44k|#endif
  455|  6.44k|	size_t rn = n;
  456|       |
  457|  6.44k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (457:6): [True: 0, False: 6.44k]
  ------------------
  458|      0|		goto nocheck;
  459|       |
  460|  6.44k|#if defined(FIONREAD) && defined(HAVE_IOCTL) && !defined(__MINGW32__)
  461|  6.44k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (461:6): [True: 0, False: 6.44k]
  |  Branch (461:20): [True: 0, False: 0]
  |  Branch (461:53): [True: 0, False: 0]
  ------------------
  462|      0|#if defined(FD_ZERO) && defined(HAVE_SELECT)
  463|      0|		ssize_t cnt;
  464|      0|		for (cnt = 0;; cnt++) {
  465|      0|			fd_set check;
  466|      0|			struct timeval tout = {0, 100 * 1000};
  467|      0|			int selrv;
  468|       |
  469|      0|			FD_ZERO(&check);
  ------------------
  |  Branch (469:4): [Folded, False: 0]
  ------------------
  470|      0|			FD_SET(fd, &check);
  471|       |
  472|       |			/*
  473|       |			 * Avoid soft deadlock: do not read if there
  474|       |			 * is nothing to read from sockets and pipes.
  475|       |			 */
  476|      0|			selrv = select(fd + 1, &check, NULL, NULL, &tout);
  477|      0|			if (selrv == -1) {
  ------------------
  |  Branch (477:8): [True: 0, False: 0]
  ------------------
  478|      0|				if (errno == EINTR || errno == EAGAIN)
  ------------------
  |  Branch (478:9): [True: 0, False: 0]
  |  Branch (478:27): [True: 0, False: 0]
  ------------------
  479|      0|					continue;
  480|      0|			} else if (selrv == 0 && cnt >= 5) {
  ------------------
  |  Branch (480:15): [True: 0, False: 0]
  |  Branch (480:29): [True: 0, False: 0]
  ------------------
  481|      0|				return 0;
  482|      0|			} else
  483|      0|				break;
  484|      0|		}
  485|      0|#endif
  486|      0|		(void)ioctl(fd, FIONREAD, &t);
  487|      0|	}
  488|       |
  489|  6.44k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (489:6): [True: 0, False: 6.44k]
  |  Branch (489:15): [True: 0, False: 0]
  ------------------
  490|      0|		n = t;
  491|      0|		rn = n;
  492|      0|	}
  493|  6.44k|#endif
  494|       |
  495|  6.44k|nocheck:
  496|  6.44k|	do
  497|   238k|		switch ((rv = read(fd, buf, n))) {
  498|      2|		case -1:
  ------------------
  |  Branch (498:3): [True: 2, False: 238k]
  ------------------
  499|      2|			if (errno == EINTR)
  ------------------
  |  Branch (499:8): [True: 2, False: 0]
  ------------------
  500|      2|				continue;
  501|      0|			return -1;
  502|  6.31k|		case 0:
  ------------------
  |  Branch (502:3): [True: 6.31k, False: 232k]
  ------------------
  503|  6.31k|			return rn - n;
  504|   232k|		default:
  ------------------
  |  Branch (504:3): [True: 232k, False: 6.31k]
  ------------------
  505|   232k|			n -= rv;
  506|   232k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  460|   232k|#define CAST(T, b)	((T)(b))
  ------------------
  507|   232k|			break;
  508|   238k|		}
  509|   232k|	while (n > 0);
  ------------------
  |  Branch (509:9): [True: 232k, False: 130]
  ------------------
  510|    130|	return rn;
  511|  6.44k|}
compress.c:lzmacmp:
  162|  8.72k|{
  163|  8.72k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (163:6): [True: 8.71k, False: 13]
  |  Branch (163:24): [True: 2, False: 11]
  |  Branch (163:34): [True: 1, False: 10]
  ------------------
  164|  8.71k|		return 0;
  165|     10|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (165:6): [True: 9, False: 1]
  |  Branch (165:17): [True: 8, False: 1]
  ------------------
  166|      8|		return 0;
  167|      2|	return 1;
  168|     10|}
compress.c:zlibcmp:
  145|  11.9k|{
  146|  11.9k|	unsigned short x;
  147|       |
  148|  11.9k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (148:6): [True: 11.8k, False: 109]
  |  Branch (148:29): [True: 25, False: 84]
  ------------------
  149|  11.9k|		return 0;
  150|     84|	if (file_bigendian())	/* endianness test */
  ------------------
  |  Branch (150:6): [True: 0, False: 84]
  ------------------
  151|      0|		x = buf[0] | (buf[1] << 8);
  152|     84|	else
  153|     84|		x = buf[1] | (buf[0] << 8);
  154|     84|	if (x % 31)
  ------------------
  |  Branch (154:6): [True: 61, False: 23]
  ------------------
  155|     61|		return 0;
  156|     23|	return 1;
  157|     84|}
compress.c:format_decompression_error:
  289|    235|{
  290|    235|	unsigned char *p;
  291|    235|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    235|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    235|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    235|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  292|       |
  293|    235|	if (!mime)
  ------------------
  |  Branch (293:6): [True: 235, False: 0]
  ------------------
  294|    235|		return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
  295|       |
  296|      0|	for (p = buf; *p; p++)
  ------------------
  |  Branch (296:16): [True: 0, False: 0]
  ------------------
  297|      0|		if (!isalnum(*p))
  ------------------
  |  Branch (297:7): [True: 0, False: 0]
  ------------------
  298|      0|			*p = '-';
  299|       |
  300|      0|	return file_printf(ms, "application/x-decompression-error-%s-%s",
  301|      0|	    methodname(i), buf);
  302|    235|}
compress.c:methodname:
 1115|    235|{
 1116|    235|	switch (method) {
 1117|      0|#ifdef BUILTIN_DECOMPRESS
 1118|     28|	case METH_FROZEN:
  ------------------
  |  |  210|     28|#define METH_FROZEN	2
  ------------------
  |  Branch (1118:2): [True: 28, False: 207]
  ------------------
 1119|     51|	case METH_ZLIB:
  ------------------
  |  |  218|     51|#define METH_ZLIB	14
  ------------------
  |  Branch (1119:2): [True: 23, False: 212]
  ------------------
 1120|     51|		return "zlib";
 1121|      0|#endif
 1122|      0|#ifdef BUILTIN_BZLIB
 1123|      4|	case METH_BZIP:
  ------------------
  |  |  211|      4|#define METH_BZIP	7
  ------------------
  |  Branch (1123:2): [True: 4, False: 231]
  ------------------
 1124|      4|		return "bzlib";
 1125|      0|#endif
 1126|      0|#ifdef BUILTIN_XZLIB
 1127|      1|	case METH_XZ:
  ------------------
  |  |  212|      1|#define METH_XZ		9
  ------------------
  |  Branch (1127:2): [True: 1, False: 234]
  ------------------
 1128|      3|	case METH_LZMA:
  ------------------
  |  |  217|      3|#define METH_LZMA	13
  ------------------
  |  Branch (1128:2): [True: 2, False: 233]
  ------------------
 1129|      3|		return "xzlib";
 1130|      0|#endif
 1131|      0|#ifdef BUILTIN_ZSTDLIB
 1132|      2|	case METH_ZSTD:
  ------------------
  |  |  216|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (1132:2): [True: 2, False: 233]
  ------------------
 1133|      2|		return "zstd";
 1134|      0|#endif
 1135|       |#ifdef BUILTIN_LZLIB
 1136|       |	case METH_LZIP:
 1137|       |		return "lzlib";
 1138|       |#endif
 1139|       |#ifdef BUILTIN_LRZIP
 1140|       |	case METH_LRZIP:
 1141|       |		return "lrzip";
 1142|       |#endif
 1143|    175|	default:
  ------------------
  |  Branch (1143:2): [True: 175, False: 60]
  ------------------
 1144|    175|		return compr[method].argv[0];
 1145|    235|	}
 1146|    235|}
compress.c:uncompressbuf:
 1192|  3.35k|{
 1193|  3.35k|	int fdp[3][2];
 1194|  3.35k|	int status, rv, w;
 1195|  3.35k|	pid_t pid;
 1196|  3.35k|	pid_t writepid = -1;
 1197|  3.35k|	size_t i;
 1198|  3.35k|	ssize_t r, re;
 1199|  3.35k|	char *const *args;
 1200|  3.35k|#ifdef HAVE_POSIX_SPAWNP
 1201|  3.35k|	posix_spawn_file_actions_t fa;
 1202|  3.35k|#endif
 1203|  3.35k|	int (*decompress)(const unsigned char *, unsigned char **,
 1204|  3.35k|	    size_t, size_t *, int) = getdecompressor(method);
 1205|       |
 1206|  3.35k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  460|  3.35k|#define CAST(T, b)	((T)(b))
  ------------------
 1207|  3.35k|	if (*newch == NULL)
  ------------------
  |  Branch (1207:6): [True: 0, False: 3.35k]
  ------------------
 1208|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1209|       |
 1210|  3.35k|	if (decompress) {
  ------------------
  |  Branch (1210:6): [True: 61, False: 3.29k]
  ------------------
 1211|     61|		if (nofork) {
  ------------------
  |  Branch (1211:7): [True: 61, False: 0]
  ------------------
 1212|     61|			return makeerror(newch, n,
 1213|     61|			    "Fork is required to uncompress, but disabled");
 1214|     61|		}
 1215|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1216|     61|	}
 1217|       |
 1218|  3.29k|	(void)fflush(stdout);
 1219|  3.29k|	(void)fflush(stderr);
 1220|       |
 1221|  13.1k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  138|  13.1k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1221:14): [True: 9.88k, False: 3.29k]
  ------------------
 1222|  9.88k|		fdp[i][0] = fdp[i][1] = -1;
 1223|       |
 1224|       |	/*
 1225|       |	 * There are multithreaded users who run magic_file()
 1226|       |	 * from dozens of threads. If two parallel magic_file() calls
 1227|       |	 * analyze two large compressed files, both will spawn
 1228|       |	 * an uncompressing child here, which writes out uncompressed data.
 1229|       |	 * We read some portion, then close the pipe, then waitpid() the child.
 1230|       |	 * If uncompressed data is larger, child should get EPIPE and exit.
 1231|       |	 * However, with *parallel* calls OTHER child may unintentionally
 1232|       |	 * inherit pipe fds, thus keeping pipe open and making writes in
 1233|       |	 * our child block instead of failing with EPIPE!
 1234|       |	 * (For the bug to occur, two threads must mutually inherit their pipes,
 1235|       |	 * and both must have large outputs. Thus it happens not that often).
 1236|       |	 * To avoid this, be sure to create pipes with O_CLOEXEC.
 1237|       |	 */
 1238|  3.29k|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1238:7): [True: 0, False: 3.29k]
  |  Branch (1238:19): [True: 0, False: 0]
  ------------------
 1239|  3.29k|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1239:6): [True: 0, False: 3.29k]
  ------------------
 1240|  3.29k|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1240:6): [True: 0, False: 3.29k]
  ------------------
 1241|      0|		closep(fdp[STDIN_FILENO]);
 1242|      0|		closep(fdp[STDOUT_FILENO]);
 1243|      0|		return makeerror(newch, n, "Cannot create pipe, %s",
 1244|      0|		    strerror(errno));
 1245|      0|	}
 1246|       |
 1247|  3.29k|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  461|  3.29k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1248|  3.29k|#ifdef HAVE_POSIX_SPAWNP
 1249|  3.29k|	posix_spawn_file_actions_init(&fa);
 1250|       |
 1251|  3.29k|	handledesc(&fa, fd, fdp);
 1252|       |
 1253|  3.29k|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1254|  3.29k|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1255|  3.29k|	    args, NULL);
 1256|       |
 1257|  3.29k|	posix_spawn_file_actions_destroy(&fa);
 1258|       |
 1259|  3.29k|	if (status != 0) {
  ------------------
  |  Branch (1259:6): [True: 10, False: 3.28k]
  ------------------
 1260|     10|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1261|     10|		    compr[method].argv[0], strerror(status));
 1262|     10|	}
 1263|       |#else
 1264|       |	/* For processes with large mapped virtual sizes, vfork
 1265|       |	 * may be _much_ faster (10-100 times) than fork.
 1266|       |	 */
 1267|       |	pid = vfork();
 1268|       |	if (pid == -1) {
 1269|       |		return makeerror(newch, n, "Cannot vfork, %s",
 1270|       |		    strerror(errno));
 1271|       |	}
 1272|       |	if (pid == 0) {
 1273|       |		/* child */
 1274|       |		/* Note: we are after vfork, do not modify memory
 1275|       |		 * in a way which confuses parent. In particular,
 1276|       |		 * do not modify fdp[i][j].
 1277|       |		 */
 1278|       |		handledesc(NULL, fd, fdp);
 1279|       |		DPRINTF("Executing %s\n", compr[method].argv[0]);
 1280|       |
 1281|       |		(void)execvp(compr[method].argv[0], args);
 1282|       |		dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 1283|       |		    compr[method].argv[0], strerror(errno));
 1284|       |		_exit(EXIT_FAILURE); /* _exit(), not exit(), because of vfork */
 1285|       |	}
 1286|       |#endif
 1287|       |	/* parent */
 1288|       |	/* Close write sides of child stdout/err pipes */
 1289|  9.85k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  138|  9.85k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1289:14): [True: 6.57k, False: 3.28k]
  ------------------
 1290|  6.57k|		closefd(fdp[i], 1);
 1291|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1292|  3.28k|	if (fd == -1) {
  ------------------
  |  Branch (1292:6): [True: 0, False: 3.28k]
  ------------------
 1293|      0|		closefd(fdp[STDIN_FILENO], 0);
 1294|      0|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1295|      0|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1295:7): [True: 0, False: 0]
  ------------------
 1296|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1297|      0|			    strerror(errno));
 1298|      0|			DPRINTF("Write to child failed\n");
 1299|      0|			goto err;
 1300|      0|		}
 1301|      0|		closefd(fdp[STDIN_FILENO], 1);
 1302|      0|	}
 1303|       |
 1304|  3.28k|	rv = OKDATA;
  ------------------
  |  |  242|  3.28k|#define OKDATA 	0
  ------------------
 1305|  3.28k|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1306|  3.28k|	DPRINTF("read got %zd\n", r);
 1307|  3.28k|	if (r < 0) {
  ------------------
  |  Branch (1307:6): [True: 0, False: 3.28k]
  ------------------
 1308|      0|		rv = ERRDATA;
  ------------------
  |  |  244|      0|#define ERRDATA	2
  ------------------
 1309|      0|		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
 1310|      0|		        strerror(errno));
 1311|      0|		goto err;
 1312|      0|	} 
 1313|  3.28k|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  460|  3.28k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1313:6): [True: 130, False: 3.15k]
  ------------------
 1314|       |		/*
 1315|       |		 * close fd so that the child exits with sigpipe and ignore
 1316|       |		 * errors, otherwise we risk the child blocking and never
 1317|       |		 * exiting.
 1318|       |		 */
 1319|    130|		DPRINTF("Closing stdout for bytes_max\n");
 1320|    130|		closefd(fdp[STDOUT_FILENO], 0);
 1321|    130|		goto ok;
 1322|    130|	}
 1323|  3.15k|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1323:6): [True: 164, False: 2.99k]
  ------------------
 1324|    164|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1325|    164|		rv = ERRDATA;
  ------------------
  |  |  244|    164|#define ERRDATA	2
  ------------------
 1326|    164|		r = filter_error(*newch, r);
 1327|    164|		goto ok;
 1328|    164|	}
 1329|  2.99k|	if  (re == 0)
  ------------------
  |  Branch (1329:7): [True: 2.99k, False: 0]
  ------------------
 1330|  2.99k|		goto ok;
 1331|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1332|      0|	    strerror(errno));
 1333|      0|	goto err;
 1334|  3.28k|ok:
 1335|  3.28k|	*n = r;
 1336|       |	/* NUL terminate, as every buffer is handled here. */
 1337|  3.28k|	(*newch)[*n] = '\0';
 1338|  3.28k|err:
 1339|  3.28k|	closefd(fdp[STDIN_FILENO], 1);
 1340|  3.28k|	closefd(fdp[STDOUT_FILENO], 0);
 1341|  3.28k|	closefd(fdp[STDERR_FILENO], 0);
 1342|       |
 1343|  3.28k|	w = waitpid(pid, &status, 0);
 1344|  3.28k|wait_err:
 1345|  3.28k|	if (w == -1) {
  ------------------
  |  Branch (1345:6): [True: 0, False: 3.28k]
  ------------------
 1346|      0|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1347|      0|		DPRINTF("Child wait return %#x\n", status);
 1348|  3.28k|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1348:13): [True: 0, False: 3.28k]
  ------------------
 1349|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1350|  3.28k|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1350:13): [True: 294, False: 2.99k]
  ------------------
 1351|    294|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1352|    294|	}
 1353|  3.28k|	if (writepid > 0) {
  ------------------
  |  Branch (1353:6): [True: 0, False: 3.28k]
  ------------------
 1354|       |		/* _After_ we know decompressor has exited, our input writer
 1355|       |		 * definitely will exit now (at worst, writing fails in it,
 1356|       |		 * since output fd is closed now on the reading size).
 1357|       |		 */
 1358|      0|		w = waitpid(writepid, &status, 0);
 1359|      0|		writepid = -1;
 1360|      0|		goto wait_err;
 1361|      0|	}
 1362|       |
 1363|  3.28k|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1364|  3.28k|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1365|       |
 1366|  3.28k|	return rv;
 1367|  3.28k|}
compress.c:getdecompressor:
 1151|  3.35k|{
 1152|  3.35k|	switch (method) {
 1153|      0|#ifdef BUILTIN_DECOMPRESS
 1154|     28|	case METH_FROZEN:
  ------------------
  |  |  210|     28|#define METH_FROZEN	2
  ------------------
  |  Branch (1154:2): [True: 28, False: 3.32k]
  ------------------
 1155|     28|		return uncompressgzipped;
 1156|     23|	case METH_ZLIB:
  ------------------
  |  |  218|     23|#define METH_ZLIB	14
  ------------------
  |  Branch (1156:2): [True: 23, False: 3.33k]
  ------------------
 1157|     23|		return uncompresszlib;
 1158|      0|#endif
 1159|      0|#ifdef BUILTIN_BZLIB
 1160|      4|	case METH_BZIP:
  ------------------
  |  |  211|      4|#define METH_BZIP	7
  ------------------
  |  Branch (1160:2): [True: 4, False: 3.35k]
  ------------------
 1161|      4|		return uncompressbzlib;
 1162|      0|#endif
 1163|      0|#ifdef BUILTIN_XZLIB
 1164|      1|	case METH_XZ:
  ------------------
  |  |  212|      1|#define METH_XZ		9
  ------------------
  |  Branch (1164:2): [True: 1, False: 3.35k]
  ------------------
 1165|      3|	case METH_LZMA:
  ------------------
  |  |  217|      3|#define METH_LZMA	13
  ------------------
  |  Branch (1165:2): [True: 2, False: 3.35k]
  ------------------
 1166|      3|		return uncompressxzlib;
 1167|      0|#endif
 1168|      0|#ifdef BUILTIN_ZSTDLIB
 1169|      2|	case METH_ZSTD:
  ------------------
  |  |  216|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (1169:2): [True: 2, False: 3.35k]
  ------------------
 1170|      2|		return uncompresszstd;
 1171|      0|#endif
 1172|       |#ifdef BUILTIN_LZLIB
 1173|       |	case METH_LZIP:
 1174|       |		return uncompresslzlib;
 1175|       |#endif
 1176|       |#ifdef BUILTIN_LRZIP
 1177|       |	case METH_LRZIP:
 1178|       |		return uncompresslrzip;
 1179|       |#endif
 1180|      0|#ifdef BUILTIN_LZ4LIB
 1181|      1|	case METH_LZ4:
  ------------------
  |  |  215|      1|#define	METH_LZ4	11
  ------------------
  |  Branch (1181:2): [True: 1, False: 3.35k]
  ------------------
 1182|      1|		return uncompresslz4;
 1183|      0|#endif
 1184|  3.29k|	default:
  ------------------
  |  Branch (1184:2): [True: 3.29k, False: 61]
  ------------------
 1185|       |		return NULL;
 1186|  3.35k|	}
 1187|  3.35k|}
compress.c:makeerror:
  964|     71|{
  965|     71|	char *msg;
  966|     71|	va_list ap;
  967|     71|	int rv;
  968|       |
  969|     71|	DPRINTF("Makeerror %s\n", fmt);
  970|     71|	free(*buf);
  971|     71|	va_start(ap, fmt);
  972|     71|	rv = vasprintf(&msg, fmt, ap);
  973|     71|	va_end(ap);
  974|     71|	if (rv < 0) {
  ------------------
  |  Branch (974:6): [True: 0, False: 71]
  ------------------
  975|      0|		DPRINTF("Makeerror failed");
  976|      0|		*buf = NULL;
  977|      0|		*len = 0;
  978|      0|		return NODATA;
  ------------------
  |  |  243|      0|#define NODATA	1
  ------------------
  979|      0|	}
  980|     71|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  461|     71|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  981|     71|	*len = strlen(msg);
  982|     71|	return ERRDATA;
  ------------------
  |  |  244|     71|#define ERRDATA	2
  ------------------
  983|     71|}
compress.c:handledesc:
 1033|  3.29k|{
 1034|  3.29k|	if (fd != -1) {
  ------------------
  |  Branch (1034:6): [True: 3.29k, False: 0]
  ------------------
 1035|  3.29k|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  460|  3.29k|#define CAST(T, b)	((T)(b))
  ------------------
 1036|  3.29k|		movedesc(v, STDIN_FILENO, fd);
 1037|  3.29k|	} else {
 1038|      0|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
 1039|      0|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (1039:7): [True: 0, False: 0]
  ------------------
 1040|      0|		    closedesc(v, fdp[STDIN_FILENO][1]);
 1041|      0|	}
 1042|       |
 1043|  3.29k|	file_clear_closexec(STDIN_FILENO);
 1044|       |
 1045|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
 1046|  3.29k|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
 1047|  3.29k|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (1047:6): [True: 3.29k, False: 0]
  ------------------
 1048|  3.29k|		closedesc(v, fdp[STDOUT_FILENO][0]);
 1049|       |
 1050|  3.29k|	file_clear_closexec(STDOUT_FILENO);
 1051|       |
 1052|  3.29k|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
 1053|  3.29k|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (1053:6): [True: 3.29k, False: 0]
  ------------------
 1054|  3.29k|		closedesc(v, fdp[STDERR_FILENO][0]);
 1055|       |
 1056|       |	file_clear_closexec(STDERR_FILENO);
 1057|  3.29k|}
compress.c:movedesc:
 1004|  9.88k|{
 1005|  9.88k|	if (fd == i)
  ------------------
  |  Branch (1005:6): [True: 0, False: 9.88k]
  ------------------
 1006|      0|		return; /* "no dup was necessary" */
 1007|  9.88k|#ifdef HAVE_POSIX_SPAWNP
 1008|  9.88k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  461|  9.88k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1009|  9.88k|	posix_spawn_file_actions_adddup2(fa, fd, i);
 1010|  9.88k|	posix_spawn_file_actions_addclose(fa, fd);
 1011|       |#else
 1012|       |	if (dup2(fd, i) == -1) {
 1013|       |		DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
 1014|       |		exit(EXIT_FAILURE);
 1015|       |	}
 1016|       |	close(v ? fd : fd);
 1017|       |#endif
 1018|  9.88k|}
compress.c:closedesc:
 1022|  6.59k|{
 1023|  6.59k|#ifdef HAVE_POSIX_SPAWNP
 1024|  6.59k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  461|  6.59k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1025|  6.59k|	posix_spawn_file_actions_addclose(fa, fd);
 1026|       |#else
 1027|       |	close(v ? fd : fd);
 1028|       |#endif
 1029|  6.59k|}
compress.c:closefd:
  987|  19.8k|{
  988|  19.8k|	if (fd[i] == -1)
  ------------------
  |  Branch (988:6): [True: 6.70k, False: 13.1k]
  ------------------
  989|  6.70k|		return;
  990|  13.1k|	(void) close(fd[i]);
  991|  13.1k|	fd[i] = -1;
  992|  13.1k|}
compress.c:filter_error:
 1087|    164|{
 1088|    164|	char *p;
 1089|    164|	char *buf;
 1090|       |
 1091|    164|	ubuf[n] = '\0';
 1092|    164|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  461|    164|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1093|    164|	while (isspace(CAST(unsigned char, *buf)))
  ------------------
  |  Branch (1093:9): [True: 35, False: 164]
  ------------------
 1094|     35|		buf++;
 1095|    164|	DPRINTF("Filter error[[[%s]]]\n", buf);
 1096|    164|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  460|    164|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1096:6): [True: 8, False: 156]
  ------------------
 1097|      8|		*p = '\0';
 1098|    164|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  460|    164|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1098:6): [True: 0, False: 164]
  ------------------
 1099|      0|		*p = '\0';
 1100|    164|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  460|    164|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1100:6): [True: 15, False: 149]
  ------------------
 1101|     15|		++p;
 1102|     15|		while (isspace(CAST(unsigned char, *p)))
  ------------------
  |  Branch (1102:10): [True: 13, False: 15]
  ------------------
 1103|     13|			p++;
 1104|     15|		n = strlen(p);
 1105|     15|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  460|     15|#define CAST(T, b)	((T)(b))
  ------------------
 1106|     15|	}
 1107|    164|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
 1108|    164|	if (islower(*ubuf))
  ------------------
  |  Branch (1108:6): [True: 10, False: 154]
  ------------------
 1109|     10|		*ubuf = toupper(*ubuf);
  ------------------
  |  Branch (1109:11): [True: 0, False: 0]
  |  Branch (1109:11): [True: 0, False: 0]
  |  Branch (1109:11): [Folded, False: 10]
  ------------------
 1110|    164|	return n;
 1111|    164|}

der_offs:
  265|  27.8k|{
  266|  27.8k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  461|  27.8k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  27.8k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 27.8k, False: 0]
  ------------------
  268|       |
  269|  27.8k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  27.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  27.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 27.8k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  27.8k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  27.8k|	    offs, m->offset));
  275|       |
  276|  27.8k|	uint32_t tlen = getlength(b, &offs, len);
  277|  27.8k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  27.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  27.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 27.8k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  27.8k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  27.8k|	    offs, tlen));
  283|       |
  284|  27.8k|	offs += ms->offset + m->offset;
  285|  27.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|  27.8k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 3.40k, False: 24.4k]
  ------------------
  293|  3.40k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 3.40k]
  ------------------
  294|      0|			return -1;
  295|  3.40k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  460|  3.40k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  3.40k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  3.40k|		    ms->c.li[m->cont_level - 1].off));
  298|  3.40k|	}
  299|  27.8k|	return CAST(int32_t, offs);
  ------------------
  |  |  460|  27.8k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  27.8k|}
der_cmp:
  304|   417k|{
  305|   417k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  461|   417k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   417k|	const char *s = m->value.s;
  307|   417k|	size_t offs = 0, len = ms->search.s_len;
  308|   417k|	uint32_t tag, tlen;
  309|   417k|	char buf[128];
  310|       |
  311|   417k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   417k|	tag = gettag(b, &offs, len);
  314|   417k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   417k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|   417k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 9.54k, False: 408k]
  ------------------
  315|  9.54k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  9.54k|		return -1;
  317|  9.54k|	}
  318|       |
  319|   408k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   408k|	    offs, m->offset));
  321|       |
  322|   408k|	tlen = getlength(b, &offs, len);
  323|   408k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   408k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|   408k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 137k, False: 270k]
  ------------------
  324|   137k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   137k|		return -1;
  326|   137k|	}
  327|       |
  328|   270k|	der_tag(buf, sizeof(buf), tag);
  329|   270k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   270k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 270k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   270k|	size_t slen = strlen(buf);
  333|       |
  334|   270k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 237k, False: 32.6k]
  ------------------
  335|   237k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   237k|		return 0;
  337|   237k|	}
  338|       |
  339|  32.6k|	s += slen;
  340|       |
  341|  34.2k|again:
  342|  34.2k|	switch (*s) {
  343|  27.1k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 27.1k, False: 7.07k]
  ------------------
  344|  27.1k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  27.1k|		return 1;
  346|  1.77k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.77k, False: 32.4k]
  ------------------
  347|  1.77k|		s++;
  348|  1.77k|		goto val;
  349|  5.29k|	default:
  ------------------
  |  Branch (349:2): [True: 5.29k, False: 28.9k]
  ------------------
  350|  5.29k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 5.29k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  5.29k|		slen = 0;
  356|  5.29k|		do
  357|  8.40k|			slen = slen * 10 + *s - '0';
  358|  5.29k|		while (isdigit(CAST(unsigned char, *++s)));
  ------------------
  |  Branch (358:10): [True: 3.10k, False: 5.29k]
  ------------------
  359|  5.29k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  5.29k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 5.29k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  5.29k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 3.67k, False: 1.62k]
  ------------------
  363|  3.67k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  3.67k|			return 0;
  365|  3.67k|		}
  366|  1.62k|		goto again;
  367|  34.2k|	}
  368|  1.77k|val:
  369|  1.77k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.77k|	    tlen));
  371|  1.77k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.77k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.77k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.77k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.77k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 1.37k, False: 404]
  |  Branch (374:29): [True: 1.14k, False: 231]
  ------------------
  375|  1.14k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|  1.14k|		return 0;
  377|  1.14k|	}
  378|    635|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    635|	DPRINTF(("%s: complete match\n", __func__));
  380|    635|	return 1;
  381|  1.77k|}
der.c:gettag:
  150|   445k|{
  151|   445k|	uint32_t tag;
  152|       |
  153|   445k|	if (c == NULL || *p >= l)
  ------------------
  |  Branch (153:6): [True: 0, False: 445k]
  |  Branch (153:19): [True: 3.13k, False: 442k]
  ------------------
  154|  3.13k|		return DER_BAD;
  ------------------
  |  |   62|  3.13k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  3.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   442k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   442k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 265k, False: 176k]
  ------------------
  159|   265k|		return tag;
  160|       |
  161|   176k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 1.19k, False: 175k]
  ------------------
  162|  1.19k|		return DER_BAD;
  ------------------
  |  |   62|  1.19k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  1.19k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  2.28G|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 2.28G, False: 172k]
  ------------------
  165|  2.28G|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  2.28G|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 3.15k, False: 2.28G]
  ------------------
  167|  3.15k|			return DER_BAD;
  ------------------
  |  |   62|  3.15k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  3.15k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  2.28G|	}
  169|   172k|	return tag;
  170|   175k|}
der.c:getlength:
  183|   435k|{
  184|   435k|	uint8_t digits, i;
  185|   435k|	size_t len;
  186|   435k|	int is_onebyte_result;
  187|       |
  188|   435k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 4.10k, False: 431k]
  ------------------
  189|  4.10k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  4.10k|		return DER_BAD;
  ------------------
  |  |   62|  4.10k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  4.10k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  4.10k|	}
  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|   431k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   431k|	digits = c[(*p)++] & 0x7f;
  200|   431k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 121k, False: 310k]
  ------------------
  201|   121k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|   121k|		return DER_BAD;
  ------------------
  |  |   62|   121k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|   121k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|   121k|	}
  204|       |
  205|   310k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 263k, False: 47.5k]
  ------------------
  206|   263k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  47.5k|	len = 0;
  213|  3.18M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 3.14M, False: 47.5k]
  ------------------
  214|  3.14M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  47.5k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 10.3k, False: 37.1k]
  |  Branch (216:31): [True: 1.82k, False: 35.3k]
  ------------------
  217|  12.2k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  12.2k|		    __func__, *p, len, l));
  219|  12.2k|		return DER_BAD;
  ------------------
  |  |   62|  12.2k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  12.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  12.2k|	}
  221|  35.3k|	return CAST(uint32_t, len);
  ------------------
  |  |  460|  35.3k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  47.5k|}
der.c:der_tag:
  226|   270k|{
  227|   270k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   270k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 181k, False: 88.7k]
  ------------------
  228|   181k|		strlcpy(buf, der__tag[tag], len);
  229|  88.7k|	else
  230|  88.7k|		snprintf(buf, len, "%#x", tag);
  231|   270k|	return buf;
  232|   270k|}
der.c:der_data:
  237|  1.77k|{
  238|  1.77k|	uint32_t i;
  239|  1.77k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  460|  1.77k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.77k|	switch (tag) {
  241|     70|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     70|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 70, False: 1.70k]
  ------------------
  242|    155|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    155|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 85, False: 1.69k]
  ------------------
  243|    155|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    155|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 0, False: 1.77k]
  ------------------
  244|    155|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  461|    155|#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.77k]
  ------------------
  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.62k|	default:
  ------------------
  |  Branch (251:2): [True: 1.62k, False: 155]
  ------------------
  252|  1.62k|		break;
  253|  1.77k|	}
  254|       |
  255|  7.63k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 6.01k, False: 1.62k]
  ------------------
  256|  6.01k|		uint32_t z = i << 1;
  257|  6.01k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 4.99k, False: 1.02k]
  ------------------
  258|  4.99k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  6.01k|	}
  260|  1.62k|	return len * 2;
  261|  1.77k|}

file_encoding:
   78|  33.6k|{
   79|  33.6k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  33.6k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  33.6k|	size_t nbytes = b->flen;
   81|  33.6k|	size_t mlen;
   82|  33.6k|	int rv = 1, ucs_type;
   83|  33.6k|	file_unichar_t *udefbuf;
   84|  33.6k|	size_t udeflen;
   85|       |
   86|  33.6k|	if (buf == NULL)
  ------------------
  |  Branch (86:6): [True: 0, False: 33.6k]
  ------------------
   87|      0|		return 0;
   88|  33.6k|	if (ubuf == NULL)
  ------------------
  |  Branch (88:6): [True: 18.3k, False: 15.3k]
  ------------------
   89|  18.3k|		ubuf = &udefbuf;
   90|  33.6k|	if (ulen == NULL)
  ------------------
  |  Branch (90:6): [True: 18.3k, False: 15.3k]
  ------------------
   91|  18.3k|		ulen = &udeflen;
   92|       |
   93|  33.6k|	*type = "text";
   94|  33.6k|	*ulen = 0;
   95|  33.6k|	*code = "unknown";
   96|  33.6k|	*code_mime = "binary";
   97|       |
   98|  33.6k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (98:6): [True: 1.21k, False: 32.4k]
  ------------------
   99|  1.21k|		nbytes = ms->encoding_max;
  100|       |
  101|  33.6k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  102|  33.6k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  460|  33.6k|#define CAST(T, b)	((T)(b))
  ------------------
  103|  33.6k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (103:6): [True: 0, False: 33.6k]
  ------------------
  104|      0|		file_oomem(ms, mlen);
  105|      0|		goto done;
  106|      0|	}
  107|  33.6k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (107:6): [True: 2.11k, False: 31.5k]
  ------------------
  108|  2.11k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (108:7): [True: 14, False: 2.10k]
  ------------------
  109|     14|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  110|     14|			*code = "Unicode text, UTF-7";
  111|     14|			*code_mime = "utf-7";
  112|  2.10k|		} else {
  113|  2.10k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  114|  2.10k|			*code = "ASCII";
  115|  2.10k|			*code_mime = "us-ascii";
  116|  2.10k|		}
  117|  31.5k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (117:13): [True: 9, False: 31.5k]
  ------------------
  118|      9|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  119|      9|		*code = "Unicode text, UTF-8 (with BOM)";
  120|      9|		*code_mime = "utf-8";
  121|  31.5k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (121:13): [True: 186, False: 31.3k]
  ------------------
  122|    186|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  123|    186|		*code = "Unicode text, UTF-8";
  124|    186|		*code_mime = "utf-8";
  125|  31.3k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (125:13): [True: 390, False: 30.9k]
  ------------------
  126|    390|		if (ucs_type == 1) {
  ------------------
  |  Branch (126:7): [True: 148, False: 242]
  ------------------
  127|    148|			*code = "Unicode text, UTF-32, little-endian";
  128|    148|			*code_mime = "utf-32le";
  129|    242|		} else {
  130|    242|			*code = "Unicode text, UTF-32, big-endian";
  131|    242|			*code_mime = "utf-32be";
  132|    242|		}
  133|    390|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  134|  30.9k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (134:13): [True: 402, False: 30.5k]
  ------------------
  135|    402|		if (ucs_type == 1) {
  ------------------
  |  Branch (135:7): [True: 221, False: 181]
  ------------------
  136|    221|			*code = "Unicode text, UTF-16, little-endian";
  137|    221|			*code_mime = "utf-16le";
  138|    221|		} else {
  139|    181|			*code = "Unicode text, UTF-16, big-endian";
  140|    181|			*code_mime = "utf-16be";
  141|    181|		}
  142|    402|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  143|  30.5k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (143:13): [True: 1.00k, False: 29.5k]
  ------------------
  144|  1.00k|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  145|  1.00k|		*code = "ISO-8859";
  146|  1.00k|		*code_mime = "iso-8859-1";
  147|  29.5k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (147:13): [True: 469, False: 29.0k]
  ------------------
  148|    469|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  149|    469|		*code = "Non-ISO extended-ASCII";
  150|    469|		*code_mime = "unknown-8bit";
  151|  29.0k|	} else {
  152|  29.0k|		unsigned char *nbuf;
  153|       |
  154|  29.0k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  155|  29.0k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  460|  29.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (155:7): [True: 0, False: 29.0k]
  ------------------
  156|      0|			file_oomem(ms, mlen);
  157|      0|			goto done;
  158|      0|		}
  159|  29.0k|		from_ebcdic(buf, nbytes, nbuf);
  160|       |
  161|  29.0k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (161:7): [True: 93, False: 28.9k]
  ------------------
  162|     93|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  163|     93|			*code = "EBCDIC";
  164|     93|			*code_mime = "ebcdic";
  165|  28.9k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (165:14): [True: 112, False: 28.8k]
  ------------------
  166|    112|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  167|    112|			    *ulen));
  168|    112|			*code = "International EBCDIC";
  169|    112|			*code_mime = "ebcdic";
  170|  28.8k|		} else { /* Doesn't look like text at all */
  171|  28.8k|			DPRINTF(("binary\n"));
  172|  28.8k|			rv = 0;
  173|  28.8k|			*type = "binary";
  174|  28.8k|		}
  175|  29.0k|		free(nbuf);
  176|  29.0k|	}
  177|       |
  178|  33.6k| done:
  179|  33.6k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (179:6): [True: 18.3k, False: 15.3k]
  ------------------
  180|  18.3k|		free(udefbuf);
  181|       |
  182|  33.6k|	return rv;
  183|  33.6k|}
file_looks_utf8:
  358|  31.5k|{
  359|  31.5k|	size_t i;
  360|  31.5k|	int n;
  361|  31.5k|	file_unichar_t c;
  362|  31.5k|	int gotone = 0, ctrl = 0;
  363|       |
  364|  31.5k|	if (ubuf)
  ------------------
  |  Branch (364:6): [True: 31.5k, False: 0]
  ------------------
  365|  31.5k|		*ulen = 0;
  366|       |
  367|  27.3M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (367:14): [True: 27.3M, False: 2.00k]
  ------------------
  368|  27.3M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (368:7): [True: 27.2M, False: 72.4k]
  ------------------
  369|       |			/*
  370|       |			 * Even if the whole file is valid UTF-8 sequences,
  371|       |			 * still reject it if it uses weird control characters.
  372|       |			 */
  373|       |
  374|  27.2M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  238|  27.2M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (374:8): [True: 22.8M, False: 4.39M]
  ------------------
  375|  22.8M|				ctrl = 1;
  376|       |
  377|  27.2M|			if (ubuf)
  ------------------
  |  Branch (377:8): [True: 27.2M, False: 0]
  ------------------
  378|  27.2M|				ubuf[(*ulen)++] = buf[i];
  379|  27.2M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (379:14): [True: 13.3k, False: 59.1k]
  ------------------
  380|  13.3k|			return -1;
  381|  59.1k|		} else {			   /* 11xxxxxx begins UTF-8 */
  382|  59.1k|			int following;
  383|  59.1k|			uint8_t x = first[buf[i]];
  384|  59.1k|			const struct accept_range *ar =
  385|  59.1k|			    &accept_ranges[(unsigned int)x >> 4];
  386|  59.1k|			if (x == XX)
  ------------------
  |  |  306|  59.1k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (386:8): [True: 6.79k, False: 52.3k]
  ------------------
  387|  6.79k|				return -1;
  388|       |
  389|  52.3k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (389:8): [True: 28.3k, False: 24.0k]
  ------------------
  390|  28.3k|				c = buf[i] & 0x1f;
  391|  28.3k|				following = 1;
  392|  28.3k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (392:15): [True: 18.2k, False: 5.80k]
  ------------------
  393|  18.2k|				c = buf[i] & 0x0f;
  394|  18.2k|				following = 2;
  395|  18.2k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (395:15): [True: 5.80k, False: 0]
  ------------------
  396|  5.80k|				c = buf[i] & 0x07;
  397|  5.80k|				following = 3;
  398|  5.80k|			} else if ((buf[i] & 0x04) == 0) {	/* 111110xx */
  ------------------
  |  Branch (398:15): [True: 0, False: 0]
  ------------------
  399|      0|				c = buf[i] & 0x03;
  400|      0|				following = 4;
  401|      0|			} else if ((buf[i] & 0x02) == 0) {	/* 1111110x */
  ------------------
  |  Branch (401:15): [True: 0, False: 0]
  ------------------
  402|      0|				c = buf[i] & 0x01;
  403|      0|				following = 5;
  404|      0|			} else
  405|      0|				return -1;
  406|       |
  407|   119k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (407:16): [True: 76.3k, False: 42.9k]
  ------------------
  408|  76.3k|				i++;
  409|  76.3k|				if (i >= nbytes)
  ------------------
  |  Branch (409:9): [True: 221, False: 76.1k]
  ------------------
  410|    221|					goto done;
  411|       |
  412|  76.1k|				if (n == 0 &&
  ------------------
  |  Branch (412:9): [True: 52.2k, False: 23.9k]
  ------------------
  413|  52.2k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (413:11): [True: 4.98k, False: 47.2k]
  |  Branch (413:30): [True: 3.86k, False: 43.3k]
  ------------------
  414|  8.84k|					return -1;
  415|       |
  416|  67.3k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (416:9): [True: 156, False: 67.1k]
  |  Branch (416:33): [True: 263, False: 66.9k]
  ------------------
  417|    419|					return -1;
  418|       |
  419|  66.9k|				c = (c << 6) + (buf[i] & 0x3f);
  420|  66.9k|			}
  421|       |
  422|  42.9k|			if (ubuf)
  ------------------
  |  Branch (422:8): [True: 42.9k, False: 0]
  ------------------
  423|  42.9k|				ubuf[(*ulen)++] = c;
  424|  42.9k|			gotone = 1;
  425|  42.9k|		}
  426|  27.3M|	}
  427|  2.22k|done:
  428|  2.22k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (428:9): [True: 1.89k, False: 327]
  |  Branch (428:21): [True: 186, False: 141]
  ------------------
  429|  31.5k|}
encoding.c:looks_ascii:
  271|  62.7k|    size_t *ulen) \
  272|  62.7k|{ \
  273|  62.7k|	size_t i; \
  274|  62.7k|\
  275|  62.7k|	*ulen = 0; \
  276|  62.7k|\
  277|  18.9M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 18.9M, False: 2.21k]
  ------------------
  278|  18.9M|		int t = text_chars[buf[i]]; \
  279|  18.9M|\
  280|  18.9M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 60.4k, False: 18.8M]
  ------------------
  281|  18.9M|			return 0; \
  282|  18.9M|\
  283|  18.9M|		ubuf[(*ulen)++] = buf[i]; \
  284|  18.8M|	} \
  285|  62.7k|	return 1; \
  286|  62.7k|}
encoding.c:looks_latin1:
  271|  59.5k|    size_t *ulen) \
  272|  59.5k|{ \
  273|  59.5k|	size_t i; \
  274|  59.5k|\
  275|  59.5k|	*ulen = 0; \
  276|  59.5k|\
  277|  10.2M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 10.2M, False: 1.11k]
  ------------------
  278|  10.2M|		int t = text_chars[buf[i]]; \
  279|  10.2M|\
  280|  29.6M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 9.16M, False: 1.06M]
  |  Branch (280:7): [True: 58.3k, False: 9.11M]
  ------------------
  281|  10.2M|			return 0; \
  282|  10.2M|\
  283|  10.2M|		ubuf[(*ulen)++] = buf[i]; \
  284|  10.1M|	} \
  285|  59.5k|	return 1; \
  286|  59.5k|}
encoding.c:looks_extended:
  271|  29.5k|    size_t *ulen) \
  272|  29.5k|{ \
  273|  29.5k|	size_t i; \
  274|  29.5k|\
  275|  29.5k|	*ulen = 0; \
  276|  29.5k|\
  277|  2.68M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 2.68M, False: 469]
  ------------------
  278|  2.68M|		int t = text_chars[buf[i]]; \
  279|  2.68M|\
  280|  11.6M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 1.93M, False: 750k]
  |  Branch (280:7): [True: 1.63M, False: 301k]
  |  Branch (280:7): [True: 29.0k, False: 1.60M]
  ------------------
  281|  2.68M|			return 0; \
  282|  2.68M|\
  283|  2.68M|		ubuf[(*ulen)++] = buf[i]; \
  284|  2.65M|	} \
  285|  29.5k|	return 1; \
  286|  29.5k|}
encoding.c:looks_utf8_with_BOM:
  439|  31.5k|{
  440|  31.5k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (440:6): [True: 30.0k, False: 1.44k]
  |  Branch (440:20): [True: 126, False: 29.9k]
  |  Branch (440:38): [True: 102, False: 24]
  |  Branch (440:56): [True: 65, False: 37]
  ------------------
  441|     65|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  442|  31.4k|	else
  443|  31.4k|		return -1;
  444|  31.5k|}
encoding.c:looks_utf7:
  449|  2.11k|{
  450|  2.11k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (450:6): [True: 1.26k, False: 853]
  |  Branch (450:20): [True: 51, False: 1.21k]
  |  Branch (450:37): [True: 38, False: 13]
  |  Branch (450:54): [True: 17, False: 21]
  ------------------
  451|     17|		switch (buf[3]) {
  452|      3|		case '8':
  ------------------
  |  Branch (452:3): [True: 3, False: 14]
  ------------------
  453|      6|		case '9':
  ------------------
  |  Branch (453:3): [True: 3, False: 14]
  ------------------
  454|      9|		case '+':
  ------------------
  |  Branch (454:3): [True: 3, False: 14]
  ------------------
  455|     14|		case '/':
  ------------------
  |  Branch (455:3): [True: 5, False: 12]
  ------------------
  456|     14|			if (ubuf)
  ------------------
  |  Branch (456:8): [True: 14, False: 0]
  ------------------
  457|     14|				*ulen = 0;
  458|     14|			return 1;
  459|      3|		default:
  ------------------
  |  Branch (459:3): [True: 3, False: 14]
  ------------------
  460|      3|			return -1;
  461|     17|		}
  462|  2.10k|	else
  463|  2.10k|		return -1;
  464|  2.11k|}
encoding.c:looks_ucs16:
  475|  30.9k|{
  476|  30.9k|	int bigend;
  477|  30.9k|	uint32_t hi;
  478|  30.9k|	size_t i;
  479|       |
  480|  30.9k|	if (nbytes < 2)
  ------------------
  |  Branch (480:6): [True: 88, False: 30.8k]
  ------------------
  481|     88|		return 0;
  482|       |
  483|  30.8k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (483:6): [True: 2.21k, False: 28.6k]
  |  Branch (483:23): [True: 298, False: 1.91k]
  ------------------
  484|    298|		bigend = 0;
  485|  30.5k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (485:11): [True: 267, False: 30.2k]
  |  Branch (485:28): [True: 212, False: 55]
  ------------------
  486|    212|		bigend = 1;
  487|  30.3k|	else
  488|  30.3k|		return 0;
  489|       |
  490|    510|	*ulen = 0;
  491|    510|	hi = 0;
  492|       |
  493|   845k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (493:14): [True: 845k, False: 402]
  ------------------
  494|   845k|		uint32_t uc;
  495|       |
  496|   845k|		if (bigend)
  ------------------
  |  Branch (496:7): [True: 256k, False: 588k]
  ------------------
  497|   256k|			uc = CAST(uint32_t,
  ------------------
  |  |  460|   256k|#define CAST(T, b)	((T)(b))
  ------------------
  498|   845k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  499|   588k|		else
  500|   588k|			uc = CAST(uint32_t,
  ------------------
  |  |  460|   588k|#define CAST(T, b)	((T)(b))
  ------------------
  501|   845k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  502|       |
  503|   845k|		uc &= 0xffff;
  504|       |
  505|   845k|		switch (uc) {
  506|      5|		case 0xfffe:
  ------------------
  |  Branch (506:3): [True: 5, False: 845k]
  ------------------
  507|     15|		case 0xffff:
  ------------------
  |  Branch (507:3): [True: 10, False: 845k]
  ------------------
  508|     15|			return 0;
  509|   845k|		default:
  ------------------
  |  Branch (509:3): [True: 845k, False: 15]
  ------------------
  510|   845k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  466|   845k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (466:26): [True: 116k, False: 728k]
  |  |  |  Branch (466:43): [True: 15, False: 116k]
  |  |  ------------------
  ------------------
  511|     15|				return 0;
  512|   845k|			break;
  513|   845k|		}
  514|   845k|		if (hi) {
  ------------------
  |  Branch (514:7): [True: 11.5k, False: 833k]
  ------------------
  515|  11.5k|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  468|  11.5k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (468:26): [True: 11.5k, False: 22]
  |  |  |  Branch (468:43): [True: 11.4k, False: 9]
  |  |  ------------------
  ------------------
  516|     31|				return 0;
  517|  11.4k|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  518|  11.4k|			hi = 0;
  519|  11.4k|		}
  520|   845k|		if (NOTTEXT(uc))
  ------------------
  |  |  470|   845k|    ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  460|   481k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |                   ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  238|  1.32M|#define T 1   /* character appears in plain ASCII text */
  |  |  ------------------
  |  |  |  Branch (470:6): [True: 481k, False: 364k]
  |  |  |  Branch (470:19): [True: 452k, False: 28.3k]
  |  |  |  Branch (470:57): [True: 32, False: 452k]
  |  |  ------------------
  ------------------
  521|     32|			return 0;
  522|   845k|		ubf[(*ulen)++] = uc;
  523|   845k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  467|   845k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (467:26): [True: 171k, False: 673k]
  |  |  |  Branch (467:43): [True: 11.5k, False: 159k]
  |  |  ------------------
  ------------------
  524|  11.5k|			hi = uc - 0xd800 + 1;
  525|   845k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  468|   845k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (468:26): [True: 159k, False: 685k]
  |  |  |  Branch (468:43): [True: 15, False: 159k]
  |  |  ------------------
  ------------------
  526|     15|			return 0;
  527|   845k|	}
  528|       |
  529|    402|	return 1 + bigend;
  530|    510|}
encoding.c:looks_ucs32:
  536|  31.3k|{
  537|  31.3k|	int bigend;
  538|  31.3k|	file_unichar_t uc;
  539|  31.3k|	size_t i;
  540|       |
  541|  31.3k|	if (nbytes < 4)
  ------------------
  |  Branch (541:6): [True: 1.33k, False: 29.9k]
  ------------------
  542|  1.33k|		return 0;
  543|       |
  544|  29.9k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (544:6): [True: 2.26k, False: 27.7k]
  |  Branch (544:23): [True: 420, False: 1.84k]
  |  Branch (544:40): [True: 229, False: 191]
  |  Branch (544:54): [True: 165, False: 64]
  ------------------
  545|    165|		bigend = 0;
  546|  29.8k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (546:11): [True: 1.46k, False: 28.3k]
  |  Branch (546:25): [True: 719, False: 748]
  |  Branch (546:39): [True: 301, False: 418]
  |  Branch (546:56): [True: 250, False: 51]
  ------------------
  547|    250|		bigend = 1;
  548|  29.5k|	else
  549|  29.5k|		return 0;
  550|       |
  551|    415|	*ulen = 0;
  552|       |
  553|   640k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (553:14): [True: 640k, False: 390]
  ------------------
  554|       |		/* XXX fix to properly handle chars > 65536 */
  555|       |
  556|   640k|		if (bigend)
  ------------------
  |  Branch (556:7): [True: 385k, False: 255k]
  ------------------
  557|   385k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  460|   385k|#define CAST(T, b)	((T)(b))
  ------------------
  558|   385k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  460|   385k|#define CAST(T, b)	((T)(b))
  ------------------
  559|   385k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  460|   385k|#define CAST(T, b)	((T)(b))
  ------------------
  560|   385k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  460|   385k|#define CAST(T, b)	((T)(b))
  ------------------
  561|   255k|		else
  562|   255k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  460|   255k|#define CAST(T, b)	((T)(b))
  ------------------
  563|   255k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  460|   255k|#define CAST(T, b)	((T)(b))
  ------------------
  564|   255k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  460|   255k|#define CAST(T, b)	((T)(b))
  ------------------
  565|   255k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  460|   255k|#define CAST(T, b)	((T)(b))
  ------------------
  566|       |
  567|   640k|		uc = ubf[*ulen - 1];
  568|   640k|		if (uc == 0xfffe || NOTTEXT(uc))
  ------------------
  |  |  470|   640k|    ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  460|  71.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |                   ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  238|   711k|#define T 1   /* character appears in plain ASCII text */
  |  |  ------------------
  |  |  |  Branch (470:6): [True: 71.3k, False: 569k]
  |  |  |  Branch (470:19): [True: 71.3k, False: 58]
  |  |  |  Branch (470:57): [True: 15, False: 71.3k]
  |  |  ------------------
  ------------------
  |  Branch (568:7): [True: 10, False: 640k]
  ------------------
  569|     25|			return 0;
  570|   640k|	}
  571|       |
  572|    390|	return 1 + bigend;
  573|    415|}
encoding.c:from_ebcdic:
  660|  29.0k|{
  661|  29.0k|	size_t i;
  662|       |
  663|   110M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (663:14): [True: 110M, False: 29.0k]
  ------------------
  664|   110M|		out[i] = ebcdic_to_ascii[buf[i]];
  665|   110M|	}
  666|  29.0k|}

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

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

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

file_is_json:
  423|  15.3k|{
  424|  15.3k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  15.3k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  15.3k|	const unsigned char *ue = uc + b->flen;
  426|  15.3k|	size_t st[JSON_MAX];
  427|  15.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  15.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  15.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  15.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  15.3k|	int jt;
  429|       |
  430|       |
  431|  15.3k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  15.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  15.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 15.3k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  15.3k|	memset(st, 0, sizeof(st));
  435|       |
  436|  15.3k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 15.3k, False: 33]
  ------------------
  437|  15.3k|		return 0;
  438|       |
  439|     33|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     33|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 33]
  ------------------
  440|      0|		return 1;
  441|     33|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 33]
  ------------------
  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|     33|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 33]
  ------------------
  448|     33|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 18, False: 15]
  ------------------
  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|     33|	return 1;
  462|     33|}
is_json.c:json_parse:
  348|  24.0k|{
  349|  24.0k|	const unsigned char *uc, *ouc;
  350|  24.0k|	int rv = 0;
  351|  24.0k|	int t;
  352|       |
  353|  24.0k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  24.0k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 116, False: 23.8k]
  ------------------
  355|    116|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  23.8k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 1, False: 23.8k]
  ------------------
  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|  23.8k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  23.8k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 23.8k]
  |  |  ------------------
  ------------------
  369|  23.8k|	switch (*uc++) {
  370|    879|	case '"':
  ------------------
  |  Branch (370:2): [True: 879, False: 23.0k]
  ------------------
  371|    879|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    879|		t = JSON_STRING;
  ------------------
  |  |   60|    879|#define JSON_STRING	4
  ------------------
  373|    879|		break;
  374|  4.24k|	case '[':
  ------------------
  |  Branch (374:2): [True: 4.24k, False: 19.6k]
  ------------------
  375|  4.24k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  4.24k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  4.24k|#define JSON_ARRAY	0
  ------------------
  377|  4.24k|		break;
  378|    723|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 723, False: 23.1k]
  ------------------
  379|    723|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    723|		t = JSON_OBJECT;
  ------------------
  |  |   59|    723|#define JSON_OBJECT	3
  ------------------
  381|    723|		break;
  382|    364|	case 't':
  ------------------
  |  Branch (382:2): [True: 364, False: 23.5k]
  ------------------
  383|    364|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    364|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    364|#define JSON_CONSTANT	1
  ------------------
  385|    364|		break;
  386|    378|	case 'f':
  ------------------
  |  Branch (386:2): [True: 378, False: 23.5k]
  ------------------
  387|    378|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    378|		    lvl + 1);
  389|    378|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    378|#define JSON_CONSTANT	1
  ------------------
  390|    378|		break;
  391|    364|	case 'n':
  ------------------
  |  Branch (391:2): [True: 364, False: 23.5k]
  ------------------
  392|    364|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    364|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    364|#define JSON_CONSTANT	1
  ------------------
  394|    364|		break;
  395|  16.9k|	default:
  ------------------
  |  Branch (395:2): [True: 16.9k, False: 6.95k]
  ------------------
  396|  16.9k|		--uc;
  397|  16.9k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  16.9k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  16.9k|#define JSON_NUMBER	2
  ------------------
  399|  16.9k|		break;
  400|  23.8k|	}
  401|  23.8k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 5.45k, False: 18.4k]
  ------------------
  402|  5.45k|		st[t]++;
  403|  23.8k|	uc = json_skip_space(uc, ue);
  404|  24.0k|out:
  405|  24.0k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  24.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 24.0k]
  |  |  ------------------
  ------------------
  406|  24.0k|	*ucp = uc;
  407|  24.0k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 15.3k, False: 8.64k]
  ------------------
  408|  15.3k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 14.9k, False: 412]
  ------------------
  409|  14.9k|			return 0;
  410|    412|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 119, False: 293]
  ------------------
  411|    119|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|    119|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|    110|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 9, False: 110]
  |  Branch (411:31): [True: 9, False: 101]
  ------------------
  412|    293|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 61, False: 232]
  |  Branch (412:22): [True: 47, False: 14]
  ------------------
  413|     47|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     47|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     35|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 12, False: 35]
  |  Branch (413:31): [True: 3, False: 32]
  ------------------
  414|    246|		else
  415|    246|			return 0;
  416|    293|	}
  417|  8.64k|	return rv;
  418|  24.0k|}
is_json.c:json_skip_space:
  119|  57.6k|{
  120|  27.9M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 27.9M, False: 3.68k]
  |  Branch (120:20): [True: 27.8M, False: 53.9k]
  ------------------
  121|  27.8M|		uc++;
  122|  57.6k|	return uc;
  123|  57.6k|}
is_json.c:json_isspace:
   79|  27.9M|{
   80|  27.9M|	switch (uc) {
   81|  7.57M|	case ' ':
  ------------------
  |  Branch (81:2): [True: 7.57M, False: 20.3M]
  ------------------
   82|  21.4M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 13.8M, False: 14.0M]
  ------------------
   83|  27.8M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 6.41M, False: 21.4M]
  ------------------
   84|  27.8M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 63, False: 27.9M]
  ------------------
   85|  27.8M|		return 1;
   86|  53.9k|	default:
  ------------------
  |  Branch (86:2): [True: 53.9k, False: 27.8M]
  ------------------
   87|  53.9k|		return 0;
   88|  27.9M|	}
   89|  27.9M|}
is_json.c:json_parse_string:
  129|  1.51k|{
  130|  1.51k|	const unsigned char *uc = *ucp;
  131|  1.51k|	size_t i;
  132|       |
  133|  1.51k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  1.51k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  134|  9.02M|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 9.02M, False: 117]
  ------------------
  135|  9.02M|		switch (*uc++) {
  136|      7|		case '\0':
  ------------------
  |  Branch (136:3): [True: 7, False: 9.02M]
  ------------------
  137|      7|			goto out;
  138|  8.61M|		case '\\':
  ------------------
  |  Branch (138:3): [True: 8.61M, False: 406k]
  ------------------
  139|  8.61M|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 17, False: 8.61M]
  ------------------
  140|     17|				goto out;
  141|  8.61M|			switch (*uc++) {
  142|      0|			case '\0':
  ------------------
  |  Branch (142:4): [True: 0, False: 8.61M]
  ------------------
  143|      0|				goto out;
  144|  3.70M|			case '"':
  ------------------
  |  Branch (144:4): [True: 3.70M, False: 4.91M]
  ------------------
  145|  8.61M|			case '\\':
  ------------------
  |  Branch (145:4): [True: 4.91M, False: 3.70M]
  ------------------
  146|  8.61M|			case '/':
  ------------------
  |  Branch (146:4): [True: 205, False: 8.61M]
  ------------------
  147|  8.61M|			case 'b':
  ------------------
  |  Branch (147:4): [True: 340, False: 8.61M]
  ------------------
  148|  8.61M|			case 'f':
  ------------------
  |  Branch (148:4): [True: 194, False: 8.61M]
  ------------------
  149|  8.61M|			case 'n':
  ------------------
  |  Branch (149:4): [True: 284, False: 8.61M]
  ------------------
  150|  8.61M|			case 'r':
  ------------------
  |  Branch (150:4): [True: 201, False: 8.61M]
  ------------------
  151|  8.61M|			case 't':
  ------------------
  |  Branch (151:4): [True: 195, False: 8.61M]
  ------------------
  152|  8.61M|				continue;
  153|    423|			case 'u':
  ------------------
  |  Branch (153:4): [True: 423, False: 8.61M]
  ------------------
  154|    423|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 5, False: 418]
  ------------------
  155|      5|					uc = ue;
  156|      5|					goto out;
  157|      5|				}
  158|  2.02k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 1.62k, False: 393]
  ------------------
  159|  1.62k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 25, False: 1.60k]
  ------------------
  160|     25|						goto out;
  161|    393|				continue;
  162|    393|			default:
  ------------------
  |  Branch (162:4): [True: 14, False: 8.61M]
  ------------------
  163|     14|				goto out;
  164|  8.61M|			}
  165|  1.32k|		case '"':
  ------------------
  |  Branch (165:3): [True: 1.32k, False: 9.02M]
  ------------------
  166|  1.32k|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|  1.32k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.32k]
  |  |  ------------------
  ------------------
  167|  1.32k|			*ucp = uc;
  168|  1.32k|			return 1;
  169|   404k|		default:
  ------------------
  |  Branch (169:3): [True: 404k, False: 8.62M]
  ------------------
  170|   404k|			continue;
  171|  9.02M|		}
  172|  9.02M|	}
  173|    185|out:
  174|    185|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    185|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 185]
  |  |  ------------------
  ------------------
  175|    185|	*ucp = uc;
  176|    185|	return 0;
  177|  1.51k|}
is_json.c:json_isxdigit:
  105|  1.62k|{
  106|  1.62k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 216, False: 1.41k]
  ------------------
  107|    216|		return 1;
  108|  1.41k|	switch (uc) {
  109|    931|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 440, False: 973]
  |  Branch (109:12): [True: 176, False: 1.23k]
  |  Branch (109:22): [True: 172, False: 1.24k]
  |  Branch (109:32): [True: 45, False: 1.36k]
  |  Branch (109:42): [True: 8, False: 1.40k]
  |  Branch (109:52): [True: 90, False: 1.32k]
  ------------------
  110|  1.38k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 194, False: 1.21k]
  |  Branch (110:12): [True: 18, False: 1.39k]
  |  Branch (110:22): [True: 14, False: 1.39k]
  |  Branch (110:32): [True: 195, False: 1.21k]
  |  Branch (110:42): [True: 11, False: 1.40k]
  |  Branch (110:52): [True: 25, False: 1.38k]
  ------------------
  111|  1.38k|		return 1;
  112|     25|	default:
  ------------------
  |  Branch (112:2): [True: 25, False: 1.38k]
  ------------------
  113|     25|		return 0;
  114|  1.41k|	}
  115|  1.41k|}
is_json.c:json_isdigit:
   93|  70.8M|{
   94|  70.8M|	switch (uc) {
   95|  68.8M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 67.0M, False: 3.86M]
  |  Branch (95:12): [True: 1.74M, False: 69.1M]
  |  Branch (95:22): [True: 525, False: 70.8M]
  |  Branch (95:32): [True: 19.2k, False: 70.8M]
  |  Branch (95:42): [True: 193, False: 70.8M]
  ------------------
   96|  70.8M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 1.45M, False: 69.4M]
  |  Branch (96:12): [True: 565k, False: 70.3M]
  |  Branch (96:22): [True: 32.3k, False: 70.8M]
  |  Branch (96:32): [True: 120, False: 70.8M]
  |  Branch (96:42): [True: 388, False: 70.8M]
  ------------------
   97|  70.8M|		return 1;
   98|  36.2k|	default:
  ------------------
  |  Branch (98:2): [True: 36.2k, False: 70.8M]
  ------------------
   99|  36.2k|		return 0;
  100|  70.8M|	}
  101|  70.8M|}
is_json.c:json_parse_array:
  182|  4.24k|{
  183|  4.24k|	const unsigned char *uc = *ucp;
  184|       |
  185|  4.24k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  4.24k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 4.24k]
  |  |  ------------------
  ------------------
  186|  8.28k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 8.24k, False: 47]
  ------------------
  187|  8.24k|		uc = json_skip_space(uc, ue);
  188|  8.24k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 17, False: 8.22k]
  ------------------
  189|     17|			goto out;
  190|  8.22k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 233, False: 7.99k]
  ------------------
  191|    233|			goto done;
  192|  7.99k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 3.38k, False: 4.60k]
  ------------------
  193|  3.38k|			goto out;
  194|  4.60k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 59, False: 4.54k]
  ------------------
  195|     59|			goto out;
  196|  4.54k|		switch (*uc) {
  197|  4.04k|		case ',':
  ------------------
  |  Branch (197:3): [True: 4.04k, False: 502]
  ------------------
  198|  4.04k|			uc++;
  199|  4.04k|			continue;
  200|    493|		case ']':
  ------------------
  |  Branch (200:3): [True: 493, False: 4.05k]
  ------------------
  201|    726|		done:
  202|    726|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    726|#define JSON_ARRAYN	5
  ------------------
  203|    726|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    726|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 726]
  |  |  ------------------
  ------------------
  204|    726|			*ucp = uc + 1;
  205|    726|			return 1;
  206|      9|		default:
  ------------------
  |  Branch (206:3): [True: 9, False: 4.53k]
  ------------------
  207|      9|			goto out;
  208|  4.54k|		}
  209|  4.54k|	}
  210|  3.52k|out:
  211|  3.52k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  3.52k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 3.52k]
  |  |  ------------------
  ------------------
  212|  3.52k|	*ucp = uc;
  213|  3.52k|	return 0;
  214|  4.24k|}
is_json.c:json_parse_object:
  219|    723|{
  220|    723|	const unsigned char *uc = *ucp;
  221|    723|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    723|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 723]
  |  |  ------------------
  ------------------
  222|    918|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 910, False: 8]
  ------------------
  223|    910|		uc = json_skip_space(uc, ue);
  224|    910|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 13, False: 897]
  ------------------
  225|     13|			goto out;
  226|    897|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 228, False: 669]
  ------------------
  227|    228|			uc++;
  228|    228|			goto done;
  229|    228|		}
  230|    669|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 35, False: 634]
  ------------------
  231|     35|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     35|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 35]
  |  |  ------------------
  ------------------
  232|     35|			goto out;
  233|     35|		}
  234|    634|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    634|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 634]
  |  |  ------------------
  ------------------
  235|    634|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 6, False: 628]
  ------------------
  236|      6|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      6|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 6]
  |  |  ------------------
  ------------------
  237|      6|			goto out;
  238|      6|		}
  239|    628|		uc = json_skip_space(uc, ue);
  240|    628|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 11, False: 617]
  ------------------
  241|     11|			goto out;
  242|    617|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 20, False: 597]
  ------------------
  243|     20|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|     20|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 20]
  |  |  ------------------
  ------------------
  244|     20|			goto out;
  245|     20|		}
  246|    597|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 202, False: 395]
  ------------------
  247|    202|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    202|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 202]
  |  |  ------------------
  ------------------
  248|    202|			goto out;
  249|    202|		}
  250|    395|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 2, False: 393]
  ------------------
  251|      2|			goto out;
  252|    393|		switch (*uc++) {
  253|    195|		case ',':
  ------------------
  |  Branch (253:3): [True: 195, False: 198]
  ------------------
  254|    195|			continue;
  255|    197|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 197, False: 196]
  ------------------
  256|    425|		done:
  257|    425|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    425|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 425]
  |  |  ------------------
  ------------------
  258|    425|			*ucp = uc;
  259|    425|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 392]
  ------------------
  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|    393|		}
  265|    393|	}
  266|    298|out:
  267|    298|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    298|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 298]
  |  |  ------------------
  ------------------
  268|    298|	*ucp = uc;
  269|    298|	return 0;
  270|    723|}
is_json.c:json_parse_const:
  328|  1.10k|{
  329|  1.10k|	const unsigned char *uc = *ucp;
  330|       |
  331|  1.10k|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|  1.10k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.10k]
  |  |  ------------------
  ------------------
  332|  1.10k|	*ucp += --len - 1;
  333|  1.10k|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 66, False: 1.04k]
  ------------------
  334|     66|		*ucp = ue;
  335|  4.45k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 4.38k, False: 65]
  |  Branch (335:20): [True: 3.41k, False: 971]
  ------------------
  336|  3.41k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 70, False: 3.34k]
  ------------------
  337|     70|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     70|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 70]
  |  |  ------------------
  ------------------
  338|     70|			return 0;
  339|     70|		}
  340|  3.41k|	}
  341|  1.03k|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|  1.03k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.03k]
  |  |  ------------------
  ------------------
  342|  1.03k|	return 1;
  343|  1.10k|}
is_json.c:json_parse_number:
  276|  16.9k|{
  277|  16.9k|	const unsigned char *uc = *ucp;
  278|  16.9k|	int got = 0;
  279|       |
  280|  16.9k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  16.9k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 16.9k]
  |  |  ------------------
  ------------------
  281|  16.9k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 16.9k]
  ------------------
  282|      0|		return 0;
  283|  16.9k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 207, False: 16.7k]
  ------------------
  284|    207|		uc++;
  285|       |
  286|  67.1M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 67.1M, False: 61]
  ------------------
  287|  67.1M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 16.8k, False: 67.1M]
  ------------------
  288|  16.8k|			break;
  289|  67.1M|		got = 1;
  290|  67.1M|	}
  291|  16.9k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 61, False: 16.8k]
  ------------------
  292|     61|		goto out;
  293|  16.8k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 257, False: 16.6k]
  ------------------
  294|    257|		uc++;
  295|  2.29M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 2.29M, False: 23]
  ------------------
  296|  2.29M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 16.8k, False: 2.27M]
  ------------------
  297|  16.8k|			break;
  298|  2.27M|		got = 1;
  299|  2.27M|	}
  300|  16.8k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 23, False: 16.8k]
  ------------------
  301|     23|		goto out;
  302|  16.8k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 2.55k, False: 14.3k]
  |  Branch (302:14): [True: 643, False: 1.91k]
  |  Branch (302:28): [True: 464, False: 1.44k]
  ------------------
  303|  1.10k|		uc++;
  304|  1.10k|		got = 0;
  305|  1.10k|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 11, False: 1.09k]
  ------------------
  306|     11|			goto out;
  307|  1.09k|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 194, False: 902]
  |  Branch (307:21): [True: 285, False: 617]
  ------------------
  308|    479|			uc++;
  309|  1.45M|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 1.45M, False: 30]
  ------------------
  310|  1.45M|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 1.06k, False: 1.45M]
  ------------------
  311|  1.06k|				break;
  312|  1.45M|			got = 1;
  313|  1.45M|		}
  314|  1.09k|	}
  315|  16.9k|out:
  316|  16.9k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 14.3k, False: 2.57k]
  ------------------
  317|  14.3k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  14.3k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 14.3k]
  |  |  ------------------
  ------------------
  318|  2.57k|	else
  319|  2.57k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  2.57k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 2.57k]
  |  |  ------------------
  ------------------
  320|  16.9k|	*ucp = uc;
  321|  16.9k|	return got;
  322|  16.8k|}

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

file_is_tar:
   64|  15.3k|{
   65|  15.3k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  15.3k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  15.3k|	size_t nbytes = b->flen;
   67|       |	/*
   68|       |	 * Do the tar test first, because if the first file in the tar
   69|       |	 * archive starts with a dot, we can confuse it with an nroff file.
   70|       |	 */
   71|  15.3k|	int tar;
   72|  15.3k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  15.3k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  15.3k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  15.3k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  15.3k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  15.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  15.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 15.3k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  15.3k|	tar = is_tar(buf, nbytes);
   78|  15.3k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 15.3k, False: 25]
  |  Branch (78:17): [True: 0, False: 25]
  ------------------
   79|  15.3k|		return 0;
   80|       |
   81|     25|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     25|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 25]
  ------------------
   82|      0|		return 1;
   83|       |
   84|     25|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 25]
  |  Branch (84:28): [True: 0, False: 25]
  ------------------
   85|     25|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|     25|	return 1;
   89|     25|}
is_tar.c:is_tar:
  100|  15.3k|{
  101|  15.3k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  15.3k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  461|  15.3k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  15.3k|	    RCAST(const void *, buf));
  105|  15.3k|	size_t i;
  106|  15.3k|	int sum, recsum;
  107|  15.3k|	const unsigned char *p, *ep;
  108|  15.3k|	const char *nulp;
  109|       |
  110|  15.3k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 12.0k, False: 3.27k]
  ------------------
  111|  12.0k|		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.27k|	nulp = CAST(const char *,
  ------------------
  |  |  460|  3.27k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  3.27k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  3.27k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 2.90k, False: 372]
  |  Branch (118:22): [True: 1.69k, False: 1.21k]
  ------------------
  119|  1.69k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 24, False: 1.66k]
  ------------------
  120|  1.69k|	    sizeof(gpkg_match)) == 0)
  121|     24|	    return 0;
  122|       |
  123|  3.25k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  3.25k|	sum = 0;
  126|  3.25k|	p = header->charptr;
  127|  3.25k|	ep = header->charptr + sizeof(*header);
  128|  1.66M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.66M, False: 3.25k]
  ------------------
  129|  1.66M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  29.2k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 26.0k, False: 3.25k]
  ------------------
  133|  26.0k|		sum -= header->header.chksum[i];
  134|  3.25k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  3.25k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 3.22k, False: 25]
  ------------------
  137|  3.22k|		return 0;	/* Not a tar archive */
  138|       |
  139|     25|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|     25|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 1, False: 24]
  ------------------
  140|     25|	    sizeof(header->header.magic)) == 0)
  141|      1|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|     24|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|     24|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 1, False: 23]
  ------------------
  144|     24|	    sizeof(header->header.magic)) == 0)
  145|      1|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|     23|	return 1;			/* Old fashioned tar archive */
  148|     24|}
is_tar.c:from_oct:
  158|  3.25k|{
  159|  3.25k|	int	value;
  160|       |
  161|  3.92k|	while (digs > 0 && isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  ------------------
  |  Branch (161:9): [True: 3.85k, False: 73]
  |  Branch (161:21): [True: 675, False: 3.17k]
  ------------------
  162|    675|		where++;
  163|    675|		digs--;
  164|    675|	}
  165|  3.25k|	if (digs == 0)
  ------------------
  |  Branch (165:6): [True: 73, False: 3.17k]
  ------------------
  166|     73|		return -1;		/* All blank field */
  167|  3.17k|	value = 0;
  168|  3.75k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  3.71k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 1.11k, False: 2.60k]
  |  |  |  Branch (51:39): [True: 579, False: 532]
  |  |  ------------------
  ------------------
  |  Branch (168:9): [True: 3.71k, False: 42]
  ------------------
  169|    579|		value = (value << 3) | (*where++ - '0');
  170|    579|		digs--;
  171|    579|	}
  172|       |
  173|  3.17k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (173:6): [True: 3.13k, False: 42]
  |  Branch (173:18): [True: 1.30k, False: 1.83k]
  |  Branch (173:28): [True: 1.30k, False: 4]
  ------------------
  174|  1.30k|		return -1;			/* Ended on non-(space/NUL) */
  175|       |
  176|  1.87k|	return value;
  177|  3.17k|}

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;
  ------------------
  |  |  195|      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);
  ------------------
  |  |  195|      2|#define	FILE_LOAD	0
  ------------------
  323|      2|}
magic_descriptor:
  405|  11.9k|{
  406|  11.9k|	if (ms == NULL)
  ------------------
  |  Branch (406:6): [True: 0, False: 11.9k]
  ------------------
  407|      0|		return NULL;
  408|  11.9k|	return file_or_fd(ms, NULL, fd);
  409|  11.9k|}
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|  11.9k|{
  425|  11.9k|	int	rv = -1;
  426|  11.9k|	unsigned char *buf;
  427|  11.9k|	struct stat	sb;
  428|  11.9k|	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
  429|  11.9k|	int	ispipe = 0;
  430|  11.9k|	int	okstat = 0;
  431|  11.9k|	off_t	pos = CAST(off_t, -1);
  ------------------
  |  |  460|  11.9k|#define CAST(T, b)	((T)(b))
  ------------------
  432|       |
  433|  11.9k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (433:6): [True: 0, False: 11.9k]
  ------------------
  434|      0|		goto out;
  435|       |
  436|       |	/*
  437|       |	 * one extra for terminating '\0', and
  438|       |	 * some overlapping space for matches near EOF
  439|       |	 */
  440|  11.9k|#define SLOP (1 + sizeof(union VALUETYPE))
  441|  11.9k|	if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
  ------------------
  |  |  460|  11.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (441:6): [True: 0, False: 11.9k]
  ------------------
  442|      0|		return NULL;
  443|       |
  444|  11.9k|	switch (file_fsmagic(ms, inname, &sb)) {
  445|      0|	case -1:		/* error */
  ------------------
  |  Branch (445:2): [True: 0, False: 11.9k]
  ------------------
  446|      0|		goto done;
  447|  11.9k|	case 0:			/* nothing found */
  ------------------
  |  Branch (447:2): [True: 11.9k, False: 0]
  ------------------
  448|  11.9k|		break;
  449|      0|	default:		/* matched it and printed type */
  ------------------
  |  Branch (449:2): [True: 0, False: 11.9k]
  ------------------
  450|      0|		rv = 0;
  451|      0|		goto done;
  452|  11.9k|	}
  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|  11.9k|	if (inname != NULL) {
  ------------------
  |  Branch (459:6): [True: 0, False: 11.9k]
  ------------------
  460|      0|		int flags = O_RDONLY|O_BINARY|O_NONBLOCK|O_CLOEXEC;
  ------------------
  |  |  740|      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|  11.9k|	if (fd != -1) {
  ------------------
  |  Branch (487:6): [True: 11.9k, False: 0]
  ------------------
  488|  11.9k|		okstat = fstat(fd, &sb) == 0;
  489|  11.9k|		if (okstat && S_ISFIFO(sb.st_mode))
  ------------------
  |  Branch (489:7): [True: 11.9k, False: 0]
  |  Branch (489:17): [True: 0, False: 11.9k]
  ------------------
  490|      0|			ispipe = 1;
  491|  11.9k|		if (inname == NULL)
  ------------------
  |  Branch (491:7): [True: 11.9k, False: 0]
  ------------------
  492|  11.9k|			pos = lseek(fd, CAST(off_t, 0), SEEK_CUR);
  ------------------
  |  |  460|  11.9k|#define CAST(T, b)	((T)(b))
  ------------------
  493|  11.9k|	}
  494|       |
  495|       |	/*
  496|       |	 * try looking at the first ms->bytes_max bytes
  497|       |	 */
  498|  11.9k|	if (ispipe) {
  ------------------
  |  Branch (498:6): [True: 0, False: 11.9k]
  ------------------
  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]),
  ------------------
  |  |  461|      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) {
  ------------------
  |  |  460|      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|  11.9k|	} else if (fd != -1) {
  ------------------
  |  Branch (517:13): [True: 11.9k, False: 0]
  ------------------
  518|       |		/* Windows refuses to read from a big console buffer. */
  519|  11.9k|		size_t howmany =
  520|       |#ifdef WIN32
  521|       |		    _isatty(fd) ? 8 * 1024 :
  522|       |#endif
  523|  11.9k|		    ms->bytes_max;
  524|  11.9k|		if ((nbytes = read(fd, RCAST(void *, buf), howmany)) == -1) {
  ------------------
  |  |  461|  11.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (524:7): [True: 0, False: 11.9k]
  ------------------
  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|  11.9k|	}
  533|       |
  534|  11.9k|	(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
  ------------------
  |  |  440|  11.9k|#define SLOP (1 + sizeof(union VALUETYPE))
  ------------------
  535|  11.9k|	if (file_buffer(ms, fd, okstat ? &sb : NULL, inname, buf,
  ------------------
  |  Branch (535:6): [True: 129, False: 11.8k]
  |  Branch (535:26): [True: 11.9k, False: 0]
  ------------------
  536|  11.9k|	    CAST(size_t, nbytes)) == -1)
  ------------------
  |  |  460|  11.9k|#define CAST(T, b)	((T)(b))
  ------------------
  537|    129|		goto done;
  538|  11.8k|	rv = 0;
  539|  11.9k|done:
  540|  11.9k|	free(buf);
  541|  11.9k|	if (fd != -1) {
  ------------------
  |  Branch (541:6): [True: 11.9k, False: 0]
  ------------------
  542|  11.9k|		if (pos != CAST(off_t, -1))
  ------------------
  |  |  460|  11.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (542:7): [True: 11.9k, False: 0]
  ------------------
  543|  11.9k|			(void)lseek(fd, pos, SEEK_SET);
  544|  11.9k|		close_and_restore(ms, inname, fd, okstat ? &sb : NULL);
  ------------------
  |  Branch (544:37): [True: 11.9k, False: 0]
  ------------------
  545|  11.9k|	}
  546|  11.9k|out:
  547|  11.9k|	return rv == 0 ? file_getbuffer(ms) : NULL;
  ------------------
  |  Branch (547:9): [True: 11.8k, False: 129]
  ------------------
  548|  11.9k|}
magic.c:close_and_restore:
  367|  11.9k|{
  368|  11.9k|	if (fd == STDIN_FILENO || name == NULL)
  ------------------
  |  Branch (368:6): [True: 0, False: 11.9k]
  |  Branch (368:28): [True: 11.9k, False: 0]
  ------------------
  369|  11.9k|		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) && (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|}

fmtcheck:
  236|  57.4k|{
  237|  57.4k|	const char	*f1p, *f2p;
  238|  57.4k|	EFT		f1t, f2t;
  239|       |
  240|  57.4k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 57.4k]
  ------------------
  241|       |
  242|  57.4k|	f1p = f1;
  243|  57.4k|	f1t = FMTCHECK_START;
  244|  57.4k|	f2p = f2;
  245|  57.4k|	f2t = FMTCHECK_START;
  246|   114k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 57.4k, False: 57.4k]
  ------------------
  247|  57.4k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 57.4k]
  ------------------
  248|      0|			return f2;
  249|  57.4k|		f2t = get_next_format(&f2p, f2t);
  250|  57.4k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 57.4k]
  ------------------
  251|      0|			return f2;
  252|  57.4k|	}
  253|  57.4k|	return f1;
  254|  57.4k|}
fmtcheck.c:get_next_format:
  190|   172k|{
  191|   172k|	int		infmt;
  192|   172k|	const char	*f;
  193|       |
  194|   172k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 172k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|   172k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 172k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|   172k|	f = *pf;
  203|   172k|	infmt = 0;
  204|   287k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 172k, False: 114k]
  ------------------
  205|   172k|		f = strchr(f, '%');
  206|   172k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 57.4k, False: 114k]
  ------------------
  207|  57.4k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  57.4k|#define RETURN(pf,f,r) do { \
  |  |   61|  57.4k|			*(pf) = (f); \
  |  |   62|  57.4k|			return r; \
  |  |   63|  57.4k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  208|   114k|		f++;
  209|   114k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 114k]
  ------------------
  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|   114k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 114k, False: 0]
  ------------------
  212|   114k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|   114k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|   123k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 123k, False: 0]
  |  Branch (218:15): [True: 8.59k, False: 114k]
  ------------------
  219|  8.59k|		f++;
  220|       |
  221|   114k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 114k]
  ------------------
  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|   114k|	while (isdigit((unsigned char)*f)) f++;
  ------------------
  |  Branch (225:9): [True: 6.58k, False: 114k]
  ------------------
  226|   114k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 114k]
  ------------------
  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|   114k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|   114k|#define RETURN(pf,f,r) do { \
  |  |   61|   114k|			*(pf) = (f); \
  |  |   62|   114k|			return r; \
  |  |   63|   114k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|   114k|}
fmtcheck.c:get_next_format_from_width:
  171|   114k|{
  172|   114k|	const char	*f;
  173|       |
  174|   114k|	f = *pf;
  175|   114k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 6.64k, False: 108k]
  ------------------
  176|  6.64k|		f++;
  177|  6.64k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 6.64k]
  ------------------
  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|  7.10k|		while (isdigit((unsigned char)*f)) f++;
  ------------------
  |  Branch (181:10): [True: 7.10k, False: 6.64k]
  ------------------
  182|  6.64k|		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: 6.64k]
  ------------------
  183|  6.64k|	}
  184|   114k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|   114k|#define RETURN(pf,f,r) do { \
  |  |   61|   114k|			*(pf) = (f); \
  |  |   62|   114k|			return r; \
  |  |   63|   114k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|   114k|}
fmtcheck.c:get_next_format_from_precision:
   67|   114k|{
   68|   114k|	int		sh, lg, quad, longdouble;
   69|   114k|	const char	*f;
   70|       |
   71|   114k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|   114k|	f = *pf;
   74|   114k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 114k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|  1.99k|	case 'l':
  ------------------
  |  Branch (79:2): [True: 1.99k, False: 112k]
  ------------------
   80|  1.99k|		f++;
   81|  1.99k|		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.99k]
  ------------------
   82|  1.99k|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 1.99k, False: 0]
  ------------------
   83|  1.99k|			f++;
   84|  1.99k|			quad = 1;
   85|  1.99k|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|  1.99k|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 114k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 114k]
  ------------------
   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|   112k|	default:
  ------------------
  |  Branch (114:2): [True: 112k, False: 1.99k]
  ------------------
  115|   112k|		break;
  116|   114k|	}
  117|   114k|	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: 114k]
  ------------------
  118|   114k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 80.9k, False: 33.8k]
  ------------------
  119|  80.9k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 80.9k]
  ------------------
  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|  80.9k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 80.9k]
  ------------------
  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|  80.9k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 1.99k, False: 78.9k]
  ------------------
  124|  1.99k|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|  1.99k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.99k|			*(pf) = (f); \
  |  |   62|  1.99k|			return r; \
  |  |   63|  1.99k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  125|  78.9k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  78.9k|#define RETURN(pf,f,r) do { \
  |  |   61|  78.9k|			*(pf) = (f); \
  |  |   62|  78.9k|			return r; \
  |  |   63|  78.9k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  126|  78.9k|	}
  127|  33.8k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 33.8k]
  ------------------
  128|      0|		if (longdouble)
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  130|      0|		if (sh)
  ------------------
  |  Branch (130:7): [True: 0, False: 0]
  ------------------
  131|      0|			RETURN(pf,f,FMTCHECK_SHORTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  132|      0|		if (lg)
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|			RETURN(pf,f,FMTCHECK_LONGPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  134|      0|		if (quad)
  ------------------
  |  Branch (134:7): [True: 0, False: 0]
  ------------------
  135|      0|			RETURN(pf,f,FMTCHECK_QUADPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  136|      0|		RETURN(pf,f,FMTCHECK_INTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  137|      0|	}
  138|  33.8k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 33.8k]
  ------------------
  139|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (139:7): [True: 0, False: 0]
  ------------------
  140|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  141|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  142|      0|	}
  143|  33.8k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 1.81k, False: 32.0k]
  ------------------
  144|  1.81k|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 1.81k]
  ------------------
  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.81k|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 1.81k]
  ------------------
  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.81k|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|  1.81k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.81k|			*(pf) = (f); \
  |  |   62|  1.81k|			return r; \
  |  |   63|  1.81k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  149|  1.81k|	}
  150|  32.0k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 561, False: 31.5k]
  ------------------
  151|    561|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 561]
  ------------------
  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|    561|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    561|#define RETURN(pf,f,r) do { \
  |  |   61|    561|			*(pf) = (f); \
  |  |   62|    561|			return r; \
  |  |   63|    561|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  154|    561|	}
  155|  31.5k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 31.5k, False: 0]
  ------------------
  156|  31.5k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 31.5k]
  ------------------
  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|  31.5k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  31.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  31.5k|			*(pf) = (f); \
  |  |   62|  31.5k|			return r; \
  |  |   63|  31.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  159|  31.5k|	}
  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|}

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

file_fmtdatetime:
  311|  3.25k|{
  312|  3.25k|	char *pp;
  313|  3.25k|	time_t t;
  314|  3.25k|	struct tm *tm, tmz;
  315|       |
  316|  3.25k|	if (flags & FILE_T_WINDOWS) {
  ------------------
  |  |  549|  3.25k|#define FILE_T_WINDOWS	2
  ------------------
  |  Branch (316:6): [True: 1.40k, False: 1.85k]
  ------------------
  317|  1.40k|		struct timespec ts;
  318|  1.40k|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  460|  1.40k|#define CAST(T, b)	((T)(b))
  ------------------
  319|  1.40k|		t = ts.tv_sec;
  320|  1.85k|	} else {
  321|       |		// XXX: perhaps detect and print something if overflow
  322|       |		// on 32 bit time_t?
  323|  1.85k|		t = CAST(time_t, v);
  ------------------
  |  |  460|  1.85k|#define CAST(T, b)	((T)(b))
  ------------------
  324|  1.85k|	}
  325|       |
  326|  3.25k|	if (t > MAX_CTIME)
  ------------------
  |  |  181|  3.25k|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 3.25k, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (326:6): [True: 281, False: 2.96k]
  ------------------
  327|    281|		goto out;
  328|       |
  329|  2.96k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  548|  2.96k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (329:6): [True: 404, False: 2.56k]
  ------------------
  330|    404|#ifdef HAVE_TZSET
  331|    404|		tzset();
  332|    404|#endif
  333|    404|		tm = localtime_r(&t, &tmz);
  334|  2.56k|	} else {
  335|  2.56k|		tm = gmtime_r(&t, &tmz);
  336|  2.56k|	}
  337|  2.96k|	if (tm == NULL)
  ------------------
  |  Branch (337:6): [True: 81, False: 2.88k]
  ------------------
  338|     81|		goto out;
  339|  2.88k|	pp = asctime_r(tm, buf);
  340|       |
  341|  2.88k|	if (pp == NULL)
  ------------------
  |  Branch (341:6): [True: 249, False: 2.63k]
  ------------------
  342|    249|		goto out;
  343|  2.63k|	pp[strcspn(pp, "\n")] = '\0';
  344|  2.63k|	return pp;
  345|    611|out:
  346|    611|	strlcpy(buf, "*Invalid datetime*", bsize);
  347|    611|	return buf;
  348|  2.88k|}
file_fmtdate:
  356|    213|{
  357|    213|	struct tm tm;
  358|       |
  359|    213|	memset(&tm, 0, sizeof(tm));
  360|    213|	tm.tm_mday = v & 0x1f;
  361|    213|	tm.tm_mon = ((v >> 5) & 0xf) - 1;
  362|       |	// Sanity check because some OS's coredump with invalid values.
  363|       |	// Yes, Cygwin I am looking at you!
  364|    213|	if (tm.tm_mon < 0 || tm.tm_mon > 11)
  ------------------
  |  Branch (364:6): [True: 70, False: 143]
  |  Branch (364:23): [True: 70, False: 73]
  ------------------
  365|    140|		tm.tm_mon = 0;
  366|    213|	tm.tm_year = (v >> 9) + 80;
  367|       |
  368|    213|	if (strftime(buf, bsize, "%b %d %Y", &tm) == 0)
  ------------------
  |  Branch (368:6): [True: 0, False: 213]
  ------------------
  369|      0|		goto out;
  370|       |
  371|    213|	return buf;
  372|      0|out:
  373|      0|	strlcpy(buf, "*Invalid date*", bsize);
  374|      0|	return buf;
  375|    213|}
file_fmttime:
  379|    213|{
  380|    213|	struct tm tm;
  381|       |
  382|    213|	memset(&tm, 0, sizeof(tm));
  383|    213|	tm.tm_sec = (v & 0x1f) * 2;
  384|    213|	tm.tm_min = ((v >> 5) & 0x3f);
  385|    213|	tm.tm_hour = (v >> 11);
  386|       |
  387|    213|	if (strftime(buf, bsize, "%T", &tm) == 0)
  ------------------
  |  Branch (387:6): [True: 0, False: 213]
  ------------------
  388|      0|		goto out;
  389|       |
  390|    213|	return buf;
  391|      0|out:
  392|      0|	strlcpy(buf, "*Invalid time*", bsize);
  393|      0|	return buf;
  394|       |
  395|    213|}

file_trycdf:
  563|  15.3k|{
  564|  15.3k|	int fd = b->fd;
  565|  15.3k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  15.3k|#define CAST(T, b)	((T)(b))
  ------------------
  566|  15.3k|	size_t nbytes = b->flen;
  567|  15.3k|	cdf_info_t info;
  568|  15.3k|	cdf_header_t h;
  569|  15.3k|	cdf_sat_t sat, ssat;
  570|  15.3k|	cdf_stream_t sst, scn;
  571|  15.3k|	cdf_dir_t dir;
  572|  15.3k|	int i;
  573|  15.3k|	const char *expn = "";
  574|  15.3k|	const cdf_directory_t *root_storage;
  575|       |
  576|  15.3k|	scn.sst_tab = NULL;
  577|  15.3k|	info.i_fd = fd;
  578|  15.3k|	info.i_buf = buf;
  579|  15.3k|	info.i_len = nbytes;
  580|  15.3k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  15.3k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  15.3k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (580:6): [True: 0, False: 15.3k]
  ------------------
  581|      0|		return 0;
  582|  15.3k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (582:6): [True: 14.2k, False: 1.10k]
  ------------------
  583|  14.2k|		return 0;
  584|       |#ifdef CDF_DEBUG
  585|       |	cdf_dump_header(&h);
  586|       |#endif
  587|       |
  588|  1.10k|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (588:6): [True: 169, False: 936]
  ------------------
  589|    169|		expn = "Can't read SAT";
  590|    169|		goto out0;
  591|    169|	}
  592|       |#ifdef CDF_DEBUG
  593|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  594|       |#endif
  595|       |
  596|    936|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (596:6): [True: 280, False: 656]
  ------------------
  597|    280|		expn = "Can't read SSAT";
  598|    280|		goto out1;
  599|    280|	}
  600|       |#ifdef CDF_DEBUG
  601|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  602|       |#endif
  603|       |
  604|    656|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (604:6): [True: 91, False: 565]
  ------------------
  605|     91|		expn = "Can't read directory";
  606|     91|		goto out2;
  607|     91|	}
  608|       |
  609|    565|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (609:6): [True: 87, False: 478]
  ------------------
  610|    565|	    &root_storage)) == -1) {
  611|     87|		expn = "Cannot read short stream";
  612|     87|		goto out3;
  613|     87|	}
  614|       |#ifdef CDF_DEBUG
  615|       |	cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
  616|       |#endif
  617|       |#ifdef notdef
  618|       |	if (root_storage) {
  619|       |		if (NOTMIME(ms)) {
  620|       |			char clsbuf[128];
  621|       |			if (file_printf(ms, "CLSID %s, ",
  622|       |			    format_clsid(clsbuf, sizeof(clsbuf),
  623|       |			    root_storage->d_storage_uuid)) == -1)
  624|       |				return -1;
  625|       |		}
  626|       |	}
  627|       |#endif
  628|       |
  629|    478|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (629:6): [True: 13, False: 465]
  ------------------
  630|    478|	    "FileHeader", &scn) != -1) {
  631|     13|#define HWP5_SIGNATURE "HWP Document File"
  632|     13|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  631|     13|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (632:7): [True: 11, False: 2]
  ------------------
  633|     11|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  631|     11|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (633:10): [True: 1, False: 10]
  ------------------
  634|     11|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  631|     11|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  635|      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]
  |  |  ------------------
  ------------------
  636|      1|			if (file_printf(ms,
  ------------------
  |  Branch (636:8): [True: 0, False: 1]
  ------------------
  637|      1|			    "Hancom HWP (Hangul Word Processor) file, version 5.0") == -1)
  638|      0|			    return -1;
  639|      1|		    } else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (639:18): [True: 0, False: 0]
  ------------------
  640|      0|			if (file_printf(ms, "application/x-hwp") == -1)
  ------------------
  |  Branch (640:8): [True: 0, False: 0]
  ------------------
  641|      0|			    return -1;
  642|      0|		    }
  643|      1|		    i = 1;
  644|      1|		    goto out5;
  645|     12|		} else {
  646|     12|		    cdf_zero_stream(&scn);
  647|     12|		}
  648|     13|	}
  649|       |
  650|    477|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (650:6): [True: 352, False: 125]
  ------------------
  651|    477|	    &scn)) == -1) {
  652|    352|		if (errno != ESRCH) {
  ------------------
  |  Branch (652:7): [True: 155, False: 197]
  ------------------
  653|    155|			expn = "Cannot read summary info";
  654|    155|		}
  655|    352|	} else {
  656|    125|		i = cdf_check_summary_info(ms, &info, &h,
  657|    125|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  658|    125|		cdf_zero_stream(&scn);
  659|    125|	}
  660|    477|	if (i <= 0) {
  ------------------
  |  Branch (660:6): [True: 477, False: 0]
  ------------------
  661|    477|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (661:7): [True: 463, False: 14]
  ------------------
  662|    477|		    &sst, &dir, &scn)) == -1) {
  663|    463|			if (errno != ESRCH) {
  ------------------
  |  Branch (663:8): [True: 26, False: 437]
  ------------------
  664|     26|				expn = "Cannot read summary info";
  665|     26|			}
  666|    463|		} else {
  667|     14|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  668|     14|			    &sst, &dir, &scn, root_storage, &expn);
  669|     14|		}
  670|    477|	}
  671|    477|	if (i <= 0) {
  ------------------
  |  Branch (671:6): [True: 477, False: 0]
  ------------------
  672|    477|		i = cdf_file_dir_info(ms, &dir);
  673|    477|		if (i < 0)
  ------------------
  |  Branch (673:7): [True: 473, False: 4]
  ------------------
  674|    473|			expn = "Cannot read section info";
  675|    477|	}
  676|    478|out5:
  677|    478|	cdf_zero_stream(&scn);
  678|    478|	cdf_zero_stream(&sst);
  679|    565|out3:
  680|    565|	free(dir.dir_tab);
  681|    656|out2:
  682|    656|	free(ssat.sat_tab);
  683|    936|out1:
  684|    936|	free(sat.sat_tab);
  685|  1.10k|out0:
  686|       |	/* If we handled it already, return */
  687|  1.10k|	if (i != -1)
  ------------------
  |  Branch (687:6): [True: 5, False: 1.10k]
  ------------------
  688|      5|		return i;
  689|       |	/* Provide a default handler */
  690|  1.10k|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|  1.10k|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|  1.10k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.10k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.10k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1.10k, False: 0]
  |  |  ------------------
  ------------------
  691|  1.10k|		if (file_printf(ms,
  ------------------
  |  Branch (691:7): [True: 0, False: 1.10k]
  ------------------
  692|  1.10k|		    "Composite Document File V2 Document") == -1)
  693|      0|			return -1;
  694|  1.10k|		if (*expn)
  ------------------
  |  Branch (694:7): [True: 1.10k, False: 0]
  ------------------
  695|  1.10k|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (695:8): [True: 0, False: 1.10k]
  ------------------
  696|      0|				return -1;
  697|  1.10k|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (697:13): [True: 0, False: 0]
  ------------------
  698|       |		/* https://reposcope.com/mimetype/application/x-ole-storage */
  699|      0|		if (file_printf(ms, "application/x-ole-storage") == -1)
  ------------------
  |  Branch (699:7): [True: 0, False: 0]
  ------------------
  700|      0|			return -1;
  701|      0|	}
  702|  1.10k|	return 1;
  703|  1.10k|}
readcdf.c:cdf_check_summary_info:
  396|    139|{
  397|    139|	int i;
  398|    139|	const char *str = NULL;
  399|    139|	cdf_directory_t *d;
  400|    139|	char name[__arraycount(d->d_name) + 1];
  401|    139|	size_t j, k;
  402|       |
  403|       |#ifdef CDF_DEBUG
  404|       |	cdf_dump_summary_info(h, scn);
  405|       |#endif
  406|    139|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (406:6): [True: 139, False: 0]
  ------------------
  407|    139|	    *expn = "Can't expand summary_info";
  408|    139|	    return i;
  409|    139|	}
  410|      0|	if (i == 1)
  ------------------
  |  Branch (410:6): [True: 0, False: 0]
  ------------------
  411|      0|		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) - 1; k++)
  ------------------
  |  Branch (414:15): [True: 0, False: 0]
  ------------------
  415|      0|			name[k] = CAST(char, cdf_tole2(d->d_name[k]));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  416|      0|		name[sizeof(name) - 1] = '\0';
  417|      0|		str = cdf_app_to_mime(name,
  418|      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]
  |  |  ------------------
  ------------------
  419|      0|	}
  420|      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]
  |  |  ------------------
  ------------------
  421|      0|		if (str != NULL) {
  ------------------
  |  Branch (421:7): [True: 0, False: 0]
  ------------------
  422|      0|			if (file_printf(ms, "%s", str) == -1)
  ------------------
  |  Branch (422:8): [True: 0, False: 0]
  ------------------
  423|      0|				return -1;
  424|      0|			i = 1;
  425|      0|		}
  426|      0|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (426:13): [True: 0, False: 0]
  ------------------
  427|      0|		if (str == NULL)
  ------------------
  |  Branch (427:7): [True: 0, False: 0]
  ------------------
  428|      0|			str = "vnd.ms-office";
  429|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (429:7): [True: 0, False: 0]
  ------------------
  430|      0|			return -1;
  431|      0|		i = 1;
  432|      0|	}
  433|      0|	if (i <= 0) {
  ------------------
  |  Branch (433:6): [True: 0, False: 0]
  ------------------
  434|      0|		i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst,
  435|      0|					  dir, scn);
  436|      0|	}
  437|      0|	return i;
  438|      0|}
readcdf.c:cdf_file_summary_info:
  304|    139|{
  305|    139|	cdf_summary_info_header_t si;
  306|    139|	cdf_property_info_t *info;
  307|    139|	size_t count;
  308|    139|	int m;
  309|       |
  310|    139|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (310:6): [True: 139, False: 0]
  ------------------
  311|    139|		return -1;
  312|       |
  313|      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]
  |  |  ------------------
  ------------------
  314|      0|		const char *str;
  315|       |
  316|      0|		if (file_printf(ms, "Composite Document File V2 Document")
  ------------------
  |  Branch (316:7): [True: 0, False: 0]
  ------------------
  317|      0|		    == -1)
  318|      0|			return -1;
  319|       |
  320|      0|		if (file_printf(ms, ", %s Endian",
  ------------------
  |  Branch (320:7): [True: 0, False: 0]
  ------------------
  321|      0|		    si.si_byte_order == 0xfffe ?  "Little" : "Big") == -1)
  ------------------
  |  Branch (321:7): [True: 0, False: 0]
  ------------------
  322|      0|			return -2;
  323|      0|		switch (si.si_os) {
  324|      0|		case 2:
  ------------------
  |  Branch (324:3): [True: 0, False: 0]
  ------------------
  325|      0|			if (file_printf(ms, ", Os: Windows, Version %d.%d",
  ------------------
  |  Branch (325:8): [True: 0, False: 0]
  ------------------
  326|      0|			    si.si_os_version & 0xff,
  327|      0|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  328|      0|				return -2;
  329|      0|			break;
  330|      0|		case 1:
  ------------------
  |  Branch (330:3): [True: 0, False: 0]
  ------------------
  331|      0|			if (file_printf(ms, ", Os: MacOS, Version %d.%d",
  ------------------
  |  Branch (331:8): [True: 0, False: 0]
  ------------------
  332|      0|			    CAST(uint32_t, si.si_os_version) >> 8,
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  333|      0|			    si.si_os_version & 0xff) == -1)
  334|      0|				return -2;
  335|      0|			break;
  336|      0|		default:
  ------------------
  |  Branch (336:3): [True: 0, False: 0]
  ------------------
  337|      0|			if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
  ------------------
  |  Branch (337:8): [True: 0, False: 0]
  ------------------
  338|      0|			    si.si_os_version & 0xff,
  339|      0|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  340|      0|				return -2;
  341|      0|			break;
  342|      0|		}
  343|      0|		if (root_storage) {
  ------------------
  |  Branch (343:7): [True: 0, False: 0]
  ------------------
  344|      0|			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  345|      0|			    clsid2desc);
  346|      0|			if (str) {
  ------------------
  |  Branch (346:8): [True: 0, False: 0]
  ------------------
  347|      0|				if (file_printf(ms, ", %s", str) == -1)
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      0|					return -2;
  349|      0|			}
  350|      0|		}
  351|      0|	}
  352|       |
  353|      0|	m = cdf_file_property_info(ms, info, count, root_storage);
  354|      0|	free(info);
  355|       |
  356|      0|	return m == -1 ? -2 : m;
  ------------------
  |  Branch (356:9): [True: 0, False: 0]
  ------------------
  357|      0|}
readcdf.c:cdf_file_dir_info:
  519|    477|{
  520|    477|	size_t sd, i, j;
  521|    477|	uint16_t *dir_name;
  522|    477|	int dir_type;
  523|    477|	const char* section_name;
  524|       |
  525|  7.98k|	for (i = 0; i < dir->dir_len; i++) {
  ------------------
  |  Branch (525:14): [True: 7.51k, False: 473]
  ------------------
  526|  7.51k|		dir_name = dir->dir_tab[i].d_name;
  527|  7.51k|		dir_type = dir->dir_tab[i].d_type;
  528|       |
  529|  52.5k|		for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  138|  52.5k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (529:16): [True: 45.0k, False: 7.50k]
  ------------------
  530|  45.0k|			const struct sinfo *si = &sectioninfo[sd];
  531|   112k|			for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (531:16): [True: 67.5k, False: 45.0k]
  ------------------
  532|  67.5k|				if (si->sections[j] == NULL)
  ------------------
  |  Branch (532:9): [True: 0, False: 67.5k]
  ------------------
  533|      0|					continue;
  534|  67.5k|				section_name = si->sections[j];
  535|  67.5k|				if (si->types[j] != dir_type ||
  ------------------
  |  Branch (535:9): [True: 60.5k, False: 7.00k]
  ------------------
  536|  7.00k|				    cdf_namecmp(section_name, dir_name,
  ------------------
  |  Branch (536:9): [True: 7.00k, False: 4]
  ------------------
  537|  7.00k|					strlen(section_name) + 1) != 0)
  538|  67.5k|				    continue;
  539|       |#ifdef CDF_DEBUG
  540|       |				fprintf(stderr, "Matching directory %"
  541|       |				    SIZE_T_FORMAT
  542|       |				    "u with expected name \"%s\"\n",
  543|       |				    i, section_name);
  544|       |#endif
  545|      4|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|      4|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      4|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      4|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      4|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  546|      4|					if (file_printf(ms, "CDFV2 %s",
  ------------------
  |  Branch (546:10): [True: 0, False: 4]
  ------------------
  547|      4|					    si->name) == -1)
  548|      0|						return -1;
  549|      4|				} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (549:16): [True: 0, False: 0]
  ------------------
  550|      0|					if (file_printf(ms, "application/%s",
  ------------------
  |  Branch (550:10): [True: 0, False: 0]
  ------------------
  551|      0|					    si->mime) == -1)
  552|      0|						return -1;
  553|      0|				}
  554|      4|				return 1;
  555|      4|			}
  556|  45.0k|		}
  557|  7.51k|	}
  558|    473|	return -1;
  559|    477|}

file_tryelf:
 1896|  7.86k|{
 1897|  7.86k|	int fd = b->fd;
 1898|  7.86k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  7.86k|#define CAST(T, b)	((T)(b))
  ------------------
 1899|  7.86k|	size_t nbytes = b->flen;
 1900|  7.86k|	union {
 1901|  7.86k|		int32_t l;
 1902|  7.86k|		char c[sizeof(int32_t)];
 1903|  7.86k|	} u;
 1904|  7.86k|	int clazz;
 1905|  7.86k|	int swap;
 1906|  7.86k|	struct stat st;
 1907|  7.86k|	const struct stat *stp;
 1908|  7.86k|	off_t fsize;
 1909|  7.86k|	int flags = 0;
 1910|  7.86k|	Elf32_Ehdr elf32hdr;
 1911|  7.86k|	Elf64_Ehdr elf64hdr;
 1912|  7.86k|	uint16_t type, phnum, shnum, notecount;
 1913|       |
 1914|  7.86k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  7.86k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  7.86k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (1914:6): [True: 0, False: 7.86k]
  ------------------
 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.86k|	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  157|  7.86k|#define	EI_MAG0		0		/* e_ident[] indexes */
  ------------------
              	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  166|  15.7k|#define	ELFMAG0		0x7f		/* EI_MAG */
  ------------------
  |  Branch (1924:6): [True: 3.16k, False: 4.69k]
  ------------------
 1925|  4.69k|	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  4.69k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  167|  9.39k|#define	ELFMAG1		'E'
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  3.78k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  172|  3.78k|#define	OLFMAG1		'O'
  ------------------
  |  Branch (1925:10): [True: 3.78k, False: 914]
  |  Branch (1925:37): [True: 17, False: 3.76k]
  ------------------
 1926|  4.67k|	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  159|  4.67k|#define	EI_MAG2		2
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  168|  12.5k|#define	ELFMAG2		'L'
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  160|  4.66k|#define	EI_MAG3		3
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  169|  4.66k|#define	ELFMAG3		'F'
  ------------------
  |  Branch (1926:9): [True: 14, False: 4.66k]
  |  Branch (1926:36): [True: 10, False: 4.65k]
  ------------------
 1927|  3.20k|		return 0;
 1928|       |
 1929|       |	/*
 1930|       |	 * If we cannot seek, it must be a pipe, socket or fifo.
 1931|       |	 */
 1932|  4.65k|	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  460|  4.65k|#define CAST(T, b)	((T)(b))
  ------------------
              	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  460|  4.65k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1932:5): [True: 0, False: 4.65k]
  ------------------
 1933|      0|	    && (errno == ESPIPE))
  ------------------
  |  Branch (1933:9): [True: 0, False: 0]
  ------------------
 1934|      0|		fd = file_pipe2file(ms, fd, buf, nbytes);
 1935|       |
 1936|  4.65k|	if (fd == -1) {
  ------------------
  |  Branch (1936:6): [True: 0, False: 4.65k]
  ------------------
 1937|      0|		file_badread(ms);
 1938|      0|		return -1;
 1939|      0|	}
 1940|       |
 1941|  4.65k|	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|  4.65k|	if (b->st.st_size == 0) {
  ------------------
  |  Branch (1946:6): [True: 0, False: 4.65k]
  ------------------
 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|  4.65k|	if (S_ISREG(stp->st_mode) || stp->st_size != 0)
  ------------------
  |  Branch (1953:6): [True: 4.65k, False: 0]
  |  Branch (1953:31): [True: 0, False: 0]
  ------------------
 1954|  4.65k|		fsize = stp->st_size;
 1955|      0|	else
 1956|      0|		fsize = SIZE_UNKNOWN;
  ------------------
  |  |   65|      0|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1957|       |
 1958|  4.65k|	clazz = buf[EI_CLASS];
  ------------------
  |  |  161|  4.65k|#define	EI_CLASS	4
  ------------------
 1959|       |
 1960|  4.65k|	switch (clazz) {
 1961|  3.00k|	case ELFCLASS32:
  ------------------
  |  |  153|  3.00k|#define	ELFCLASS32	1
  ------------------
  |  Branch (1961:2): [True: 3.00k, False: 1.65k]
  ------------------
 1962|  3.00k|#undef elf_getu
 1963|  3.00k|#define elf_getu(a, b)	elf_getu32(a, b)
 1964|  3.00k|#undef elfhdr
 1965|  3.00k|#define elfhdr elf32hdr
 1966|  3.00k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  3.00k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1965|  3.00k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 17, False: 2.98k]
  |  |  ------------------
  |  |   28|     17|		return 0;
  |  |   29|       |
  |  |   30|  2.98k|	u.l = 1;
  |  |   31|  2.98k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.98k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.98k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |   32|  2.98k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1965|  2.98k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  2.98k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  2.98k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  2.98k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  2.98k|	notecount = ms->elf_notes_max;
  |  |   36|  2.98k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|  1.87k|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|  1.87k|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 1.87k, False: 1.11k]
  |  |  ------------------
  |  |   39|  1.87k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|  1.87k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|  1.87k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 11, False: 1.86k]
  |  |  ------------------
  |  |   41|     11|			return toomany(ms, "program headers", phnum);
  |  |   42|  1.86k|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|  1.86k|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|  1.86k|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 1.86k]
  |  |  ------------------
  |  |   44|  1.86k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|  1.86k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|  1.86k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.86k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|  1.86k|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|  1.86k|		break;
  |  |   49|  1.86k|#endif
  |  |   50|  1.86k|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    984|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 984, False: 2.00k]
  |  |  ------------------
  |  |   51|  1.09k|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|  1.09k|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 111, False: 2.87k]
  |  |  ------------------
  |  |   52|  1.09k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|  1.09k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|  1.09k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 18, False: 1.07k]
  |  |  ------------------
  |  |   54|     18|			return toomany(ms, "program", phnum);
  |  |   55|  1.07k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|  1.07k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|  1.07k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 15, False: 1.06k]
  |  |  ------------------
  |  |   57|     15|			return toomany(ms, "section", shnum);
  |  |   58|  1.06k|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 1.06k]
  |  |  ------------------
  |  |   59|  1.06k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|  1.06k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|  1.06k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.06k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|  1.06k|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|  1.08k|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|  1.08k|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 19, False: 2.96k]
  |  |  ------------------
  |  |   65|  1.08k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|  1.08k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|  1.08k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 13, False: 1.06k]
  |  |  ------------------
  |  |   67|     13|			return toomany(ms, "section headers", shnum);
  |  |   68|  1.06k|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 64, False: 1.00k]
  |  |  ------------------
  |  |   69|  1.06k|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  460|  1.06k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|  1.06k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.06k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|  1.06k|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|  1.06k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|  1.06k|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  460|  1.06k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|  1.06k|		    &flags, &notecount) == -1)
  |  |   74|     64|			return -1;
  |  |   75|  1.00k|		break;
  |  |   76|       |
  |  |   77|  1.00k|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 1, False: 2.98k]
  |  |  ------------------
  |  |   78|      1|		break;
  |  |   79|  2.98k|	}
  |  |   80|  2.86k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 19, False: 2.84k]
  |  |  ------------------
  |  |   81|     19|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  2.84k|	return 1;
  ------------------
 1967|  1.64k|	case ELFCLASS64:
  ------------------
  |  |  154|  1.64k|#define	ELFCLASS64	2
  ------------------
  |  Branch (1967:2): [True: 1.64k, False: 3.01k]
  ------------------
 1968|  1.64k|#undef elf_getu
 1969|  1.64k|#define elf_getu(a, b)	elf_getu64(a, b)
 1970|  1.64k|#undef elfhdr
 1971|  1.64k|#define elfhdr elf64hdr
 1972|  1.64k|#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.64k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1971|  1.64k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 7, False: 1.63k]
  |  |  ------------------
  |  |   28|      7|		return 0;
  |  |   29|       |
  |  |   30|  1.63k|	u.l = 1;
  |  |   31|  1.63k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.63k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.63k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |   32|  1.63k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1971|  1.63k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  1.63k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  1.63k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  1.63k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  1.63k|	notecount = ms->elf_notes_max;
  |  |   36|  1.63k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|    607|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|    607|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 607, False: 1.03k]
  |  |  ------------------
  |  |   39|    607|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    607|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|    607|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 10, False: 597]
  |  |  ------------------
  |  |   41|     10|			return toomany(ms, "program headers", phnum);
  |  |   42|    597|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|    597|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|    597|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 597]
  |  |  ------------------
  |  |   44|    597|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|    597|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|    597|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|    597|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|    597|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|    597|		break;
  |  |   49|    597|#endif
  |  |   50|    597|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    538|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 538, False: 1.09k]
  |  |  ------------------
  |  |   51|    931|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    931|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 393, False: 1.24k]
  |  |  ------------------
  |  |   52|    931|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    931|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    931|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 2, False: 929]
  |  |  ------------------
  |  |   54|      2|			return toomany(ms, "program", phnum);
  |  |   55|    929|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    929|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    929|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 15, False: 914]
  |  |  ------------------
  |  |   57|     15|			return toomany(ms, "section", shnum);
  |  |   58|    914|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 913]
  |  |  ------------------
  |  |   59|    914|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|    914|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    914|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|    914|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    914|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|  1.01k|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|  1.01k|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 97, False: 1.54k]
  |  |  ------------------
  |  |   65|  1.01k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|  1.01k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|  1.01k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 6, False: 1.00k]
  |  |  ------------------
  |  |   67|      6|			return toomany(ms, "section headers", shnum);
  |  |   68|  1.00k|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 81, False: 923]
  |  |  ------------------
  |  |   69|  1.00k|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  460|  1.00k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|  1.00k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.00k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|  1.00k|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|  1.00k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|  1.00k|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  460|  1.00k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|  1.00k|		    &flags, &notecount) == -1)
  |  |   74|     81|			return -1;
  |  |   75|    923|		break;
  |  |   76|       |
  |  |   77|    923|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 2, False: 1.63k]
  |  |  ------------------
  |  |   78|      2|		break;
  |  |   79|  1.63k|	}
  |  |   80|  1.52k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 6, False: 1.51k]
  |  |  ------------------
  |  |   81|      6|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  1.51k|	return 1;
  ------------------
 1973|      6|	default:
  ------------------
  |  Branch (1973:2): [True: 6, False: 4.64k]
  ------------------
 1974|      6|	    if (elf_printf(ms, ", unknown class %d", clazz) == -1)
  ------------------
  |  Branch (1974:10): [True: 0, False: 6]
  ------------------
 1975|      0|		    return -1;
 1976|      6|	    break;
 1977|  4.65k|	}
 1978|      6|	return 0;
 1979|  4.65k|}
readelf.c:getu16:
   94|  23.8k|{
   95|  23.8k|	union {
   96|  23.8k|		uint16_t ui;
   97|  23.8k|		char c[2];
   98|  23.8k|	} retval, tmpval;
   99|       |
  100|  23.8k|	if (swap) {
  ------------------
  |  Branch (100:6): [True: 7.46k, False: 16.4k]
  ------------------
  101|  7.46k|		tmpval.ui = value;
  102|       |
  103|  7.46k|		retval.c[0] = tmpval.c[1];
  104|  7.46k|		retval.c[1] = tmpval.c[0];
  105|       |
  106|  7.46k|		return retval.ui;
  107|  7.46k|	} else
  108|  16.4k|		return value;
  109|  23.8k|}
readelf.c:toomany:
   86|    115|{
   87|    115|	if (elf_printf(ms, ", too many %s (%u)", name, num) == -1)
  ------------------
  |  Branch (87:6): [True: 0, False: 115]
  ------------------
   88|      0|		return -1;
   89|    115|	return 1;
   90|    115|}
readelf.c:dophn_core:
  367|  2.45k|{
  368|  2.45k|	Elf32_Phdr ph32;
  369|  2.45k|	Elf64_Phdr ph64;
  370|  2.45k|	size_t offset, len;
  371|  2.45k|	unsigned char nbuf[NBUFSIZE];
  372|  2.45k|	ssize_t bufsize;
  373|  2.45k|	off_t ph_off = off, offs;
  374|  2.45k|	int ph_num = num;
  375|       |
  376|  2.45k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  2.45k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.45k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.45k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (376:6): [True: 0, False: 2.45k]
  ------------------
  377|      0|		return 0;
  378|       |
  379|  2.45k|	if (num == 0) {
  ------------------
  |  Branch (379:6): [True: 2, False: 2.45k]
  ------------------
  380|      2|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (380:7): [True: 0, False: 2]
  ------------------
  381|      0|			return -1;
  382|      2|		return 0;
  383|      2|	}
  384|  2.45k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  2.45k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.45k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 1.86k, False: 597]
  |  |  ------------------
  |  |  184|  2.45k|			 ? sizeof(ph32)				\
  |  |  185|  2.45k|			 : sizeof(ph64))
  ------------------
  |  Branch (384:6): [True: 26, False: 2.43k]
  ------------------
  385|     26|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (385:7): [True: 0, False: 26]
  ------------------
  386|      0|			return -1;
  387|     26|		return 0;
  388|     26|	}
  389|       |
  390|       |	/*
  391|       |	 * Loop through all the program headers.
  392|       |	 */
  393|  21.0k|	for ( ; num; num--) {
  ------------------
  |  Branch (393:10): [True: 20.9k, False: 96]
  ------------------
  394|  20.9k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  20.9k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 13.7k, False: 7.17k]
  |  |  ------------------
  |  |  181|  20.9k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  460|  13.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  20.9k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  460|  7.17k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  20.9k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 13.7k, False: 7.17k]
  |  |  ------------------
  |  |  184|  20.9k|			 ? sizeof(ph32)				\
  |  |  185|  20.9k|			 : sizeof(ph64))
  ------------------
  |  Branch (394:7): [True: 2.31k, False: 18.6k]
  ------------------
  395|  20.9k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  460|  41.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 13.7k, False: 7.17k]
  |  |  ------------------
  ------------------
  396|  2.31k|			if (elf_printf(ms, 
  ------------------
  |  Branch (396:8): [True: 0, False: 2.31k]
  ------------------
  397|  2.31k|			    ", can't read elf program headers at %jd",
  398|  2.31k|			    (intmax_t)off) == -1)
  399|      0|				return -1;
  400|  2.31k|			return 0;
  401|  2.31k|		}
  402|  18.6k|		off += size;
  403|       |
  404|  18.6k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  18.6k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  37.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  18.6k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  37.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 11.9k, False: 6.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  18.6k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  18.6k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (404:7): [True: 18.6k, False: 0]
  |  Branch (404:32): [True: 6.79k, False: 11.8k]
  ------------------
  405|       |			/* Perhaps warn here */
  406|  6.79k|			continue;
  407|  6.79k|		}
  408|       |
  409|  11.8k|		if (xph_type != PT_NOTE)
  ------------------
  |  |  186|  11.8k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  11.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 7.73k, False: 4.08k]
  |  |  ------------------
  |  |  187|  11.8k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  7.73k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  11.8k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  4.08k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
              		if (xph_type != PT_NOTE)
  ------------------
  |  |  201|  11.8k|#define	PT_NOTE		4
  ------------------
  |  Branch (409:7): [True: 4.63k, False: 7.18k]
  ------------------
  410|  4.63k|			continue;
  411|       |
  412|       |		/*
  413|       |		 * This is a PT_NOTE section; loop through all the notes
  414|       |		 * in the section.
  415|       |		 */
  416|  7.18k|		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  7.18k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.63k, False: 1.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.18k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.18k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  1.26k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  2.52k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 742, False: 520]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.18k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.18k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (416:9): [True: 1.26k, False: 5.91k]
  ------------------
  417|  7.18k|		offs = xph_offset;
  ------------------
  |  |  189|  7.18k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.63k, False: 1.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  7.18k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  7.18k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  418|  7.18k|		if ((bufsize = pread(fd, nbuf, len, offs)) == -1) {
  ------------------
  |  Branch (418:7): [True: 24, False: 7.15k]
  ------------------
  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|  7.15k|		offset = 0;
  425|  31.6k|		for (;;) {
  426|  31.6k|			if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  460|  31.6k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (426:8): [True: 5.32k, False: 26.3k]
  ------------------
  427|  5.32k|				break;
  428|  26.3k|			offset = donote(ms, nbuf, offset, CAST(size_t, bufsize),
  ------------------
  |  |  460|  26.3k|#define CAST(T, b)	((T)(b))
  ------------------
  429|  26.3k|			    clazz, swap, 4, flags, notecount, fd, ph_off,
  430|  26.3k|			    ph_num, fsize);
  431|  26.3k|			if (offset == 0)
  ------------------
  |  Branch (431:8): [True: 1.82k, False: 24.4k]
  ------------------
  432|  1.82k|				break;
  433|       |
  434|  26.3k|		}
  435|  7.15k|	}
  436|     96|	return 0;
  437|  2.43k|}
readelf.c:donote:
 1234|  34.5k|{
 1235|  34.5k|	Elf32_Nhdr nh32;
 1236|  34.5k|	Elf64_Nhdr nh64;
 1237|  34.5k|	size_t noff, doff;
 1238|  34.5k|	uint32_t namesz, descsz;
 1239|  34.5k|	char buf[256];
 1240|  34.5k|	unsigned char *nbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  460|  34.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1241|       |
 1242|  34.5k|	if (*notecount == 0)
  ------------------
  |  Branch (1242:6): [True: 545, False: 34.0k]
  ------------------
 1243|    545|		return 0;
 1244|  34.0k|	--*notecount;
 1245|       |
 1246|  34.0k|	if (xnh_sizeof + offset > size) {
  ------------------
  |  |  211|  34.0k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  34.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 27.9k, False: 6.09k]
  |  |  ------------------
  |  |  212|  34.0k|			 ? sizeof(nh32)				\
  |  |  213|  34.0k|			 : sizeof(nh64))
  ------------------
  |  Branch (1246:6): [True: 2.56k, False: 31.4k]
  ------------------
 1247|       |		/*
 1248|       |		 * We're out of note headers.
 1249|       |		 */
 1250|  2.56k|		return xnh_sizeof + offset;
  ------------------
  |  |  211|  2.56k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.56k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 2.15k, False: 414]
  |  |  ------------------
  |  |  212|  2.56k|			 ? sizeof(nh32)				\
  |  |  213|  2.56k|			 : sizeof(nh64))
  ------------------
 1251|  2.56k|	}
 1252|       |	/*XXX: GCC */
 1253|  31.4k|	memset(&nh32, 0, sizeof(nh32));
 1254|  31.4k|	memset(&nh64, 0, sizeof(nh64));
 1255|       |
 1256|  31.4k|	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  208|  31.4k|#define xnh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (208:19): [True: 25.7k, False: 5.68k]
  |  |  ------------------
  |  |  209|  31.4k|			 ? CAST(void *, &nh32)			\
  |  |  ------------------
  |  |  |  |  460|  25.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  210|  31.4k|			 : CAST(void *, &nh64))
  |  |  ------------------
  |  |  |  |  460|  5.68k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  211|  31.4k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 25.7k, False: 5.68k]
  |  |  ------------------
  |  |  212|  31.4k|			 ? sizeof(nh32)				\
  |  |  213|  31.4k|			 : sizeof(nh64))
  ------------------
 1257|  31.4k|	offset += xnh_sizeof;
  ------------------
  |  |  211|  31.4k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 25.7k, False: 5.68k]
  |  |  ------------------
  |  |  212|  31.4k|			 ? sizeof(nh32)				\
  |  |  213|  31.4k|			 : sizeof(nh64))
  ------------------
 1258|       |
 1259|  31.4k|	namesz = xnh_namesz;
  ------------------
  |  |  217|  31.4k|#define xnh_namesz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (217:21): [True: 25.7k, False: 5.68k]
  |  |  ------------------
  |  |  218|  31.4k|			 ? elf_getu32(swap, nh32.n_namesz)	\
  |  |  ------------------
  |  |  |  |  158|  25.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  219|  31.4k|			 : elf_getu32(swap, nh64.n_namesz))
  |  |  ------------------
  |  |  |  |  158|  5.68k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1260|  31.4k|	descsz = xnh_descsz;
  ------------------
  |  |  220|  31.4k|#define xnh_descsz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (220:21): [True: 25.7k, False: 5.68k]
  |  |  ------------------
  |  |  221|  31.4k|			 ? elf_getu32(swap, nh32.n_descsz)	\
  |  |  ------------------
  |  |  |  |  158|  25.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  222|  31.4k|			 : elf_getu32(swap, nh64.n_descsz))
  |  |  ------------------
  |  |  |  |  158|  5.68k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1261|       |
 1262|  31.4k|	if ((namesz == 0) && (descsz == 0)) {
  ------------------
  |  Branch (1262:6): [True: 3.87k, False: 27.5k]
  |  Branch (1262:23): [True: 281, False: 3.59k]
  ------------------
 1263|       |		/*
 1264|       |		 * We're out of note headers.
 1265|       |		 */
 1266|    281|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1266:10): [True: 34, False: 247]
  ------------------
 1267|    281|	}
 1268|       |
 1269|  31.1k|	if (namesz & 0x80000000) {
  ------------------
  |  Branch (1269:6): [True: 650, False: 30.5k]
  ------------------
 1270|    650|	    (void)elf_printf(ms, ", bad note name size %#lx",
 1271|    650|		CAST(unsigned long, namesz));
  ------------------
  |  |  460|    650|#define CAST(T, b)	((T)(b))
  ------------------
 1272|    650|	    return 0;
 1273|    650|	}
 1274|       |
 1275|  30.5k|	if (descsz & 0x80000000) {
  ------------------
  |  Branch (1275:6): [True: 1.62k, False: 28.8k]
  ------------------
 1276|  1.62k|		(void)elf_printf(ms, ", bad note description size %#lx",
 1277|  1.62k|		    CAST(unsigned long, descsz));
  ------------------
  |  |  460|  1.62k|#define CAST(T, b)	((T)(b))
  ------------------
 1278|  1.62k|		return 0;
 1279|  1.62k|	}
 1280|       |
 1281|  28.8k|	noff = offset;
 1282|  28.8k|	doff = ELF_ALIGN(offset + namesz);
  ------------------
  |  |   56|  28.8k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1283|       |
 1284|  28.8k|	if (offset + namesz > size) {
  ------------------
  |  Branch (1284:6): [True: 2.36k, False: 26.5k]
  ------------------
 1285|       |		/*
 1286|       |		 * We're past the end of the buffer.
 1287|       |		 */
 1288|  2.36k|		return doff;
 1289|  2.36k|	}
 1290|       |
 1291|  26.5k|	offset = ELF_ALIGN(doff + descsz);
  ------------------
  |  |   56|  26.5k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1292|  26.5k|	if (doff + descsz > size) {
  ------------------
  |  Branch (1292:6): [True: 1.48k, False: 25.0k]
  ------------------
 1293|       |		/*
 1294|       |		 * We're past the end of the buffer.
 1295|       |		 */
 1296|  1.48k|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1296:10): [True: 1.10k, False: 381]
  ------------------
 1297|  1.48k|	}
 1298|       |
 1299|       |
 1300|  25.0k|	if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
  ------------------
  |  |  352|  25.0k|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  |  Branch (1300:6): [True: 24.4k, False: 568]
  ------------------
 1301|  24.4k|		if (do_os_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  24.4k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  24.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 20.9k, False: 3.56k]
  |  |  ------------------
  |  |  215|  24.4k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  20.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  24.4k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.56k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1301:7): [True: 135, False: 24.3k]
  ------------------
 1302|  24.4k|		    namesz, descsz, noff, doff, flags))
 1303|    135|			return offset;
 1304|  24.4k|	}
 1305|       |
 1306|  24.9k|	if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
  ------------------
  |  |  353|  24.9k|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  |  Branch (1306:6): [True: 24.4k, False: 468]
  ------------------
 1307|  24.4k|		if (do_bid_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  24.4k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  24.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 20.8k, False: 3.56k]
  |  |  ------------------
  |  |  215|  24.4k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  20.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  24.4k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.56k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1307:7): [True: 1.12k, False: 23.3k]
  ------------------
 1308|  24.4k|		    namesz, descsz, noff, doff, flags))
 1309|  1.12k|			return offset;
 1310|  24.4k|	}
 1311|       |
 1312|  23.7k|	if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
  ------------------
  |  |  355|  23.7k|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  |  Branch (1312:6): [True: 23.1k, False: 662]
  ------------------
 1313|  23.1k|		if (do_pax_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  23.1k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.5k, False: 3.56k]
  |  |  ------------------
  |  |  215|  23.1k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.1k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.56k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1313:7): [True: 59, False: 23.0k]
  ------------------
 1314|  23.1k|		    namesz, descsz, noff, doff, flags))
 1315|     59|			return offset;
 1316|  23.1k|	}
 1317|  23.7k|	if ((*flags & FLAGS_DID_ANDROID_MEMTAG) == 0) {
  ------------------
  |  |  360|  23.7k|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  |  Branch (1317:6): [True: 23.5k, False: 218]
  ------------------
 1318|  23.5k|		if (do_memtag_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  23.5k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.9k, False: 3.56k]
  |  |  ------------------
  |  |  215|  23.5k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.5k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.56k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1318:7): [True: 59, False: 23.4k]
  ------------------
 1319|  23.5k|		    namesz, descsz, noff, doff, flags))
 1320|     59|			return offset;
 1321|  23.5k|	}
 1322|       |
 1323|  23.6k|	if ((*flags & FLAGS_DID_CORE) == 0) {
  ------------------
  |  |  351|  23.6k|#define FLAGS_DID_CORE			0x0004
  ------------------
  |  Branch (1323:6): [True: 22.6k, False: 1.01k]
  ------------------
 1324|  22.6k|		if (do_core_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  22.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.1k, False: 3.56k]
  |  |  ------------------
  |  |  215|  22.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  22.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.56k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1324:7): [True: 83, False: 22.5k]
  ------------------
 1325|  22.6k|		    namesz, descsz, noff, doff, flags, size, clazz))
 1326|     83|			return offset;
 1327|  22.6k|	}
 1328|       |
 1329|  23.5k|	if ((*flags & FLAGS_DID_AUXV) == 0) {
  ------------------
  |  |  362|  23.5k|#define FLAGS_DID_AUXV			0x2000
  ------------------
  |  Branch (1329:6): [True: 23.0k, False: 535]
  ------------------
 1330|  23.0k|		if (do_auxv_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  23.0k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.5k, False: 3.55k]
  |  |  ------------------
  |  |  215|  23.0k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.0k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.55k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1330:7): [True: 750, False: 22.3k]
  ------------------
 1331|  23.0k|			namesz, descsz, noff, doff, flags, size, clazz,
 1332|  23.0k|			fd, ph_off, ph_num, fsize))
 1333|    750|			return offset;
 1334|  23.0k|	}
 1335|       |
 1336|  22.8k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "NetBSD")) {
  ------------------
  |  |   67|  22.8k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.82k, False: 20.0k]
  |  |  |  Branch (67:29): [True: 1.58k, False: 1.23k]
  |  |  ------------------
  ------------------
 1337|  1.58k|		int descw, flag;
 1338|  1.58k|		const char *str, *tag;
 1339|  1.58k|		if (descsz > 100)
  ------------------
  |  Branch (1339:7): [True: 359, False: 1.22k]
  ------------------
 1340|    359|			descsz = 100;
 1341|  1.58k|		switch (xnh_type) {
  ------------------
  |  |  214|  1.58k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.58k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 1.35k, False: 232]
  |  |  ------------------
  |  |  215|  1.58k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  1.35k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  1.58k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|    232|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1342|    515|	    	case NT_NETBSD_VERSION:
  ------------------
  |  |  285|    515|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (1342:7): [True: 515, False: 1.07k]
  ------------------
 1343|    515|			return offset;
 1344|    208|		case NT_NETBSD_MARCH:
  ------------------
  |  |  346|    208|#define NT_NETBSD_MARCH		5
  ------------------
  |  Branch (1344:3): [True: 208, False: 1.37k]
  ------------------
 1345|    208|			flag = FLAGS_DID_NETBSD_MARCH;
  ------------------
  |  |  356|    208|#define FLAGS_DID_NETBSD_MARCH		0x0080
  ------------------
 1346|    208|			tag = "compiled for";
 1347|    208|			break;
 1348|    204|		case NT_NETBSD_CMODEL:
  ------------------
  |  |  356|    204|#define NT_NETBSD_CMODEL	6
  ------------------
  |  Branch (1348:3): [True: 204, False: 1.38k]
  ------------------
 1349|    204|			flag = FLAGS_DID_NETBSD_CMODEL;
  ------------------
  |  |  357|    204|#define FLAGS_DID_NETBSD_CMODEL		0x0100
  ------------------
 1350|    204|			tag = "compiler model";
 1351|    204|			break;
 1352|    202|		case NT_NETBSD_EMULATION:
  ------------------
  |  |  286|    202|#define	NT_NETBSD_EMULATION	2
  ------------------
  |  Branch (1352:3): [True: 202, False: 1.38k]
  ------------------
 1353|    202|			flag = FLAGS_DID_NETBSD_EMULATION;
  ------------------
  |  |  358|    202|#define FLAGS_DID_NETBSD_EMULATION	0x0200
  ------------------
 1354|    202|			tag = "emulation:";
 1355|    202|			break;
 1356|    458|		default:
  ------------------
  |  Branch (1356:3): [True: 458, False: 1.12k]
  ------------------
 1357|    458|			if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  ------------------
  |  |  359|    458|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
  |  Branch (1357:8): [True: 381, False: 77]
  ------------------
 1358|    381|				return offset;
 1359|     77|			*flags |= FLAGS_DID_NETBSD_UNKNOWN;
  ------------------
  |  |  359|     77|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
 1360|     77|			if (elf_printf(ms, ", note=%u", xnh_type) == -1)
  ------------------
  |  |  214|     77|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|     77|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 55, False: 22]
  |  |  ------------------
  |  |  215|     77|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|     55|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|     77|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|     22|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1360:8): [True: 0, False: 77]
  ------------------
 1361|      0|				return offset;
 1362|     77|			return offset;
 1363|  1.58k|		}
 1364|       |
 1365|    614|		if (*flags & flag)
  ------------------
  |  Branch (1365:7): [True: 583, False: 31]
  ------------------
 1366|    583|			return offset;
 1367|     31|		str = RCAST(const char *, &nbuf[doff]);
  ------------------
  |  |  461|     31|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1368|     31|		descw = CAST(int, descsz);
  ------------------
  |  |  460|     31|#define CAST(T, b)	((T)(b))
  ------------------
 1369|     31|		*flags |= flag;
 1370|     31|		elf_printf(ms, ", %s: %s", tag,
 1371|     31|		    file_copystr(buf, sizeof(buf), descw, str));
 1372|     31|		return offset;
 1373|    614|	}
 1374|       |
 1375|  21.2k|	return offset;
 1376|  22.8k|}
readelf.c:do_os_note:
  615|  24.4k|{
  616|  24.4k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  24.4k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  617|       |
  618|  24.4k|	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |   67|  48.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.09k, False: 23.3k]
  |  |  |  Branch (67:29): [True: 517, False: 582]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |  297|  24.9k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (618:34): [True: 270, False: 247]
  |  Branch (618:60): [True: 1, False: 269]
  ------------------
  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|  24.4k|	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |   67|  48.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 14.6k, False: 9.79k]
  |  |  |  Branch (67:29): [True: 1.09k, False: 13.5k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |  297|  25.5k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (626:33): [True: 231, False: 861]
  |  Branch (626:59): [True: 15, False: 216]
  ------------------
  627|     15|		uint32_t desc[4];
  628|     15|		memcpy(desc, &nbuf[doff], sizeof(desc));
  629|       |
  630|     15|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     15|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  631|     15|		if (elf_printf(ms, ", for GNU/") == -1)
  ------------------
  |  Branch (631:7): [True: 0, False: 15]
  ------------------
  632|      0|			return -1;
  633|     15|		switch (elf_getu32(swap, desc[0])) {
  ------------------
  |  |  158|     15|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  634|      1|		case GNU_OS_LINUX:
  ------------------
  |  |  300|      1|#define	GNU_OS_LINUX	0
  ------------------
  |  Branch (634:3): [True: 1, False: 14]
  ------------------
  635|      1|			if (elf_printf(ms, "Linux") == -1)
  ------------------
  |  Branch (635:8): [True: 0, False: 1]
  ------------------
  636|      0|				return -1;
  637|      1|			break;
  638|      1|		case GNU_OS_HURD:
  ------------------
  |  |  301|      1|#define	GNU_OS_HURD	1
  ------------------
  |  Branch (638:3): [True: 1, False: 14]
  ------------------
  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: 14]
  ------------------
  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: 14]
  ------------------
  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: 14]
  ------------------
  651|      1|			if (elf_printf(ms, "kNetBSD") == -1)
  ------------------
  |  Branch (651:8): [True: 0, False: 1]
  ------------------
  652|      0|				return -1;
  653|      1|			break;
  654|     10|		default:
  ------------------
  |  Branch (654:3): [True: 10, False: 5]
  ------------------
  655|     10|			if (elf_printf(ms, "<unknown>") == -1)
  ------------------
  |  Branch (655:8): [True: 0, False: 10]
  ------------------
  656|      0|				return -1;
  657|     15|		}
  658|     15|		if (elf_printf(ms, " %d.%d.%d", elf_getu32(swap, desc[1]),
  ------------------
  |  |  158|     15|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  |  Branch (658:7): [True: 0, False: 15]
  ------------------
  659|     15|		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  158|     15|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
              		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  158|     15|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  660|      0|			return -1;
  661|     15|		return 1;
  662|     15|	}
  663|       |
  664|  24.4k|	if (NAMEEQUALS(name, "NetBSD") &&
  ------------------
  |  |   67|  48.9k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.84k, False: 21.6k]
  |  |  |  Branch (67:29): [True: 1.60k, False: 1.23k]
  |  |  ------------------
  ------------------
  665|  1.60k|	    type == NT_NETBSD_VERSION && descsz == 4) {
  ------------------
  |  |  285|  26.0k|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (665:6): [True: 536, False: 1.07k]
  |  Branch (665:35): [True: 59, False: 477]
  ------------------
  666|     59|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     59|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  667|     59|		if (do_note_netbsd_version(ms, swap, &nbuf[doff]) == -1)
  ------------------
  |  Branch (667:7): [True: 0, False: 59]
  ------------------
  668|      0|			return -1;
  669|     59|		return 1;
  670|     59|	}
  671|       |
  672|  24.4k|	if (NAMEEQUALS(name, "FreeBSD") &&
  ------------------
  |  |   67|  48.8k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.48k, False: 22.9k]
  |  |  |  Branch (67:29): [True: 517, False: 966]
  |  |  ------------------
  ------------------
  673|    517|	    type == NT_FREEBSD_VERSION && descsz == 4) {
  ------------------
  |  |  287|  24.9k|#define	NT_FREEBSD_VERSION	1
  ------------------
  |  Branch (673:6): [True: 290, False: 227]
  |  Branch (673:36): [True: 57, False: 233]
  ------------------
  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|  24.3k|	if (NAMEEQUALS(name, "OpenBSD") &&
  ------------------
  |  |   67|  48.7k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.42k, False: 22.9k]
  |  |  |  Branch (67:29): [True: 192, False: 1.23k]
  |  |  ------------------
  ------------------
  682|    192|	    type == NT_OPENBSD_VERSION && descsz == 4) {
  ------------------
  |  |  288|  24.5k|#define	NT_OPENBSD_VERSION	1
  ------------------
  |  Branch (682:6): [True: 72, False: 120]
  |  Branch (682:36): [True: 1, False: 71]
  ------------------
  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|  24.3k|	if (NAMEEQUALS(name, "DragonFly") &&
  ------------------
  |  |   67|  48.6k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 560, False: 23.7k]
  |  |  |  Branch (67:29): [True: 316, False: 244]
  |  |  ------------------
  ------------------
  691|    316|	    type == NT_DRAGONFLY_VERSION && descsz == 4) {
  ------------------
  |  |  289|  24.6k|#define	NT_DRAGONFLY_VERSION	1
  ------------------
  |  Branch (691:6): [True: 74, False: 242]
  |  Branch (691:38): [True: 2, False: 72]
  ------------------
  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|  24.3k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  48.6k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.42k, False: 22.9k]
  |  |  |  Branch (67:29): [True: 488, False: 937]
  |  |  ------------------
  ------------------
  705|    488|	    type == NT_ANDROID_VERSION && descsz >= 4) {
  ------------------
  |  |  377|  24.8k|#define NT_ANDROID_VERSION	1
  ------------------
  |  Branch (705:6): [True: 82, False: 406]
  |  Branch (705:36): [True: 7, False: 75]
  ------------------
  706|      7|		uint32_t api_level;
  707|      7|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|      7|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  708|      7|		memcpy(&api_level, &nbuf[doff], sizeof(api_level));
  709|      7|		api_level = elf_getu32(swap, api_level);
  ------------------
  |  |  158|      7|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  710|      7|		if (elf_printf(ms, ", for Android %d", api_level) == -1)
  ------------------
  |  Branch (710:7): [True: 0, False: 7]
  ------------------
  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|      7|		if (descsz >= 4 + 64 + 64) {
  ------------------
  |  Branch (718:7): [True: 2, False: 5]
  ------------------
  719|      2|			if (elf_printf(ms, ", built by NDK %.64s (%.64s)",
  ------------------
  |  Branch (719:8): [True: 0, False: 2]
  ------------------
  720|      2|			    &nbuf[doff + 4], &nbuf[doff + 4 + 64]) == -1)
  721|      0|				return -1;
  722|      2|		}
  723|      7|	}
  724|       |
  725|  24.3k|	return 0;
  726|  24.3k|}
readelf.c:do_note_netbsd_version:
  442|     59|{
  443|     59|	uint32_t desc;
  444|     59|	memcpy(&desc, v, sizeof(desc));
  445|     59|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     59|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  446|       |
  447|     59|	if (elf_printf(ms, ", for NetBSD") == -1)
  ------------------
  |  Branch (447:6): [True: 0, False: 59]
  ------------------
  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|     59|	if (desc > 100000000U) {
  ------------------
  |  Branch (461:6): [True: 56, False: 3]
  ------------------
  462|     56|		uint32_t ver_patch = (desc / 100) % 100;
  463|     56|		uint32_t ver_rel = (desc / 10000) % 100;
  464|     56|		uint32_t ver_min = (desc / 1000000) % 100;
  465|     56|		uint32_t ver_maj = desc / 100000000;
  466|       |
  467|     56|		if (elf_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
  ------------------
  |  Branch (467:7): [True: 0, False: 56]
  ------------------
  468|      0|			return -1;
  469|     56|		if (ver_maj >= 9) {
  ------------------
  |  Branch (469:7): [True: 27, False: 29]
  ------------------
  470|     27|			ver_patch += 100 * ver_rel;
  471|     27|			ver_rel = 0;
  472|     27|		}
  473|     56|		if (ver_rel == 0 && ver_patch != 0) {
  ------------------
  |  Branch (473:7): [True: 27, False: 29]
  |  Branch (473:23): [True: 25, False: 2]
  ------------------
  474|     25|			if (elf_printf(ms, ".%u", ver_patch) == -1)
  ------------------
  |  Branch (474:8): [True: 0, False: 25]
  ------------------
  475|      0|				return -1;
  476|     31|		} else if (ver_rel != 0) {
  ------------------
  |  Branch (476:14): [True: 29, False: 2]
  ------------------
  477|     78|			while (ver_rel > 26) {
  ------------------
  |  Branch (477:11): [True: 49, False: 29]
  ------------------
  478|     49|				if (elf_printf(ms, "Z") == -1)
  ------------------
  |  Branch (478:9): [True: 0, False: 49]
  ------------------
  479|      0|					return -1;
  480|     49|				ver_rel -= 26;
  481|     49|			}
  482|     29|			if (elf_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
  ------------------
  |  Branch (482:8): [True: 0, False: 29]
  ------------------
  483|      0|				return -1;
  484|     29|		}
  485|     56|	}
  486|     59|	return 0;
  487|     59|}
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: 17, False: 39]
  ------------------
  529|     17|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (529:7): [True: 0, False: 17]
  ------------------
  530|     17|		    desc / 10000 % 10) == -1)
  531|      0|			return -1;
  532|     17|		if (desc / 1000 % 10 > 0)
  ------------------
  |  Branch (532:7): [True: 14, False: 3]
  ------------------
  533|     14|			if (elf_printf(ms, ".%d", desc / 1000 % 10) == -1)
  ------------------
  |  Branch (533:8): [True: 0, False: 14]
  ------------------
  534|      0|				return -1;
  535|     17|		if ((desc % 1000 > 0) || (desc % 100000 == 0))
  ------------------
  |  Branch (535:7): [True: 14, False: 3]
  |  Branch (535:28): [True: 1, False: 2]
  ------------------
  536|     15|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (536:8): [True: 0, False: 15]
  ------------------
  537|      0|				return -1;
  538|     39|	} else if (desc < 500000) {
  ------------------
  |  Branch (538:13): [True: 7, False: 32]
  ------------------
  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: 5, False: 2]
  ------------------
  543|      5|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (543:8): [True: 0, False: 5]
  ------------------
  544|      0|				return -1;
  545|      5|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (545:14): [True: 1, False: 1]
  ------------------
  546|      1|			if (elf_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (546:8): [True: 0, False: 1]
  ------------------
  547|      0|				return -1;
  548|      1|		}
  549|     32|	} else {
  550|     32|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (550:7): [True: 0, False: 32]
  ------------------
  551|     32|		    desc / 1000 % 100) == -1)
  552|      0|			return -1;
  553|     32|		if ((desc / 100 % 10 > 0) ||
  ------------------
  |  Branch (553:7): [True: 17, False: 15]
  ------------------
  554|     18|		    (desc % 100000 / 100 == 0)) {
  ------------------
  |  Branch (554:7): [True: 1, False: 14]
  ------------------
  555|     18|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (555:8): [True: 0, False: 18]
  ------------------
  556|      0|				return -1;
  557|     18|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (557:14): [True: 13, False: 1]
  ------------------
  558|     13|			if (elf_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (558:8): [True: 0, False: 13]
  ------------------
  559|      0|				return -1;
  560|     13|		}
  561|     32|	}
  562|     57|	return 0;
  563|     57|}
readelf.c:do_bid_note:
  570|  24.4k|{
  571|  24.4k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "GNU") &&
  ------------------
  |  |   67|  48.8k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 14.5k, False: 9.87k]
  |  |  |  Branch (67:29): [True: 1.24k, False: 13.3k]
  |  |  ------------------
  ------------------
  572|  1.24k|	    type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
  ------------------
  |  |  319|  25.6k|#define	NT_GNU_BUILD_ID		3
  ------------------
  |  Branch (572:6): [True: 488, False: 758]
  |  Branch (572:34): [True: 422, False: 66]
  |  Branch (572:49): [True: 14, False: 408]
  ------------------
  573|     14|		uint8_t desc[20];
  574|     14|		const char *btype;
  575|     14|		uint32_t i;
  576|     14|		*flags |= FLAGS_DID_BUILD_ID;
  ------------------
  |  |  353|     14|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  577|     14|		switch (descsz) {
  578|      1|		case 8:
  ------------------
  |  Branch (578:3): [True: 1, False: 13]
  ------------------
  579|      1|		    btype = "xxHash";
  580|      1|		    break;
  581|      8|		case 16:
  ------------------
  |  Branch (581:3): [True: 8, False: 6]
  ------------------
  582|      8|		    btype = "md5/uuid";
  583|      8|		    break;
  584|      1|		case 20:
  ------------------
  |  Branch (584:3): [True: 1, False: 13]
  ------------------
  585|      1|		    btype = "sha1";
  586|      1|		    break;
  587|      4|		default:
  ------------------
  |  Branch (587:3): [True: 4, False: 10]
  ------------------
  588|      4|		    btype = "unknown";
  589|      4|		    break;
  590|     14|		}
  591|     14|		if (elf_printf(ms, ", BuildID[%s]=", btype) == -1)
  ------------------
  |  Branch (591:7): [True: 0, False: 14]
  ------------------
  592|      0|			return -1;
  593|     14|		memcpy(desc, &nbuf[doff], descsz);
  594|    206|		for (i = 0; i < descsz; i++)
  ------------------
  |  Branch (594:15): [True: 192, False: 14]
  ------------------
  595|    192|		    if (elf_printf(ms, "%02x", desc[i]) == -1)
  ------------------
  |  Branch (595:11): [True: 0, False: 192]
  ------------------
  596|      0|			return -1;
  597|     14|		return 1;
  598|     14|	}
  599|  24.4k|	if (namesz == 4 && memcmp(RCAST(char *, &nbuf[noff]), "Go", 3) == 0 &&
  ------------------
  |  |  461|  14.5k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (599:6): [True: 14.5k, False: 9.87k]
  |  Branch (599:21): [True: 1.88k, False: 12.6k]
  ------------------
  600|  1.88k|	    type == NT_GO_BUILD_ID && descsz < 128) {
  ------------------
  |  |  365|  26.3k|#define NT_GO_BUILD_ID	4
  ------------------
  |  Branch (600:6): [True: 1.35k, False: 533]
  |  Branch (600:32): [True: 1.10k, False: 246]
  ------------------
  601|  1.10k|		char buf[256];
  602|  1.10k|		if (elf_printf(ms, ", Go BuildID=%s",
  ------------------
  |  Branch (602:7): [True: 0, False: 1.10k]
  ------------------
  603|  1.10k|		    file_copystr(buf, sizeof(buf), descsz,
  604|  1.10k|		    RCAST(const char *, &nbuf[doff]))) == -1)
  ------------------
  |  |  461|  1.10k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  605|      0|			return -1;
  606|  1.10k|		return 1;
  607|  1.10k|	}
  608|  23.3k|	return 0;
  609|  24.4k|}
readelf.c:do_pax_note:
  732|  23.1k|{
  733|  23.1k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  23.1k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  734|       |
  735|  23.1k|	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |   67|  46.2k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 13.2k, False: 9.84k]
  |  |  |  Branch (67:29): [True: 1.51k, False: 11.7k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |  330|  24.6k|#define NT_NETBSD_PAX		3
  ------------------
  |  Branch (735:33): [True: 477, False: 1.03k]
  |  Branch (735:58): [True: 59, False: 418]
  ------------------
  736|     59|		static const char *pax[] = {
  737|     59|		    "+mprotect",
  738|     59|		    "-mprotect",
  739|     59|		    "+segvguard",
  740|     59|		    "-segvguard",
  741|     59|		    "+ASLR",
  742|     59|		    "-ASLR",
  743|     59|		};
  744|     59|		uint32_t desc;
  745|     59|		size_t i;
  746|     59|		int did = 0;
  747|       |
  748|     59|		*flags |= FLAGS_DID_NETBSD_PAX;
  ------------------
  |  |  355|     59|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  749|     59|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  750|     59|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     59|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  751|       |
  752|     59|		if (desc && elf_printf(ms, ", PaX: ") == -1)
  ------------------
  |  Branch (752:7): [True: 58, False: 1]
  |  Branch (752:15): [True: 0, False: 58]
  ------------------
  753|      0|			return -1;
  754|       |
  755|    413|		for (i = 0; i < __arraycount(pax); i++) {
  ------------------
  |  |  138|    413|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (755:15): [True: 354, False: 59]
  ------------------
  756|    354|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  460|    354|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (756:8): [True: 231, False: 123]
  ------------------
  757|    231|				continue;
  758|    123|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (758:8): [True: 0, False: 123]
  |  Branch (758:31): [True: 80, False: 43]
  ------------------
  759|    123|			    pax[i]) == -1)
  760|      0|				return -1;
  761|    123|		}
  762|     59|		return 1;
  763|     59|	}
  764|  23.0k|	return 0;
  765|  23.1k|}
readelf.c:do_memtag_note:
  771|  23.5k|{
  772|  23.5k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  23.5k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  773|       |
  774|  23.5k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  47.0k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.40k, False: 22.1k]
  |  |  |  Branch (67:29): [True: 457, False: 947]
  |  |  ------------------
  ------------------
  775|    457|	    type == NT_ANDROID_MEMTAG && descsz == 4) {
  ------------------
  |  |  389|  23.9k|#define NT_ANDROID_MEMTAG	4
  ------------------
  |  Branch (775:6): [True: 127, False: 330]
  |  Branch (775:35): [True: 59, False: 68]
  ------------------
  776|     59|		static const char *memtag[] = {
  777|     59|		    "none",
  778|     59|		    "async",
  779|     59|		    "sync",
  780|     59|		    "heap",
  781|     59|		    "stack",
  782|     59|		};
  783|     59|		uint32_t desc;
  784|     59|		size_t i;
  785|     59|		int did = 0;
  786|       |
  787|     59|		*flags |= FLAGS_DID_ANDROID_MEMTAG;
  ------------------
  |  |  360|     59|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  788|     59|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  789|     59|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     59|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  790|       |
  791|     59|		if (desc && elf_printf(ms, ", Android Memtag: ") == -1)
  ------------------
  |  Branch (791:7): [True: 58, False: 1]
  |  Branch (791:15): [True: 0, False: 58]
  ------------------
  792|      0|			return -1;
  793|       |
  794|    354|		for (i = 0; i < __arraycount(memtag); i++) {
  ------------------
  |  |  138|    354|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (794:15): [True: 295, False: 59]
  ------------------
  795|    295|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  460|    295|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (795:8): [True: 170, False: 125]
  ------------------
  796|    170|				continue;
  797|    125|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (797:8): [True: 0, False: 125]
  |  Branch (797:31): [True: 72, False: 53]
  ------------------
  798|    125|			    memtag[i]) == -1)
  799|      0|				return -1;
  800|    125|		}
  801|     59|		return 1;
  802|     59|	}
  803|  23.4k|	return 0;
  804|  23.5k|}
readelf.c:do_core_note:
  810|  22.6k|{
  811|  22.6k|#ifdef ELFCORE
  812|  22.6k|	char buf[256];
  813|  22.6k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  22.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  814|       |
  815|  22.6k|	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|  22.6k|	if ((namesz == 4 && memcmp(name, "CORE", 4) == 0) ||
  ------------------
  |  Branch (830:7): [True: 12.8k, False: 9.79k]
  |  Branch (830:22): [True: 1.65k, False: 11.2k]
  ------------------
  831|  21.0k|	    NAMEEQUALS(name, "CORE")) {
  ------------------
  |  |   67|  21.0k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.09k, False: 19.9k]
  |  |  |  Branch (67:29): [True: 215, False: 883]
  |  |  ------------------
  ------------------
  832|  1.86k|		os_style = OS_STYLE_SVR4;
  ------------------
  |  |  339|  1.86k|#define	OS_STYLE_SVR4		0
  ------------------
  833|  1.86k|	}
  834|       |
  835|  22.6k|	if (NAMEEQUALS(name, "FreeBSD")) {
  ------------------
  |  |   67|  22.6k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.36k, False: 21.3k]
  |  |  |  Branch (67:29): [True: 466, False: 895]
  |  |  ------------------
  ------------------
  836|    466|		os_style = OS_STYLE_FREEBSD;
  ------------------
  |  |  340|    466|#define	OS_STYLE_FREEBSD	1
  ------------------
  837|    466|	}
  838|       |
  839|  22.6k|	if ((namesz >= 11 && memcmp(name, "NetBSD-CORE", 11) == 0)) {
  ------------------
  |  Branch (839:7): [True: 1.30k, False: 21.3k]
  |  Branch (839:23): [True: 446, False: 862]
  ------------------
  840|    446|		os_style = OS_STYLE_NETBSD;
  ------------------
  |  |  341|    446|#define	OS_STYLE_NETBSD		2
  ------------------
  841|    446|	}
  842|       |
  843|  22.6k|	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
  ------------------
  |  |  354|  2.78k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (843:6): [True: 2.78k, False: 19.8k]
  |  Branch (843:24): [True: 968, False: 1.81k]
  ------------------
  844|    968|		if (elf_printf(ms, ", %s-style", os_style_names[os_style])
  ------------------
  |  Branch (844:7): [True: 0, False: 968]
  ------------------
  845|    968|		    == -1)
  846|      0|			return -1;
  847|    968|		*flags |= FLAGS_DID_CORE_STYLE;
  ------------------
  |  |  354|    968|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  848|    968|		*flags |= os_style;
  849|    968|	}
  850|       |
  851|  22.6k|	switch (os_style) {
  852|    446|	case OS_STYLE_NETBSD:
  ------------------
  |  |  341|    446|#define	OS_STYLE_NETBSD		2
  ------------------
  |  Branch (852:2): [True: 446, False: 22.2k]
  ------------------
  853|    446|		if (type == NT_NETBSD_CORE_PROCINFO) {
  ------------------
  |  |  232|    446|#define	NT_NETBSD_CORE_PROCINFO		1
  ------------------
  |  Branch (853:7): [True: 4, False: 442]
  ------------------
  854|      4|			char sbuf[512];
  855|      4|			struct NetBSD_elfcore_procinfo pi;
  856|      4|			memset(&pi, 0, sizeof(pi));
  857|      4|			memcpy(&pi, nbuf + doff, MIN(descsz, sizeof(pi)));
  ------------------
  |  Branch (857:29): [True: 2, False: 2]
  ------------------
  858|       |
  859|      4|			if (elf_printf(ms, ", from '%.31s', pid=%u, uid=%u, "
  ------------------
  |  Branch (859:8): [True: 0, False: 4]
  ------------------
  860|      4|			    "gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",
  861|      4|			    file_printable(ms, sbuf, sizeof(sbuf),
  862|      4|			    RCAST(char *, pi.cpi_name), sizeof(pi.cpi_name)),
  ------------------
  |  |  461|      4|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  863|      4|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_pid)),
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  864|      4|			    elf_getu32(swap, pi.cpi_euid),
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  865|      4|			    elf_getu32(swap, pi.cpi_egid),
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  866|      4|			    elf_getu32(swap, pi.cpi_nlwps),
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  867|      4|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_siglwp)),
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  868|      4|			    elf_getu32(swap, pi.cpi_signo),
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  869|      4|			    elf_getu32(swap, pi.cpi_sigcode)) == -1)
  ------------------
  |  |  158|      4|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  870|      0|				return -1;
  871|       |
  872|      4|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|      4|#define FLAGS_DID_CORE			0x0004
  ------------------
  873|      4|			return 1;
  874|      4|		}
  875|    442|		break;
  876|       |
  877|    466|	case OS_STYLE_FREEBSD:
  ------------------
  |  |  340|    466|#define	OS_STYLE_FREEBSD	1
  ------------------
  |  Branch (877:2): [True: 466, False: 22.1k]
  ------------------
  878|    466|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|    932|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|    101|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (878:7): [True: 101, False: 365]
  |  Branch (878:30): [True: 32, False: 69]
  ------------------
  879|     32|			size_t argoff, pidoff;
  880|       |
  881|     32|			if (clazz == ELFCLASS32)
  ------------------
  |  |  153|     32|#define	ELFCLASS32	1
  ------------------
  |  Branch (881:8): [True: 30, False: 2]
  ------------------
  882|     30|				argoff = 4 + 4 + 17;
  883|      2|			else
  884|      2|				argoff = 4 + 4 + 8 + 17;
  885|     32|			if (doff + argoff + 81 <= size) {
  ------------------
  |  Branch (885:8): [True: 11, False: 21]
  ------------------
  886|     11|				if (elf_printf(ms, ", from '%.80s'",
  ------------------
  |  Branch (886:9): [True: 0, False: 11]
  ------------------
  887|     11|				    nbuf + doff + argoff) == -1)
  888|      0|					return -1;
  889|     11|			}
  890|     32|			pidoff = argoff + 81 + 2;
  891|     32|			if (doff + pidoff + 4 <= size) {
  ------------------
  |  Branch (891:8): [True: 7, False: 25]
  ------------------
  892|      7|				if (elf_printf(ms, ", pid=%u",
  ------------------
  |  Branch (892:9): [True: 0, False: 7]
  ------------------
  893|      7|				    elf_getu32(swap, *RCAST(uint32_t *, (nbuf +
  ------------------
  |  |  158|      7|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  894|      7|				    doff + pidoff)))) == -1)
  895|      0|					return -1;
  896|      7|			}
  897|     32|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     32|#define FLAGS_DID_CORE			0x0004
  ------------------
  898|     32|		}			    
  899|    466|		break;
  900|       |
  901|  21.7k|	default:
  ------------------
  |  Branch (901:2): [True: 21.7k, False: 912]
  ------------------
  902|  21.7k|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|  43.5k|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|  2.45k|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (902:7): [True: 2.45k, False: 19.3k]
  |  Branch (902:30): [True: 1.99k, False: 455]
  ------------------
  903|  1.99k|			size_t i, j;
  904|  1.99k|			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|  15.3k|			for (i = 0; i < NOFFSETS; i++) {
  ------------------
  |  |  308|  15.3k|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|  15.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|  14.5k|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  14.5k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  306|    856|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    856|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (308:19): [True: 14.5k, False: 856]
  |  |  ------------------
  ------------------
  |  Branch (915:16): [True: 13.4k, False: 1.91k]
  ------------------
  916|  13.4k|				unsigned char *cname, *cp;
  917|  13.4k|				size_t reloffset = prpsoffsets(i);
  ------------------
  |  |  263|  13.4k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  13.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 12.7k, False: 715]
  |  |  ------------------
  |  |  264|  13.4k|			 ? prpsoffsets32[i]			\
  |  |  265|  13.4k|			 : prpsoffsets64[i])
  ------------------
  918|  13.4k|				size_t noffset = doff + reloffset;
  919|  13.4k|				size_t k;
  920|  14.7k|				for (j = 0; j < 16; j++, noffset++,
  ------------------
  |  Branch (920:17): [True: 14.6k, False: 15]
  ------------------
  921|  14.6k|				    reloffset++) {
  922|       |					/*
  923|       |					 * Make sure we're not past
  924|       |					 * the end of the buffer; if
  925|       |					 * we are, just give up.
  926|       |					 */
  927|  14.6k|					if (noffset >= size)
  ------------------
  |  Branch (927:10): [True: 2.75k, False: 11.9k]
  ------------------
  928|  2.75k|						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|  11.9k|					if (reloffset >= descsz)
  ------------------
  |  Branch (936:10): [True: 7.78k, False: 4.14k]
  ------------------
  937|  7.78k|						goto tryanother;
  938|       |
  939|  4.14k|					c = nbuf[noffset];
  940|  4.14k|					if (c == '\0') {
  ------------------
  |  Branch (940:10): [True: 935, False: 3.20k]
  ------------------
  941|       |						/*
  942|       |						 * A '\0' at the
  943|       |						 * beginning is
  944|       |						 * obviously wrong.
  945|       |						 * Any other '\0'
  946|       |						 * means we're done.
  947|       |						 */
  948|    935|						if (j == 0)
  ------------------
  |  Branch (948:11): [True: 871, False: 64]
  ------------------
  949|    871|							goto tryanother;
  950|     64|						else
  951|     64|							break;
  952|  3.20k|					} else {
  953|       |						/*
  954|       |						 * A nonprintable
  955|       |						 * character is also
  956|       |						 * wrong.
  957|       |						 */
  958|  3.20k|						if (!isprint(c) || isquote(c))
  ------------------
  |  |   58|  1.68k|#define isquote(c) (strchr("'\"`", (c)) != NULL)
  |  |  ------------------
  |  |  |  Branch (58:20): [True: 464, False: 1.21k]
  |  |  ------------------
  ------------------
  |  Branch (958:11): [True: 1.52k, False: 1.68k]
  ------------------
  959|  1.99k|							goto tryanother;
  960|  3.20k|					}
  961|  4.14k|				}
  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|    271|				for (k = i + 1 ; k < NOFFSETS; k++) {
  ------------------
  |  |  308|    271|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|    271|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|    257|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    257|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  306|     14|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|     14|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (308:19): [True: 257, False: 14]
  |  |  ------------------
  ------------------
  |  Branch (970:22): [True: 192, False: 79]
  ------------------
  971|    192|					size_t no;
  972|    192|					int adjust = 1;
  973|    192|					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    192|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    192|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 182, False: 10]
  |  |  ------------------
  |  |  264|    192|			 ? prpsoffsets32[i]			\
  |  |  265|    192|			 : prpsoffsets64[i])
  ------------------
              					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    192|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    192|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 182, False: 10]
  |  |  ------------------
  |  |  264|    192|			 ? prpsoffsets32[i]			\
  |  |  265|    192|			 : prpsoffsets64[i])
  ------------------
  |  Branch (973:10): [True: 50, False: 142]
  ------------------
  974|     50|						continue;
  975|       |					/*
  976|       |					 * pr_fname == pr_psargs - 16 &&
  977|       |					 * non-nul-terminated fname (qemu)
  978|       |					 */
  979|    142|					if (prpsoffsets(k) ==
  ------------------
  |  |  263|    142|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    142|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 132, False: 10]
  |  |  ------------------
  |  |  264|    142|			 ? prpsoffsets32[i]			\
  |  |  265|    142|			 : prpsoffsets64[i])
  ------------------
  |  Branch (979:10): [True: 32, False: 110]
  ------------------
  980|    142|					    prpsoffsets(i) - 16 && j == 16)
  ------------------
  |  |  263|    142|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    142|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 132, False: 10]
  |  |  ------------------
  |  |  264|    142|			 ? prpsoffsets32[i]			\
  |  |  265|    142|			 : prpsoffsets64[i])
  ------------------
  |  Branch (980:33): [True: 8, False: 24]
  ------------------
  981|      8|						continue;
  982|    134|					for (no = doff + prpsoffsets(k);
  ------------------
  |  |  263|    134|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    134|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 124, False: 10]
  |  |  ------------------
  |  |  264|    134|			 ? prpsoffsets32[i]			\
  |  |  265|    134|			 : prpsoffsets64[i])
  ------------------
  983|  4.99k|					     no < doff + prpsoffsets(i); no++)
  ------------------
  |  |  263|  4.99k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  4.99k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 4.39k, False: 602]
  |  |  ------------------
  |  |  264|  4.99k|			 ? prpsoffsets32[i]			\
  |  |  265|  4.99k|			 : prpsoffsets64[i])
  ------------------
  |  Branch (983:11): [True: 4.86k, False: 134]
  ------------------
  984|  4.86k|						adjust = adjust
  ------------------
  |  Branch (984:16): [True: 986, False: 3.87k]
  ------------------
  985|  4.86k|						         && isprint(nbuf[no]);
  ------------------
  |  Branch (985:19): [True: 874, False: 112]
  ------------------
  986|    134|					if (adjust)
  ------------------
  |  Branch (986:10): [True: 22, False: 112]
  ------------------
  987|     22|						i = k;
  988|    134|				}
  989|       |
  990|     79|				cname = CAST(unsigned char *,
  ------------------
  |  |  460|    158|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 75, False: 4]
  |  |  ------------------
  ------------------
  991|     79|				    &nbuf[doff + prpsoffsets(i)]);
  992|  1.56k|				for (cp = cname; cp < nbuf + size && *cp
  ------------------
  |  Branch (992:22): [True: 1.55k, False: 9]
  |  Branch (992:42): [True: 1.48k, False: 67]
  ------------------
  993|  1.56k|				    && isprint(*cp); cp++)
  ------------------
  |  Branch (993:12): [True: 1.48k, False: 3]
  ------------------
  994|  1.48k|					continue;
  995|       |				/*
  996|       |				 * Linux apparently appends a space at the end
  997|       |				 * of the command line: remove it.
  998|       |				 */
  999|    433|				while (cp > cname && isspace(cp[-1]))
  ------------------
  |  Branch (999:12): [True: 424, False: 9]
  |  Branch (999:26): [True: 354, False: 70]
  ------------------
 1000|    354|					cp--;
 1001|     79|				if (elf_printf(ms, ", from '%s'",
  ------------------
  |  Branch (1001:9): [True: 0, False: 79]
  ------------------
 1002|     79|				    file_copystr(buf, sizeof(buf),
 1003|     79|				    CAST(size_t, cp - cname),
  ------------------
  |  |  460|     79|#define CAST(T, b)	((T)(b))
  ------------------
 1004|     79|				    RCAST(char *, cname))) == -1)
  ------------------
  |  |  461|     79|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1005|      0|					return -1;
 1006|     79|				*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     79|#define FLAGS_DID_CORE			0x0004
  ------------------
 1007|     79|				return 1;
 1008|       |
 1009|  13.4k|			tryanother:
 1010|  13.4k|				;
 1011|  13.4k|			}
 1012|  1.99k|		}
 1013|  21.6k|		break;
 1014|  22.6k|	}
 1015|  22.5k|#endif
 1016|  22.5k|	return 0;
 1017|  22.6k|}
readelf.c:do_auxv_note:
 1094|  23.0k|{
 1095|  23.0k|#ifdef ELFCORE
 1096|  23.0k|	Aux32Info auxv32;
 1097|  23.0k|	Aux64Info auxv64;
 1098|  23.0k|	size_t elsize = xauxv_sizeof;
  ------------------
  |  |  253|  23.0k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 19.5k, False: 3.55k]
  |  |  ------------------
  |  |  254|  23.0k|			 ? sizeof(auxv32)			\
  |  |  255|  23.0k|			 : sizeof(auxv64))
  ------------------
 1099|  23.0k|	const char *tag;
 1100|  23.0k|	int is_string;
 1101|  23.0k|	size_t nval, off;
 1102|       |
 1103|  23.0k|	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  361|  23.0k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  354|  23.0k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (1103:6): [True: 18.6k, False: 4.37k]
  ------------------
 1104|  23.0k|	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  361|  23.0k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  354|  23.0k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
 1105|  18.6k|		return 0;
 1106|       |
 1107|  4.37k|	switch (*flags & FLAGS_CORE_STYLE) {
  ------------------
  |  |  349|  4.37k|#define FLAGS_CORE_STYLE		0x0003
  ------------------
 1108|  2.57k|	case OS_STYLE_SVR4:
  ------------------
  |  |  339|  2.57k|#define	OS_STYLE_SVR4		0
  ------------------
  |  Branch (1108:2): [True: 2.57k, False: 1.79k]
  ------------------
 1109|  2.57k|		if (type != NT_AUXV)
  ------------------
  |  |  281|  2.57k|#define	NT_AUXV		6
  ------------------
  |  Branch (1109:7): [True: 1.82k, False: 750]
  ------------------
 1110|  1.82k|			return 0;
 1111|    750|		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.79k|	default:
  ------------------
  |  Branch (1122:2): [True: 1.79k, False: 2.57k]
  ------------------
 1123|  1.79k|		return 0;
 1124|  4.37k|	}
 1125|       |
 1126|    750|	*flags |= FLAGS_DID_AUXV;
  ------------------
  |  |  362|    750|#define FLAGS_DID_AUXV			0x2000
  ------------------
 1127|       |
 1128|    750|	nval = 0;
 1129|  6.62k|	for (off = 0; off + elsize <= descsz; off += elsize) {
  ------------------
  |  Branch (1129:16): [True: 5.88k, False: 735]
  ------------------
 1130|  5.88k|		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  250|  5.88k|#define xauxv_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.88k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (250:21): [True: 3.20k, False: 2.68k]
  |  |  ------------------
  |  |  251|  5.88k|			 ? CAST(void *, &auxv32)		\
  |  |  ------------------
  |  |  |  |  460|  3.20k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  252|  5.88k|			 : CAST(void *, &auxv64))
  |  |  ------------------
  |  |  |  |  460|  2.68k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  253|  5.88k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.88k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 3.20k, False: 2.68k]
  |  |  ------------------
  |  |  254|  5.88k|			 ? sizeof(auxv32)			\
  |  |  255|  5.88k|			 : sizeof(auxv64))
  ------------------
 1131|       |		/* Limit processing to 50 vector entries to prevent DoS */
 1132|  5.88k|		if (nval++ >= 50) {
  ------------------
  |  Branch (1132:7): [True: 15, False: 5.87k]
  ------------------
 1133|     15|			file_error(ms, 0, "Too many ELF Auxv elements");
 1134|     15|			return 1;
 1135|     15|		}
 1136|       |
 1137|  5.87k|		switch(xauxv_type) {
  ------------------
  |  |  256|  5.87k|#define xauxv_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.87k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (256:21): [True: 3.19k, False: 2.67k]
  |  |  ------------------
  |  |  257|  5.87k|			 ? elf_getu32(swap, auxv32.a_type)	\
  |  |  ------------------
  |  |  |  |  158|  3.19k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  258|  5.87k|			 : elf_getu64(swap, auxv64.a_type))
  |  |  ------------------
  |  |  |  |  159|  2.67k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1138|    933|		case AT_LINUX_EXECFN:
  ------------------
  |  |   90|    933|#define AT_LINUX_EXECFN 31   /* filename of program */
  ------------------
  |  Branch (1138:3): [True: 933, False: 4.94k]
  ------------------
 1139|    933|			is_string = 1;
 1140|    933|			tag = "execfn";
 1141|    933|			break;
 1142|  1.05k|		case AT_LINUX_PLATFORM:
  ------------------
  |  |   81|  1.05k|#define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
  ------------------
  |  Branch (1142:3): [True: 1.05k, False: 4.82k]
  ------------------
 1143|  1.05k|			is_string = 1;
 1144|  1.05k|			tag = "platform";
 1145|  1.05k|			break;
 1146|     45|		case AT_LINUX_UID:
  ------------------
  |  |   77|     45|#define AT_LINUX_UID    11    /* real uid */
  ------------------
  |  Branch (1146:3): [True: 45, False: 5.82k]
  ------------------
 1147|     45|			is_string = 0;
 1148|     45|			tag = "real uid";
 1149|     45|			break;
 1150|     50|		case AT_LINUX_GID:
  ------------------
  |  |   79|     50|#define AT_LINUX_GID    13    /* real gid */
  ------------------
  |  Branch (1150:3): [True: 50, False: 5.82k]
  ------------------
 1151|     50|			is_string = 0;
 1152|     50|			tag = "real gid";
 1153|     50|			break;
 1154|     67|		case AT_LINUX_EUID:
  ------------------
  |  |   78|     67|#define AT_LINUX_EUID   12    /* effective uid */
  ------------------
  |  Branch (1154:3): [True: 67, False: 5.80k]
  ------------------
 1155|     67|			is_string = 0;
 1156|     67|			tag = "effective uid";
 1157|     67|			break;
 1158|     84|		case AT_LINUX_EGID:
  ------------------
  |  |   80|     84|#define AT_LINUX_EGID   14    /* effective gid */
  ------------------
  |  Branch (1158:3): [True: 84, False: 5.79k]
  ------------------
 1159|     84|			is_string = 0;
 1160|     84|			tag = "effective gid";
 1161|     84|			break;
 1162|  3.64k|		default:
  ------------------
  |  Branch (1162:3): [True: 3.64k, False: 2.23k]
  ------------------
 1163|  3.64k|			is_string = 0;
 1164|  3.64k|			tag = NULL;
 1165|  3.64k|			break;
 1166|  5.87k|		}
 1167|       |
 1168|  5.87k|		if (tag == NULL)
  ------------------
  |  Branch (1168:7): [True: 3.64k, False: 2.23k]
  ------------------
 1169|  3.64k|			continue;
 1170|       |
 1171|  2.23k|		if (is_string) {
  ------------------
  |  Branch (1171:7): [True: 1.98k, False: 246]
  ------------------
 1172|  1.98k|			char buf[256];
 1173|  1.98k|			ssize_t buflen;
 1174|  1.98k|			buflen = get_string_on_virtaddr(ms, swap, clazz, fd,
 1175|  1.98k|			    ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf));
  ------------------
  |  |  259|  1.98k|#define xauxv_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.98k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (259:20): [True: 1.21k, False: 770]
  |  |  ------------------
  |  |  260|  1.98k|			 ? elf_getu32(swap, auxv32.a_v)		\
  |  |  ------------------
  |  |  |  |  158|  1.21k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  261|  1.98k|			 : elf_getu64(swap, auxv64.a_v))
  |  |  ------------------
  |  |  |  |  159|    770|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1176|       |
 1177|  1.98k|			if (buflen == 0)
  ------------------
  |  Branch (1177:8): [True: 1.90k, False: 83]
  ------------------
 1178|  1.90k|				continue;
 1179|       |
 1180|     83|			if (elf_printf(ms, ", %s: '%s'", tag, buf) == -1)
  ------------------
  |  Branch (1180:8): [True: 0, False: 83]
  ------------------
 1181|      0|				return -1;
 1182|    246|		} else {
 1183|    246|			if (elf_printf(ms, ", %s: %d", tag,
  ------------------
  |  Branch (1183:8): [True: 0, False: 246]
  ------------------
 1184|    246|			    CAST(int, xauxv_val)) == -1)
  ------------------
  |  |  460|    492|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 217, False: 29]
  |  |  ------------------
  ------------------
 1185|      0|				return -1;
 1186|    246|		}
 1187|  2.23k|	}
 1188|    735|	return 1;
 1189|       |#else
 1190|       |	return 0;
 1191|       |#endif
 1192|    750|}
readelf.c:get_string_on_virtaddr:
 1057|  1.98k|{
 1058|  1.98k|	char *bptr;
 1059|  1.98k|	off_t offset;
 1060|       |
 1061|  1.98k|	if (buflen == 0)
  ------------------
  |  Branch (1061:6): [True: 0, False: 1.98k]
  ------------------
 1062|      0|		return 0;
 1063|       |
 1064|  1.98k|	offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
 1065|  1.98k|	    fsize, virtaddr);
 1066|  1.98k|	if (offset < 0 ||
  ------------------
  |  Branch (1066:6): [True: 142, False: 1.84k]
  ------------------
 1067|  1.84k|	    (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
  ------------------
  |  |  460|  1.84k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1067:6): [True: 660, False: 1.18k]
  ------------------
 1068|    802|		(void)elf_printf(ms, ", can't read elf string at %jd",
 1069|    802|		    (intmax_t)offset);
 1070|    802|		return 0;
 1071|    802|	}
 1072|       |
 1073|  1.18k|	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|  8.64k|	for (bptr = buf; *bptr && isprint(CAST(unsigned char, *bptr)); bptr++)
  ------------------
  |  Branch (1077:19): [True: 8.44k, False: 199]
  |  Branch (1077:28): [True: 7.46k, False: 983]
  ------------------
 1078|  7.46k|		continue;
 1079|  1.18k|	if (*bptr != '\0')
  ------------------
  |  Branch (1079:6): [True: 983, False: 199]
  ------------------
 1080|    983|		return 0;
 1081|       |
 1082|    199|	return bptr - buf;
 1083|  1.18k|}
readelf.c:get_offset_from_virtaddr:
 1022|  1.98k|{
 1023|  1.98k|	Elf32_Phdr ph32;
 1024|  1.98k|	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|  20.2k|	for ( ; num; num--) {
  ------------------
  |  Branch (1030:10): [True: 20.1k, False: 131]
  ------------------
 1031|  20.1k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  20.1k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 12.5k, False: 7.57k]
  |  |  ------------------
  |  |  181|  20.1k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  460|  12.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  20.1k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  460|  7.57k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  20.1k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 12.5k, False: 7.57k]
  |  |  ------------------
  |  |  184|  20.1k|			 ? sizeof(ph32)				\
  |  |  185|  20.1k|			 : sizeof(ph64))
  ------------------
  |  Branch (1031:7): [True: 823, False: 19.3k]
  ------------------
 1032|  20.1k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  460|  40.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 12.5k, False: 7.57k]
  |  |  ------------------
  ------------------
 1033|    823|			if (elf_printf(ms,
  ------------------
  |  Branch (1033:8): [True: 0, False: 823]
  ------------------
 1034|    823|			    ", can't read elf program header at %jd",
 1035|    823|			    (intmax_t)off) == -1)
 1036|      0|				return -1;
 1037|    823|			return 0;
 1038|       |
 1039|    823|		}
 1040|  19.3k|		off += xph_sizeof;
  ------------------
  |  |  183|  19.3k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 12.0k, False: 7.29k]
  |  |  ------------------
  |  |  184|  19.3k|			 ? sizeof(ph32)				\
  |  |  185|  19.3k|			 : sizeof(ph64))
  ------------------
 1041|       |
 1042|  19.3k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  19.3k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  38.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  19.3k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  38.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 12.0k, False: 7.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  19.3k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  19.3k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1042:7): [True: 19.3k, False: 0]
  |  Branch (1042:32): [True: 11.2k, False: 8.04k]
  ------------------
 1043|       |			/* Perhaps warn here */
 1044|  11.2k|			continue;
 1045|  11.2k|		}
 1046|       |
 1047|  8.04k|		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  8.04k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  32.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 3.10k, False: 450]
  |  |  |  |  |  Branch (460:25): [True: 4.08k, False: 412]
  |  |  |  |  |  Branch (460:25): [True: 3.55k, False: 4.49k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  8.04k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  8.04k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  8.04k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  8.04k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  5.11k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  20.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 2.09k, False: 450]
  |  |  |  |  |  Branch (460:25): [True: 2.16k, False: 409]
  |  |  |  |  |  Branch (460:25): [True: 2.54k, False: 2.57k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  5.11k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  5.11k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  5.11k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  5.11k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  202|  5.11k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  10.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 2.54k, False: 2.57k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1047:7): [True: 5.11k, False: 2.92k]
  |  Branch (1047:32): [True: 1.03k, False: 4.08k]
  ------------------
 1048|  1.03k|			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  189|  1.03k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  2.06k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 585, False: 445]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  1.03k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  1.03k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
              			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  197|  1.03k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  4.12k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 459, False: 126]
  |  |  |  |  |  Branch (460:25): [True: 332, False: 113]
  |  |  |  |  |  Branch (460:25): [True: 585, False: 445]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  1.03k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  1.03k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  1.03k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  1.03k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
 1049|  8.04k|	}
 1050|    131|	return 0;
 1051|  1.98k|}
readelf.c:getu32:
  113|   657k|{
  114|   657k|	union {
  115|   657k|		uint32_t ui;
  116|   657k|		char c[4];
  117|   657k|	} retval, tmpval;
  118|       |
  119|   657k|	if (swap) {
  ------------------
  |  Branch (119:6): [True: 159k, False: 498k]
  ------------------
  120|   159k|		tmpval.ui = value;
  121|       |
  122|   159k|		retval.c[0] = tmpval.c[3];
  123|   159k|		retval.c[1] = tmpval.c[2];
  124|   159k|		retval.c[2] = tmpval.c[1];
  125|   159k|		retval.c[3] = tmpval.c[0];
  126|       |
  127|   159k|		return retval.ui;
  128|   159k|	} else
  129|   498k|		return value;
  130|   657k|}
readelf.c:dophn_exec:
 1740|  1.97k|{
 1741|  1.97k|	Elf32_Phdr ph32;
 1742|  1.97k|	Elf64_Phdr ph64;
 1743|  1.97k|	const char *str;
 1744|  1.97k|	unsigned char nbuf[NBUFSIZE];
 1745|  1.97k|	char interp[NBUFSIZE];
 1746|  1.97k|	ssize_t bufsize;
 1747|  1.97k|	size_t offset, align, need = 0;
 1748|  1.97k|	int pie = 0, dynamic = 0;
 1749|       |
 1750|  1.97k|	if (num == 0) {
  ------------------
  |  Branch (1750:6): [True: 581, False: 1.39k]
  ------------------
 1751|    581|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (1751:7): [True: 0, False: 581]
  ------------------
 1752|      0|			return -1;
 1753|    581|		return 0;
 1754|    581|	}
 1755|  1.39k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  1.39k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.39k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 802, False: 593]
  |  |  ------------------
  |  |  184|  1.39k|			 ? sizeof(ph32)				\
  |  |  185|  1.39k|			 : sizeof(ph64))
  ------------------
  |  Branch (1755:6): [True: 428, False: 967]
  ------------------
 1756|    428|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (1756:7): [True: 0, False: 428]
  ------------------
 1757|      0|			return -1;
 1758|    428|		return 0;
 1759|    428|	}
 1760|       |
 1761|    967|	interp[0] = '\0';
 1762|  33.3k|  	for ( ; num; num--) {
  ------------------
  |  Branch (1762:12): [True: 33.3k, False: 63]
  ------------------
 1763|  33.3k|		int doread;
 1764|  33.3k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  33.3k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 25.7k, False: 7.52k]
  |  |  ------------------
  |  |  181|  33.3k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  460|  25.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  33.3k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  460|  7.52k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  33.3k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  33.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 25.7k, False: 7.52k]
  |  |  ------------------
  |  |  184|  33.3k|			 ? sizeof(ph32)				\
  |  |  185|  33.3k|			 : sizeof(ph64))
  ------------------
  |  Branch (1764:7): [True: 887, False: 32.4k]
  ------------------
 1765|  33.3k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  460|  66.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 25.7k, False: 7.52k]
  |  |  ------------------
  ------------------
 1766|    887|			if (elf_printf(ms,
  ------------------
  |  Branch (1766:8): [True: 0, False: 887]
  ------------------
 1767|    887|			    ", can't read elf program headers at %jd",
 1768|    887|			    (intmax_t)off) == -1)
 1769|      0|				return -1;
 1770|    887|			return 0;
 1771|    887|		}
 1772|       |
 1773|  32.4k|		off += size;
 1774|  32.4k|		bufsize = 0;
 1775|  32.4k|		align = 4;
 1776|       |
 1777|       |		/* Things we can determine before we seek */
 1778|  32.4k|		switch (xph_type) {
  ------------------
  |  |  186|  32.4k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 25.2k, False: 7.13k]
  |  |  ------------------
  |  |  187|  32.4k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  25.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  32.4k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  7.13k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1779|  2.14k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  2.14k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1779:3): [True: 2.14k, False: 30.2k]
  ------------------
 1780|  2.14k|			doread = 1;
 1781|  2.14k|			break;
 1782|  4.71k|		case PT_NOTE:
  ------------------
  |  |  201|  4.71k|#define	PT_NOTE		4
  ------------------
  |  Branch (1782:3): [True: 4.71k, False: 27.7k]
  ------------------
 1783|  4.71k|			if (sh_num)	/* Did this through section headers */
  ------------------
  |  Branch (1783:8): [True: 425, False: 4.29k]
  ------------------
 1784|    425|				continue;
 1785|  4.29k|			if (((align = xph_align) & 0x80000000UL) != 0 ||
  ------------------
  |  |  192|  4.29k|#define xph_align	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  17.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.57k, False: 1.09k]
  |  |  |  |  |  Branch (460:25): [True: 1.25k, False: 369]
  |  |  |  |  |  Branch (460:25): [True: 2.67k, False: 1.62k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|  4.29k|			 ? CAST(off_t, (ph32.p_align ? 		\
  |  |  194|  4.29k|			    elf_getu32(swap, ph32.p_align) : 4))\
  |  |  195|  4.29k|			 : CAST(off_t, (ph64.p_align ?		\
  |  |  196|  4.29k|			    elf_getu64(swap, ph64.p_align) : 4))))
  ------------------
  |  Branch (1785:8): [True: 369, False: 3.92k]
  ------------------
 1786|  3.92k|			    align < 4) {
  ------------------
  |  Branch (1786:8): [True: 540, False: 3.38k]
  ------------------
 1787|    909|				if (elf_printf(ms,
  ------------------
  |  Branch (1787:9): [True: 0, False: 909]
  ------------------
 1788|    909|				    ", invalid note alignment %#lx",
 1789|    909|				    CAST(unsigned long, align)) == -1)
  ------------------
  |  |  460|    909|#define CAST(T, b)	((T)(b))
  ------------------
 1790|      0|					return -1;
 1791|    909|				align = 4;
 1792|    909|			}
 1793|       |			/*FALLTHROUGH*/
 1794|  5.46k|		case PT_INTERP:
  ------------------
  |  |  200|  5.46k|#define	PT_INTERP	3
  ------------------
  |  Branch (1794:3): [True: 1.17k, False: 31.2k]
  ------------------
 1795|  5.46k|			doread = 1;
 1796|  5.46k|			break;
 1797|  24.3k|		default:
  ------------------
  |  Branch (1797:3): [True: 24.3k, False: 8.03k]
  ------------------
 1798|  24.3k|			doread = 0;
 1799|  24.3k|			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  24.3k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  48.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  24.3k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  48.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 19.2k, False: 5.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  24.3k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  24.3k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1799:8): [True: 24.3k, False: 0]
  |  Branch (1799:33): [True: 12.1k, False: 12.2k]
  ------------------
 1800|       |				/* Maybe warn here? */
 1801|  12.1k|				continue;
 1802|  12.1k|			}
 1803|  12.2k|			break;
 1804|  32.4k|		}
 1805|       |
 1806|  19.8k|		if (doread) {
  ------------------
  |  Branch (1806:7): [True: 7.60k, False: 12.2k]
  ------------------
 1807|  7.60k|			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  7.60k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  15.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.64k, False: 1.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.60k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.60k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  2.57k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  5.15k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.96k, False: 614]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.60k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.60k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (1807:17): [True: 2.57k, False: 5.03k]
  ------------------
 1808|  7.60k|			    : sizeof(nbuf);
 1809|  7.60k|			off_t offs = xph_offset;
  ------------------
  |  |  189|  7.60k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  15.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.64k, False: 1.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  7.60k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  7.60k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
 1810|  7.60k|			bufsize = pread(fd, nbuf, len, offs);
 1811|  7.60k|			if (bufsize == -1) {
  ------------------
  |  Branch (1811:8): [True: 17, False: 7.59k]
  ------------------
 1812|     17|				if (elf_printf(ms,
  ------------------
  |  Branch (1812:9): [True: 0, False: 17]
  ------------------
 1813|     17|				    ", can't read section at %jd",
 1814|     17|				    (intmax_t)offs) == -1)
 1815|      0|					return -1;
 1816|     17|				return 0;
 1817|     17|			}
 1818|  7.60k|		}
 1819|       |
 1820|       |		/* Things we can determine when we seek */
 1821|  19.8k|		switch (xph_type) {
  ------------------
  |  |  186|  19.8k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  19.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 14.6k, False: 5.21k]
  |  |  ------------------
  |  |  187|  19.8k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  14.6k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  19.8k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  5.21k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1822|  2.14k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  2.14k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1822:3): [True: 2.14k, False: 17.7k]
  ------------------
 1823|  2.14k|			dynamic = 1;
 1824|  2.14k|			offset = 0;
 1825|       |			// Let DF_1 determine if we are PIE or not.
 1826|  2.14k|			ms->mode &= ~0111;
 1827|  72.5k|			for (;;) {
 1828|  72.5k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  460|  72.5k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1828:9): [True: 2.14k, False: 70.4k]
  ------------------
 1829|  2.14k|					break;
 1830|  70.4k|				offset = dodynamic(ms, nbuf, offset,
 1831|  70.4k|				    CAST(size_t, bufsize), clazz, swap,
  ------------------
  |  |  460|  70.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1832|  70.4k|				    &pie, &need);
 1833|  70.4k|				if (offset == 0)
  ------------------
  |  Branch (1833:9): [True: 0, False: 70.4k]
  ------------------
 1834|      0|					break;
 1835|  70.4k|			}
 1836|  2.14k|			break;
 1837|       |
 1838|  70.4k|		case PT_INTERP:
  ------------------
  |  |  200|  1.17k|#define	PT_INTERP	3
  ------------------
  |  Branch (1838:3): [True: 1.17k, False: 18.6k]
  ------------------
 1839|  1.17k|			need++;
 1840|  1.17k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.17k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.17k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.17k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1840:8): [True: 0, False: 1.17k]
  ------------------
 1841|      0|				continue;
 1842|  1.17k|			if (bufsize && nbuf[0]) {
  ------------------
  |  Branch (1842:8): [True: 558, False: 616]
  |  Branch (1842:19): [True: 301, False: 257]
  ------------------
 1843|    301|				nbuf[bufsize - 1] = '\0';
 1844|    301|				str = RCAST(const char *, nbuf);
  ------------------
  |  |  461|    301|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1845|    301|			} else
 1846|    873|				str = "*empty*";
 1847|  1.17k|			strlcpy(interp, str, sizeof(interp));
 1848|  1.17k|			break;
 1849|  4.27k|		case PT_NOTE:
  ------------------
  |  |  201|  4.27k|#define	PT_NOTE		4
  ------------------
  |  Branch (1849:3): [True: 4.27k, False: 15.5k]
  ------------------
 1850|  4.27k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  4.27k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  4.27k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  4.27k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1850:8): [True: 0, False: 4.27k]
  ------------------
 1851|      0|				return 0;
 1852|       |			/*
 1853|       |			 * This is a PT_NOTE section; loop through all the notes
 1854|       |			 * in the section.
 1855|       |			 */
 1856|  4.27k|			offset = 0;
 1857|  7.60k|			for (;;) {
 1858|  7.60k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  460|  7.60k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1858:9): [True: 3.64k, False: 3.96k]
  ------------------
 1859|  3.64k|					break;
 1860|  3.96k|				offset = donote(ms, nbuf, offset,
 1861|  3.96k|				    CAST(size_t, bufsize), clazz, swap, align,
  ------------------
  |  |  460|  3.96k|#define CAST(T, b)	((T)(b))
  ------------------
 1862|  3.96k|				    flags, notecount, fd, 0, 0, 0);
 1863|  3.96k|				if (offset == 0)
  ------------------
  |  Branch (1863:9): [True: 629, False: 3.33k]
  ------------------
 1864|    629|					break;
 1865|  3.96k|			}
 1866|  4.27k|			break;
 1867|  12.2k|		default:
  ------------------
  |  Branch (1867:3): [True: 12.2k, False: 7.59k]
  ------------------
 1868|  12.2k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  12.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1868:8): [True: 0, False: 12.2k]
  ------------------
 1869|      0|				continue;
 1870|  12.2k|			break;
 1871|  19.8k|		}
 1872|  19.8k|	}
 1873|     63|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|     63|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|     63|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|     63|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1873:6): [True: 0, False: 63]
  ------------------
 1874|      0|		return 0;
 1875|     63|	if (dynamic) {
  ------------------
  |  Branch (1875:6): [True: 26, False: 37]
  ------------------
 1876|     26|		if (pie && need == 0)
  ------------------
  |  Branch (1876:7): [True: 3, False: 23]
  |  Branch (1876:14): [True: 1, False: 2]
  ------------------
 1877|      1|			str = "static-pie";
 1878|     25|		else
 1879|     25|			str = "dynamically";
 1880|     37|	} else {
 1881|     37|		str = "statically";
 1882|     37|	}
 1883|     63|	if (elf_printf(ms, ", %s linked", str) == -1)
  ------------------
  |  Branch (1883:6): [True: 0, False: 63]
  ------------------
 1884|      0|		return -1;
 1885|     63|	if (interp[0])
  ------------------
  |  Branch (1885:6): [True: 13, False: 50]
  ------------------
 1886|     13|		if (elf_printf(ms, ", interpreter %s", file_printable(ms,
  ------------------
  |  Branch (1886:7): [True: 2, False: 11]
  ------------------
 1887|     13|		    RCAST(char *, nbuf), sizeof(nbuf),
  ------------------
  |  |  461|     13|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1888|     13|		    interp, sizeof(interp))) == -1)
 1889|      2|			return -1;
 1890|     61|	return 0;
 1891|     63|}
readelf.c:dodynamic:
 1197|  70.4k|{
 1198|  70.4k|	Elf32_Dyn dh32;
 1199|  70.4k|	Elf64_Dyn dh64;
 1200|  70.4k|	unsigned char *dbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  460|  70.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1201|       |
 1202|  70.4k|	if (xdh_sizeof + offset > size) {
  ------------------
  |  |  227|  70.4k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  70.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 48.2k, False: 22.1k]
  |  |  ------------------
  |  |  228|  70.4k|			 ? sizeof(dh32)				\
  |  |  229|  70.4k|			 : sizeof(dh64))
  ------------------
  |  Branch (1202:6): [True: 1.64k, False: 68.7k]
  ------------------
 1203|       |		/*
 1204|       |		 * We're out of note headers.
 1205|       |		 */
 1206|  1.64k|		return xdh_sizeof + offset;
  ------------------
  |  |  227|  1.64k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.64k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 1.37k, False: 266]
  |  |  ------------------
  |  |  228|  1.64k|			 ? sizeof(dh32)				\
  |  |  229|  1.64k|			 : sizeof(dh64))
  ------------------
 1207|  1.64k|	}
 1208|       |
 1209|  68.7k|	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  224|  68.7k|#define xdh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (224:19): [True: 46.9k, False: 21.8k]
  |  |  ------------------
  |  |  225|  68.7k|			 ? CAST(void *, &dh32)			\
  |  |  ------------------
  |  |  |  |  460|  46.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  226|  68.7k|			 : CAST(void *, &dh64))
  |  |  ------------------
  |  |  |  |  460|  21.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  227|  68.7k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 46.9k, False: 21.8k]
  |  |  ------------------
  |  |  228|  68.7k|			 ? sizeof(dh32)				\
  |  |  229|  68.7k|			 : sizeof(dh64))
  ------------------
 1210|  68.7k|	offset += xdh_sizeof;
  ------------------
  |  |  227|  68.7k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 46.9k, False: 21.8k]
  |  |  ------------------
  |  |  228|  68.7k|			 ? sizeof(dh32)				\
  |  |  229|  68.7k|			 : sizeof(dh64))
  ------------------
 1211|       |
 1212|  68.7k|	switch (xdh_tag) {
  ------------------
  |  |  230|  68.7k|#define xdh_tag		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (230:19): [True: 46.9k, False: 21.8k]
  |  |  ------------------
  |  |  231|  68.7k|			 ? elf_getu32(swap, dh32.d_tag)		\
  |  |  ------------------
  |  |  |  |  158|  46.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  232|  68.7k|			 : elf_getu64(swap, dh64.d_tag))
  |  |  ------------------
  |  |  |  |  159|  21.8k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1213|  3.15k|	case DT_FLAGS_1:
  ------------------
  |  |  531|  3.15k|#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
  ------------------
  |  Branch (1213:2): [True: 3.15k, False: 65.6k]
  ------------------
 1214|  3.15k|		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  233|  3.15k|#define xdh_val		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  3.15k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (233:19): [True: 2.73k, False: 422]
  |  |  ------------------
  |  |  234|  3.15k|			 ? elf_getu32(swap, dh32.d_un.d_val)	\
  |  |  ------------------
  |  |  |  |  158|  2.73k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  235|  3.15k|			 : elf_getu64(swap, dh64.d_un.d_val))
  |  |  ------------------
  |  |  |  |  159|    422|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
              		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  574|  3.15k|#define	DF_1_PIE	0x08000000	/* Position Independent Executable */
  ------------------
  |  Branch (1214:7): [True: 2.40k, False: 751]
  ------------------
 1215|  2.40k|			*pie = 1;
 1216|  2.40k|			ms->mode |= 0111;
 1217|  2.40k|		} else
 1218|    751|			ms->mode &= ~0111;
 1219|  3.15k|		break;
 1220|  2.49k|	case DT_NEEDED:
  ------------------
  |  |  494|  2.49k|#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
  ------------------
  |  Branch (1220:2): [True: 2.49k, False: 66.2k]
  ------------------
 1221|  2.49k|		(*need)++;
 1222|  2.49k|		break;
 1223|  63.1k|	default:
  ------------------
  |  Branch (1223:2): [True: 63.1k, False: 5.64k]
  ------------------
 1224|  63.1k|		break;
 1225|  68.7k|	}
 1226|  68.7k|	return offset;
 1227|  68.7k|}
readelf.c:doshn:
 1432|  2.07k|{
 1433|  2.07k|	Elf32_Shdr sh32;
 1434|  2.07k|	Elf64_Shdr sh64;
 1435|  2.07k|	int stripped = 1, has_debug_info = 0;
 1436|  2.07k|	size_t nbadcap = 0;
 1437|  2.07k|	void *nbuf;
 1438|  2.07k|	off_t noff, coff, name_off, offs;
 1439|  2.07k|	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilities */
 1440|  2.07k|	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilities */
 1441|  2.07k|	char name[50];
 1442|  2.07k|	ssize_t namesize;
 1443|       |
 1444|  2.07k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  2.07k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.07k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.07k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1444:6): [True: 0, False: 2.07k]
  ------------------
 1445|      0|		return 0;
 1446|       |
 1447|  2.07k|	if (num == 0) {
  ------------------
  |  Branch (1447:6): [True: 564, False: 1.50k]
  ------------------
 1448|    564|		if (elf_printf(ms, ", no section header") == -1)
  ------------------
  |  Branch (1448:7): [True: 0, False: 564]
  ------------------
 1449|      0|			return -1;
 1450|    564|		return 0;
 1451|    564|	}
 1452|  1.50k|	if (size != xsh_sizeof) {
  ------------------
  |  |  164|  1.50k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.50k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 814, False: 693]
  |  |  ------------------
  |  |  165|  1.50k|			 ? sizeof(sh32)				\
  |  |  166|  1.50k|			 : sizeof(sh64))
  ------------------
  |  Branch (1452:6): [True: 320, False: 1.18k]
  ------------------
 1453|    320|		if (elf_printf(ms, ", corrupted section header size") == -1)
  ------------------
  |  Branch (1453:7): [True: 0, False: 320]
  ------------------
 1454|      0|			return -1;
 1455|    320|		return 0;
 1456|    320|	}
 1457|       |
 1458|       |	/* Read offset of name section to be able to read section names later */
 1459|  1.18k|	offs = CAST(off_t, (off + size * strtab));
  ------------------
  |  |  460|  1.18k|#define CAST(T, b)	((T)(b))
  ------------------
 1460|  1.18k|	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  161|  1.18k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.18k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 618, False: 569]
  |  |  ------------------
  |  |  162|  1.18k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  460|    618|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  1.18k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  460|    569|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  164|  1.18k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.18k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 618, False: 569]
  |  |  ------------------
  |  |  165|  1.18k|			 ? sizeof(sh32)				\
  |  |  166|  1.18k|			 : sizeof(sh64))
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  460|  2.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 618, False: 569]
  |  |  ------------------
  ------------------
  |  Branch (1460:6): [True: 11, False: 1.17k]
  ------------------
 1461|     11|		if (elf_printf(ms, ", missing section headers at %jd",
  ------------------
  |  Branch (1461:7): [True: 0, False: 11]
  ------------------
 1462|     11|		    (intmax_t)offs) == -1)
 1463|      0|			return -1;
 1464|     11|		return 0;
 1465|     11|	}
 1466|  1.17k|	name_off = xsh_offset;
  ------------------
  |  |  170|  1.17k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  2.35k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 612, False: 564]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.17k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.17k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1467|       |
 1468|  1.17k|	if (fsize != SIZE_UNKNOWN && fsize < name_off) {
  ------------------
  |  |   65|  1.17k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  2.35k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1468:6): [True: 1.17k, False: 0]
  |  Branch (1468:31): [True: 21, False: 1.15k]
  ------------------
 1469|     21|		if (elf_printf(ms, ", too large section header offset %jd",
  ------------------
  |  Branch (1469:7): [True: 0, False: 21]
  ------------------
 1470|     21|		    (intmax_t)name_off) == -1)
 1471|      0|			return -1;
 1472|     21|		return 0;
 1473|     21|	}
 1474|       |
 1475|  66.8k|	for ( ; num; num--) {
  ------------------
  |  Branch (1475:10): [True: 66.5k, False: 246]
  ------------------
 1476|       |		/* Read the name of this section. */
 1477|  66.5k|		offs = name_off + xsh_name;
  ------------------
  |  |  176|  66.5k|#define xsh_name    	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  66.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (176:23): [True: 56.9k, False: 9.65k]
  |  |  ------------------
  |  |  177|  66.5k|			 ? elf_getu32(swap, sh32.sh_name)	\
  |  |  ------------------
  |  |  |  |  158|  56.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  178|  66.5k|			 : elf_getu32(swap, sh64.sh_name))
  |  |  ------------------
  |  |  |  |  158|  9.65k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1478|  66.5k|		if ((namesize = pread(fd, name, sizeof(name) - 1, offs))
  ------------------
  |  Branch (1478:7): [True: 42, False: 66.5k]
  ------------------
 1479|  66.5k|		    == -1) {
 1480|     42|			if (elf_printf(ms, 
  ------------------
  |  Branch (1480:8): [True: 0, False: 42]
  ------------------
 1481|     42|			    ", can't read name of elf section at %jd",
 1482|     42|			    (intmax_t)offs) == -1)
 1483|      0|				return -1;
 1484|     42|			return 0;
 1485|     42|		}
 1486|  66.5k|		name[namesize] = '\0';
 1487|  66.5k|		if (strcmp(name, ".debug_info") == 0) {
  ------------------
  |  Branch (1487:7): [True: 196, False: 66.3k]
  ------------------
 1488|    196|			has_debug_info = 1;
 1489|    196|			stripped = 0;
 1490|    196|		}
 1491|       |
 1492|  66.5k|		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  161|  66.5k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  66.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 56.9k, False: 9.60k]
  |  |  ------------------
  |  |  162|  66.5k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  460|  56.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  66.5k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  460|  9.60k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  164|  66.5k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  66.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 56.9k, False: 9.60k]
  |  |  ------------------
  |  |  165|  66.5k|			 ? sizeof(sh32)				\
  |  |  166|  66.5k|			 : sizeof(sh64))
  ------------------
  |  Branch (1492:7): [True: 575, False: 65.9k]
  ------------------
 1493|  66.5k|		    CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  460|   133k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 56.9k, False: 9.60k]
  |  |  ------------------
  ------------------
 1494|    575|			if (elf_printf(ms, ", can't read elf section at %jd",
  ------------------
  |  Branch (1494:8): [True: 0, False: 575]
  ------------------
 1495|    575|			    (intmax_t)off) == -1)
 1496|      0|				return -1;
 1497|    575|			return 0;
 1498|    575|		}
 1499|  65.9k|		off += size;
 1500|       |
 1501|       |		/* Things we can determine before we seek */
 1502|  65.9k|		switch (xsh_type) {
  ------------------
  |  |  173|  65.9k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  65.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 56.5k, False: 9.39k]
  |  |  ------------------
  |  |  174|  65.9k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  56.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  65.9k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  9.39k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1503|  1.83k|		case SHT_SYMTAB:
  ------------------
  |  |  141|  1.83k|#define	SHT_SYMTAB	2
  ------------------
  |  Branch (1503:3): [True: 1.83k, False: 64.1k]
  ------------------
 1504|       |#if 0
 1505|       |		case SHT_DYNSYM:
 1506|       |#endif
 1507|  1.83k|			stripped = 0;
 1508|  1.83k|			break;
 1509|  64.1k|		default:
  ------------------
  |  Branch (1509:3): [True: 64.1k, False: 1.83k]
  ------------------
 1510|  64.1k|			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |   65|  64.1k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|   128k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |  170|  64.1k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|   128k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 54.8k, False: 9.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  64.1k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  64.1k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1510:8): [True: 64.1k, False: 0]
  |  Branch (1510:33): [True: 34.0k, False: 30.0k]
  ------------------
 1511|       |				/* Perhaps warn here */
 1512|  34.0k|				continue;
 1513|  34.0k|			}
 1514|  30.0k|			break;
 1515|  65.9k|		}
 1516|       |
 1517|       |
 1518|       |		/* Things we can determine when we seek */
 1519|  31.8k|		switch (xsh_type) {
  ------------------
  |  |  173|  31.8k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 27.4k, False: 4.43k]
  |  |  ------------------
  |  |  174|  31.8k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  27.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  31.8k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  4.43k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1520|  2.56k|		case SHT_NOTE:
  ------------------
  |  |  142|  2.56k|#define	SHT_NOTE	7
  ------------------
  |  Branch (1520:3): [True: 2.56k, False: 29.3k]
  ------------------
 1521|  2.56k|			if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
  ------------------
  |  |  460|  10.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 1.69k, False: 870]
  |  |  |  Branch (460:25): [True: 1.69k, False: 870]
  |  |  ------------------
  ------------------
  |  Branch (1521:8): [True: 123, False: 2.44k]
  ------------------
 1522|  2.56k|			    CAST(uintmax_t, fsize)) {
  ------------------
  |  |  460|  2.56k|#define CAST(T, b)	((T)(b))
  ------------------
 1523|    123|				if (elf_printf(ms,
  ------------------
  |  Branch (1523:9): [True: 0, False: 123]
  ------------------
 1524|    123|				    ", note offset/size %#" INTMAX_T_FORMAT
 1525|    123|				    "x+%#" INTMAX_T_FORMAT "x exceeds"
 1526|    123|				    " file size %#" INTMAX_T_FORMAT "x",
 1527|    123|				    CAST(uintmax_t, xsh_offset),
  ------------------
  |  |  460|    246|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 64, False: 59]
  |  |  ------------------
  ------------------
 1528|    123|				    CAST(uintmax_t, xsh_size),
  ------------------
  |  |  460|    246|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 64, False: 59]
  |  |  ------------------
  ------------------
 1529|    123|				    CAST(uintmax_t, fsize)) == -1)
  ------------------
  |  |  460|    123|#define CAST(T, b)	((T)(b))
  ------------------
 1530|      0|					return -1;
 1531|    123|				return 0;
 1532|    123|			}
 1533|  2.44k|			if (xsh_size > ms->elf_shsize_max) {
  ------------------
  |  |  167|  2.44k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  4.89k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.63k, False: 811]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.44k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.44k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1533:8): [True: 37, False: 2.40k]
  ------------------
 1534|     37|				file_error(ms, errno, "Note section size too "
 1535|     37|				    "big (%ju > %zu)", (uintmax_t)xsh_size,
  ------------------
  |  |  167|     37|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|     74|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|     37|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|     37|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1536|     37|				    ms->elf_shsize_max);
 1537|     37|				return -1;
 1538|     37|			}
 1539|  2.40k|			if ((nbuf = malloc(xsh_size)) == NULL) {
  ------------------
  |  |  167|  2.40k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  4.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.63k, False: 774]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.40k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.40k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1539:8): [True: 0, False: 2.40k]
  ------------------
 1540|      0|				file_error(ms, errno, "Cannot allocate memory"
 1541|      0|				    " for note");
 1542|      0|				return -1;
 1543|      0|			}
 1544|  2.40k|			offs = xsh_offset;
  ------------------
  |  |  170|  2.40k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  4.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.63k, False: 774]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  2.40k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  2.40k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1545|  2.40k|			if (pread(fd, nbuf, xsh_size, offs) <
  ------------------
  |  |  167|  2.40k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  4.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.63k, False: 774]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.40k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.40k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1545:8): [True: 24, False: 2.38k]
  ------------------
 1546|  2.40k|			    CAST(ssize_t, xsh_size)) {
  ------------------
  |  |  460|  4.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 1.63k, False: 774]
  |  |  ------------------
  ------------------
 1547|     24|				free(nbuf);
 1548|     24|				if (elf_printf(ms,
  ------------------
  |  Branch (1548:9): [True: 0, False: 24]
  ------------------
 1549|     24|				    ", can't read elf note at %jd",
 1550|     24|				    (intmax_t)offs) == -1)
 1551|      0|					return -1;
 1552|     24|				return 0;
 1553|     24|			}
 1554|       |
 1555|  2.38k|			noff = 0;
 1556|  6.29k|			for (;;) {
 1557|  6.29k|				if (noff >= CAST(off_t, xsh_size))
  ------------------
  |  |  460|  12.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 3.34k, False: 2.95k]
  |  |  ------------------
  ------------------
  |  Branch (1557:9): [True: 2.02k, False: 4.27k]
  ------------------
 1558|  2.02k|					break;
 1559|  4.27k|				noff = donote(ms, nbuf, CAST(size_t, noff),
  ------------------
  |  |  460|  4.27k|#define CAST(T, b)	((T)(b))
  ------------------
 1560|  4.27k|				    xsh_size, clazz, swap, 4, flags, notecount,
  ------------------
  |  |  167|  4.27k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  8.55k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.85k, False: 2.42k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  4.27k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  4.27k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1561|  4.27k|				    fd, 0, 0, 0);
 1562|  4.27k|				if (noff == 0)
  ------------------
  |  Branch (1562:9): [True: 364, False: 3.91k]
  ------------------
 1563|    364|					break;
 1564|  4.27k|			}
 1565|  2.38k|			free(nbuf);
 1566|  2.38k|			break;
 1567|  2.62k|		case SHT_SUNW_cap:
  ------------------
  |  |  144|  2.62k|#define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
  ------------------
  |  Branch (1567:3): [True: 2.62k, False: 29.2k]
  ------------------
 1568|  2.62k|			switch (mach) {
 1569|    263|			case EM_SPARC:
  ------------------
  |  |  133|    263|#define	EM_SPARC	2
  ------------------
  |  Branch (1569:4): [True: 263, False: 2.36k]
  ------------------
 1570|  1.05k|			case EM_SPARCV9:
  ------------------
  |  |  136|  1.05k|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1570:4): [True: 788, False: 1.83k]
  ------------------
 1571|  1.34k|			case EM_IA_64:
  ------------------
  |  |  137|  1.34k|#define	EM_IA_64	50
  ------------------
  |  Branch (1571:4): [True: 291, False: 2.33k]
  ------------------
 1572|  2.12k|			case EM_386:
  ------------------
  |  |  134|  2.12k|#define	EM_386		3
  ------------------
  |  Branch (1572:4): [True: 781, False: 1.84k]
  ------------------
 1573|  2.28k|			case EM_AMD64:
  ------------------
  |  |  138|  2.28k|#define	EM_AMD64	62
  ------------------
  |  Branch (1573:4): [True: 158, False: 2.46k]
  ------------------
 1574|  2.28k|				break;
 1575|    344|			default:
  ------------------
  |  Branch (1575:4): [True: 344, False: 2.28k]
  ------------------
 1576|    344|				goto skip;
 1577|  2.62k|			}
 1578|       |
 1579|  2.28k|			if (nbadcap > 5)
  ------------------
  |  Branch (1579:8): [True: 589, False: 1.69k]
  ------------------
 1580|    589|				break;
 1581|  1.69k|			if (lseek(fd, xsh_offset, SEEK_SET)
  ------------------
  |  |  170|  1.69k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  3.38k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 898, False: 794]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.69k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.69k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1581:8): [True: 4, False: 1.68k]
  ------------------
 1582|  1.69k|			    == CAST(off_t, -1)) {
  ------------------
  |  |  460|  1.69k|#define CAST(T, b)	((T)(b))
  ------------------
 1583|      4|				file_badseek(ms);
 1584|      4|				return -1;
 1585|      4|			}
 1586|  1.68k|			coff = 0;
 1587|  8.27k|			for (;;) {
 1588|  8.27k|				Elf32_Cap cap32;
 1589|  8.27k|				Elf64_Cap cap64;
 1590|  8.27k|				cap32.c_un.c_val = 0;
 1591|  8.27k|				cap64.c_un.c_val = 0;
 1592|  8.27k|				char cbuf[/*CONSTCOND*/
 1593|  8.27k|				    MAX(sizeof(cap32), sizeof(cap64))];
 1594|  8.27k|				if ((coff += xcap_sizeof) >
  ------------------
  |  |  240|  8.27k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  8.27k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 5.28k, False: 2.99k]
  |  |  ------------------
  |  |  241|  8.27k|			 ? sizeof(cap32)			\
  |  |  242|  8.27k|			 : sizeof(cap64))
  ------------------
  |  Branch (1594:9): [True: 723, False: 7.55k]
  ------------------
 1595|  8.27k|				    CAST(off_t, xsh_size))
  ------------------
  |  |  460|  16.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 5.28k, False: 2.99k]
  |  |  ------------------
  ------------------
 1596|    723|					break;
 1597|  7.55k|				if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
  ------------------
  |  |  460|  15.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 4.89k, False: 2.65k]
  |  |  ------------------
  ------------------
  |  Branch (1597:9): [True: 104, False: 7.45k]
  ------------------
 1598|  7.55k|				    CAST(ssize_t, xcap_sizeof)) {
  ------------------
  |  |  460|  15.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 4.89k, False: 2.65k]
  |  |  ------------------
  ------------------
 1599|    104|					file_badread(ms);
 1600|    104|					return -1;
 1601|    104|				}
 1602|  7.45k|				if (cbuf[0] == 'A') {
  ------------------
  |  Branch (1602:9): [True: 616, False: 6.83k]
  ------------------
 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|    616|					break;
 1631|    616|				}
 1632|  6.83k|				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  237|  6.83k|#define xcap_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.83k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (237:20): [True: 4.53k, False: 2.30k]
  |  |  ------------------
  |  |  238|  6.83k|			 ? CAST(void *, &cap32)			\
  |  |  ------------------
  |  |  |  |  460|  4.53k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  239|  6.83k|			 : CAST(void *, &cap64))
  |  |  ------------------
  |  |  |  |  460|  2.30k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  240|  6.83k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.83k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 4.53k, False: 2.30k]
  |  |  ------------------
  |  |  241|  6.83k|			 ? sizeof(cap32)			\
  |  |  242|  6.83k|			 : sizeof(cap64))
  ------------------
 1633|  6.83k|				switch (xcap_tag) {
  ------------------
  |  |  243|  6.83k|#define xcap_tag	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.83k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (243:19): [True: 4.53k, False: 2.30k]
  |  |  ------------------
  |  |  244|  6.83k|			 ? elf_getu32(swap, cap32.c_tag)	\
  |  |  ------------------
  |  |  |  |  158|  4.53k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  245|  6.83k|			 : elf_getu64(swap, cap64.c_tag))
  |  |  ------------------
  |  |  |  |  159|  2.30k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1634|  3.21k|				case CA_SUNW_NULL:
  ------------------
  |  |  424|  3.21k|#define	CA_SUNW_NULL	0
  ------------------
  |  Branch (1634:5): [True: 3.21k, False: 3.62k]
  ------------------
 1635|  3.21k|					break;
 1636|  1.24k|				case CA_SUNW_HW_1:
  ------------------
  |  |  425|  1.24k|#define	CA_SUNW_HW_1	1
  ------------------
  |  Branch (1636:5): [True: 1.24k, False: 5.59k]
  ------------------
 1637|  1.24k|					cap_hw1 |= xcap_val;
  ------------------
  |  |  246|  1.24k|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.24k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 814, False: 428]
  |  |  ------------------
  |  |  247|  1.24k|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    814|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|  1.24k|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    428|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1638|  1.24k|					break;
 1639|  1.17k|				case CA_SUNW_SF_1:
  ------------------
  |  |  426|  1.17k|#define	CA_SUNW_SF_1	2
  ------------------
  |  Branch (1639:5): [True: 1.17k, False: 5.65k]
  ------------------
 1640|  1.17k|					cap_sf1 |= xcap_val;
  ------------------
  |  |  246|  1.17k|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.17k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 781, False: 398]
  |  |  ------------------
  |  |  247|  1.17k|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    781|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|  1.17k|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    398|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1641|  1.17k|					break;
 1642|  1.20k|				default:
  ------------------
  |  Branch (1642:5): [True: 1.20k, False: 5.63k]
  ------------------
 1643|  1.20k|					if (elf_printf(ms,
  ------------------
  |  Branch (1643:10): [True: 0, False: 1.20k]
  ------------------
 1644|  1.20k|					    ", with unknown capability "
 1645|  1.20k|					    "%#" INT64_T_FORMAT "x = %#"
 1646|  1.20k|					    INT64_T_FORMAT "x",
 1647|  1.20k|					    CAST(unsigned long long, xcap_tag),
  ------------------
  |  |  460|  2.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 633, False: 567]
  |  |  ------------------
  ------------------
 1648|  1.20k|					    CAST(unsigned long long, xcap_val))
  ------------------
  |  |  460|  2.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 633, False: 567]
  |  |  ------------------
  ------------------
 1649|  1.20k|					    == -1)
 1650|      0|						return -1;
 1651|  1.20k|					if (nbadcap++ > 2)
  ------------------
  |  Branch (1651:10): [True: 245, False: 955]
  ------------------
 1652|    245|						goto skip;
 1653|    955|					break;
 1654|  6.83k|				}
 1655|  6.83k|			}
 1656|       |			/*FALLTHROUGH*/
 1657|  1.92k|		skip:
 1658|  28.6k|		default:
  ------------------
  |  Branch (1658:3): [True: 26.7k, False: 5.19k]
  ------------------
 1659|  28.6k|			break;
 1660|  31.8k|		}
 1661|  31.8k|	}
 1662|       |
 1663|    246|	if (has_debug_info) {
  ------------------
  |  Branch (1663:6): [True: 1, False: 245]
  ------------------
 1664|      1|		if (elf_printf(ms, ", with debug_info") == -1)
  ------------------
  |  Branch (1664:7): [True: 0, False: 1]
  ------------------
 1665|      0|			return -1;
 1666|      1|	}
 1667|    246|	if (elf_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
  ------------------
  |  Branch (1667:6): [True: 0, False: 246]
  |  Branch (1667:37): [True: 240, False: 6]
  ------------------
 1668|      0|		return -1;
 1669|    246|	if (cap_hw1) {
  ------------------
  |  Branch (1669:6): [True: 107, False: 139]
  ------------------
 1670|    107|		const cap_desc_t *cdp;
 1671|    107|		switch (mach) {
 1672|      4|		case EM_SPARC:
  ------------------
  |  |  133|      4|#define	EM_SPARC	2
  ------------------
  |  Branch (1672:3): [True: 4, False: 103]
  ------------------
 1673|      4|		case EM_SPARC32PLUS:
  ------------------
  |  |  135|      4|#define	EM_SPARC32PLUS	18
  ------------------
  |  Branch (1673:3): [True: 0, False: 107]
  ------------------
 1674|     97|		case EM_SPARCV9:
  ------------------
  |  |  136|     97|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1674:3): [True: 93, False: 14]
  ------------------
 1675|     97|			cdp = cap_desc_sparc;
 1676|     97|			break;
 1677|      4|		case EM_386:
  ------------------
  |  |  134|      4|#define	EM_386		3
  ------------------
  |  Branch (1677:3): [True: 4, False: 103]
  ------------------
 1678|      6|		case EM_IA_64:
  ------------------
  |  |  137|      6|#define	EM_IA_64	50
  ------------------
  |  Branch (1678:3): [True: 2, False: 105]
  ------------------
 1679|     10|		case EM_AMD64:
  ------------------
  |  |  138|     10|#define	EM_AMD64	62
  ------------------
  |  Branch (1679:3): [True: 4, False: 103]
  ------------------
 1680|     10|			cdp = cap_desc_386;
 1681|     10|			break;
 1682|      0|		default:
  ------------------
  |  Branch (1682:3): [True: 0, False: 107]
  ------------------
 1683|      0|			cdp = NULL;
 1684|      0|			break;
 1685|    107|		}
 1686|    107|		if (elf_printf(ms, ", uses") == -1)
  ------------------
  |  Branch (1686:7): [True: 0, False: 107]
  ------------------
 1687|      0|			return -1;
 1688|    107|		if (cdp) {
  ------------------
  |  Branch (1688:7): [True: 107, False: 0]
  ------------------
 1689|  1.42k|			while (cdp->cd_name) {
  ------------------
  |  Branch (1689:11): [True: 1.31k, False: 107]
  ------------------
 1690|  1.31k|				if (cap_hw1 & cdp->cd_mask) {
  ------------------
  |  Branch (1690:9): [True: 651, False: 666]
  ------------------
 1691|    651|					if (elf_printf(ms,
  ------------------
  |  Branch (1691:10): [True: 0, False: 651]
  ------------------
 1692|    651|					    " %s", cdp->cd_name) == -1)
 1693|      0|						return -1;
 1694|    651|					cap_hw1 &= ~cdp->cd_mask;
 1695|    651|				}
 1696|  1.31k|				++cdp;
 1697|  1.31k|			}
 1698|    107|			if (cap_hw1)
  ------------------
  |  Branch (1698:8): [True: 103, False: 4]
  ------------------
 1699|    103|				if (elf_printf(ms,
  ------------------
  |  Branch (1699:9): [True: 0, False: 103]
  ------------------
 1700|    103|				    " unknown hardware capability %#"
 1701|    103|				    INT64_T_FORMAT "x",
 1702|    103|				    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  460|    103|#define CAST(T, b)	((T)(b))
  ------------------
 1703|      0|					return -1;
 1704|    107|		} 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)
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1708|      0|				return -1;
 1709|      0|		}
 1710|    107|	}
 1711|    246|	if (cap_sf1) {
  ------------------
  |  Branch (1711:6): [True: 105, False: 141]
  ------------------
 1712|    105|		if (cap_sf1 & SF1_SUNW_FPUSED) {
  ------------------
  |  |  430|    105|#define	SF1_SUNW_FPUSED	0x02
  ------------------
  |  Branch (1712:7): [True: 51, False: 54]
  ------------------
 1713|     51|			if (elf_printf(ms,
  ------------------
  |  Branch (1713:8): [True: 0, False: 51]
  ------------------
 1714|     51|			    (cap_sf1 & SF1_SUNW_FPKNWN)
  ------------------
  |  |  429|     51|#define	SF1_SUNW_FPKNWN	0x01
  ------------------
  |  Branch (1714:8): [True: 36, False: 15]
  ------------------
 1715|     51|			    ? ", uses frame pointer"
 1716|     51|			    : ", not known to use frame pointer") == -1)
 1717|      0|				return -1;
 1718|     51|		}
 1719|    105|		cap_sf1 &= ~SF1_SUNW_MASK;
  ------------------
  |  |  431|    105|#define	SF1_SUNW_MASK	0x03
  ------------------
 1720|    105|		if (cap_sf1)
  ------------------
  |  Branch (1720:7): [True: 104, False: 1]
  ------------------
 1721|    104|			if (elf_printf(ms,
  ------------------
  |  Branch (1721:8): [True: 0, False: 104]
  ------------------
 1722|    104|			    ", with unknown software capability %#"
 1723|    104|			    INT64_T_FORMAT "x",
 1724|    104|			    CAST(unsigned long long, cap_sf1)) == -1)
  ------------------
  |  |  460|    104|#define CAST(T, b)	((T)(b))
  ------------------
 1725|      0|				return -1;
 1726|    105|	}
 1727|    246|	return 0;
 1728|    246|}
readelf.c:getu64:
  134|  95.4k|{
  135|  95.4k|	union {
  136|  95.4k|		uint64_t ui;
  137|  95.4k|		char c[8];
  138|  95.4k|	} retval, tmpval;
  139|       |
  140|  95.4k|	if (swap) {
  ------------------
  |  Branch (140:6): [True: 57.4k, False: 38.0k]
  ------------------
  141|  57.4k|		tmpval.ui = value;
  142|       |
  143|  57.4k|		retval.c[0] = tmpval.c[7];
  144|  57.4k|		retval.c[1] = tmpval.c[6];
  145|  57.4k|		retval.c[2] = tmpval.c[5];
  146|  57.4k|		retval.c[3] = tmpval.c[4];
  147|  57.4k|		retval.c[4] = tmpval.c[3];
  148|  57.4k|		retval.c[5] = tmpval.c[2];
  149|  57.4k|		retval.c[6] = tmpval.c[1];
  150|  57.4k|		retval.c[7] = tmpval.c[0];
  151|       |
  152|  57.4k|		return retval.ui;
  153|  57.4k|	} else
  154|  38.0k|		return value;
  155|  95.4k|}
readelf.c:elf_printf:
   72|  17.0k|{
   73|  17.0k|	va_list ap;
   74|  17.0k|	int rv;
   75|       |
   76|  17.0k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  17.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  17.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  17.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (76:6): [True: 0, False: 17.0k]
  ------------------
   77|      0|		return 1;
   78|       |
   79|  17.0k|	va_start(ap, fmt);
   80|  17.0k|	rv = file_vprintf(ms, fmt, ap);
   81|       |	va_end(ap);
   82|  17.0k|	return rv;
   83|  17.0k|}

file_softmagic:
  130|  17.7k|{
  131|  17.7k|	struct mlist *ml;
  132|  17.7k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  133|  17.7k|	uint16_t nc, ic;
  134|       |
  135|  17.7k|	if (name_count == NULL) {
  ------------------
  |  Branch (135:6): [True: 17.7k, False: 0]
  ------------------
  136|  17.7k|		nc = 0;
  137|  17.7k|		name_count = &nc;
  138|  17.7k|	}
  139|  17.7k|	if (indir_count == NULL) {
  ------------------
  |  Branch (139:6): [True: 17.7k, False: 0]
  ------------------
  140|  17.7k|		ic = 0;
  141|  17.7k|		indir_count = &ic;
  142|  17.7k|	}
  143|       |
  144|  35.2k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (144:32): [True: 17.7k, False: 17.5k]
  ------------------
  145|  17.7k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  146|  17.7k|		    0, mode, text, 0, indir_count, name_count,
  147|  17.7k|		    &printed_something, &need_separator, &firstline,
  148|  17.7k|		    NULL, NULL);
  149|  17.7k|		switch (ret) {
  150|    190|		case -1:
  ------------------
  |  Branch (150:3): [True: 190, False: 17.5k]
  ------------------
  151|    190|			return ret;
  152|  5.43k|		case 0:
  ------------------
  |  Branch (152:3): [True: 5.43k, False: 12.2k]
  ------------------
  153|  5.43k|			continue;
  154|  12.1k|		default:
  ------------------
  |  Branch (154:3): [True: 12.1k, False: 5.62k]
  ------------------
  155|  12.1k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  12.1k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (155:8): [True: 0, False: 12.1k]
  ------------------
  156|      0|				return ret;
  157|  12.1k|			rv = ret;
  158|  12.1k|			break;
  159|  17.7k|		}
  160|  17.7k|	}
  161|       |
  162|  17.5k|	return rv;
  163|  17.7k|}
softmagic.c:match:
  222|   102k|{
  223|   102k|	uint32_t magindex = 0;
  224|   102k|	unsigned int cont_level = 0;
  225|   102k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  226|   102k|	int returnvalv = 0, e;
  227|   102k|	struct buffer bb;
  228|   102k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|   102k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|   102k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|   102k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|   102k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   102k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|   102k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  229|       |
  230|   102k|	(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|   102k|	if (returnval == NULL)
  ------------------
  |  Branch (235:6): [True: 36.1k, False: 66.6k]
  ------------------
  236|  36.1k|		returnval = &returnvalv;
  237|   102k|	if (found_match == NULL)
  ------------------
  |  Branch (237:6): [True: 36.1k, False: 66.6k]
  ------------------
  238|  36.1k|		found_match = &found_matchv;
  239|       |
  240|   102k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (240:6): [True: 0, False: 102k]
  ------------------
  241|      0|		return -1;
  242|       |
  243|   139M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (243:21): [True: 139M, False: 99.7k]
  ------------------
  244|   139M|		int flush = 0;
  245|   139M|		struct magic *m = &magic[magindex];
  246|   139M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  247|       |
  248|   139M|		if (m->type != FILE_NAME)
  ------------------
  |  |  298|   139M|#define				FILE_NAME		45
  ------------------
  |  Branch (248:7): [True: 139M, False: 66.6k]
  ------------------
  249|   139M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  318|   278M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  258|   278M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (318:3): [True: 84.8M, False: 54.6M]
  |  |  ------------------
  |  |  319|   139M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  266|   194M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (319:3): [True: 35.8k, False: 54.6M]
  |  |  ------------------
  |  |  320|   139M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  271|   194M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (320:3): [True: 0, False: 54.6M]
  |  |  ------------------
  |  |  321|   139M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  272|   194M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (321:3): [True: 71.7k, False: 54.5M]
  |  |  ------------------
  |  |  322|   139M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  270|   194M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (322:3): [True: 2.85M, False: 51.6M]
  |  |  ------------------
  |  |  323|   139M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  273|   191M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (323:3): [True: 9.52M, False: 42.1M]
  |  |  ------------------
  |  |  324|   139M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  294|   181M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (324:3): [True: 0, False: 42.1M]
  |  |  ------------------
  |  |  325|   139M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  298|   181M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (325:3): [True: 0, False: 42.1M]
  |  |  ------------------
  |  |  326|   139M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  299|   181M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (326:3): [True: 0, False: 42.1M]
  |  |  ------------------
  |  |  327|   278M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  314|  42.1M|#define				FILE_OCTAL		61
  |  |  ------------------
  |  |  |  Branch (327:3): [True: 0, False: 42.1M]
  |  |  ------------------
  ------------------
  250|  97.3M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  251|  97.3M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  390|  12.9M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  250|  12.9M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  410|  12.9M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  12.9M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  409|  12.9M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  12.9M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  410|  12.9M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  403|  12.9M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (251:10): [True: 12.9M, False: 84.3M]
  |  Branch (251:18): [True: 520k, False: 12.4M]
  ------------------
  252|  96.7M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  390|  84.3M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  250|  84.3M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  410|  84.3M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  84.3M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  409|  84.3M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  84.3M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  409|  84.3M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  403|  84.3M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (252:10): [True: 84.3M, False: 12.4M]
  |  Branch (252:19): [True: 4.46M, False: 79.8M]
  ------------------
  253|   134M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (253:7): [True: 17.8M, False: 116M]
  ------------------
  254|   139M|flush:
  255|       |			/* Skip sub-tests */
  256|   625M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (256:11): [True: 625M, False: 5.07k]
  ------------------
  257|   625M|			    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (257:8): [True: 485M, False: 139M]
  ------------------
  258|   485M|				magindex++;
  259|   485M|			}
  260|   139M|			cont_level = 0;
  261|   139M|			continue; /* Skip to next top-level test*/
  262|  22.8M|		}
  263|       |
  264|   116M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1) {
  ------------------
  |  Branch (264:7): [True: 92.3k, False: 116M]
  ------------------
  265|  92.3k|			if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  183|  92.3k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  92.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (265:8): [True: 0, False: 92.3k]
  ------------------
  266|      0|				continue;
  267|  92.3k|			else
  268|  92.3k|				goto flush;
  269|  92.3k|		}
  270|   116M|		ms->line = m->lineno;
  271|       |
  272|       |		/* if main entry matches, print it... */
  273|   116M|		switch (mget(ms, m, b, &bb, offset, cont_level,
  274|   116M|		    mode, text, flip, indir_count, name_count,
  275|   116M|		    printed_something, need_separator, firstline, returnval,
  276|   116M|		    found_match))
  277|   116M|		{
  278|     57|		case -1:
  ------------------
  |  Branch (278:3): [True: 57, False: 116M]
  ------------------
  279|     57|			return -1;
  280|  17.4M|		case 0:
  ------------------
  |  Branch (280:3): [True: 17.4M, False: 99.1M]
  ------------------
  281|  17.4M|			flush = m->reln != '!';
  282|  17.4M|			break;
  283|  99.1M|		default:
  ------------------
  |  Branch (283:3): [True: 99.1M, False: 17.4M]
  ------------------
  284|  99.1M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  294|  99.1M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (284:8): [True: 0, False: 99.1M]
  ------------------
  285|      0|				*found_match = 1;
  286|      0|				*returnval = 1;
  287|      0|			}
  288|       |
  289|  99.1M|			switch (magiccheck(ms, m, m_rxcomp)) {
  290|      0|			case -1:
  ------------------
  |  Branch (290:4): [True: 0, False: 99.1M]
  ------------------
  291|      0|				return -1;
  292|  98.6M|			case 0:
  ------------------
  |  Branch (292:4): [True: 98.6M, False: 453k]
  ------------------
  293|  98.6M|				flush++;
  294|  98.6M|				break;
  295|   453k|			default:
  ------------------
  |  Branch (295:4): [True: 453k, False: 98.6M]
  ------------------
  296|   453k|				flush = 0;
  297|   453k|				break;
  298|  99.1M|			}
  299|  99.1M|			break;
  300|   116M|		}
  301|   116M|		if (flush) {
  ------------------
  |  Branch (301:7): [True: 116M, False: 453k]
  ------------------
  302|       |			/*
  303|       |			 * main entry didn't match,
  304|       |			 * flush its continuations
  305|       |			 */
  306|   116M|			goto flush;
  307|   116M|		}
  308|       |
  309|   453k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (309:7): [True: 0, False: 453k]
  ------------------
  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|   453k|		if (*m->desc) {
  ------------------
  |  Branch (323:7): [True: 30.8k, False: 423k]
  ------------------
  324|  30.8k|			*found_match = 1;
  325|  30.8k|			if (print) {
  ------------------
  |  Branch (325:8): [True: 30.8k, False: 0]
  ------------------
  326|  30.8k|				*returnval = 1;
  327|  30.8k|				*need_separator = 1;
  328|  30.8k|				*printed_something = 1;
  329|  30.8k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (329:9): [True: 0, False: 30.8k]
  ------------------
  330|      0|					return -1;
  331|  30.8k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (331:9): [True: 0, False: 30.8k]
  ------------------
  332|      0|					return -1;
  333|  30.8k|			}
  334|  30.8k|		}
  335|       |
  336|   453k|		switch (moffset(ms, m, bb.flen, offset,
  337|   453k|		    &ms->c.li[cont_level].off)) {
  338|  26.1k|		case -1:
  ------------------
  |  Branch (338:3): [True: 26.1k, False: 427k]
  ------------------
  339|  26.1k|		case 0:
  ------------------
  |  Branch (339:3): [True: 0, False: 453k]
  ------------------
  340|  26.1k|			goto flush;
  341|   427k|		default:
  ------------------
  |  Branch (341:3): [True: 427k, False: 26.1k]
  ------------------
  342|   427k|			break;
  343|   453k|		}
  344|       |
  345|       |		/* and any continuations that match */
  346|   427k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (346:7): [True: 0, False: 427k]
  ------------------
  347|      0|			return -1;
  348|       |
  349|  7.18M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (349:10): [True: 7.09M, False: 94.7k]
  ------------------
  350|  7.09M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (350:7): [True: 6.76M, False: 330k]
  ------------------
  351|  6.76M|			m = &magic[++magindex];
  352|  6.76M|			m_rxcomp = &magic_rxcomp[magindex];
  353|  6.76M|			ms->line = m->lineno; /* for messages */
  354|       |
  355|  6.76M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (355:8): [True: 4.96M, False: 1.80M]
  ------------------
  356|  4.96M|				continue;
  357|  1.80M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (357:8): [True: 151k, False: 1.64M]
  ------------------
  358|       |				/*
  359|       |				 * We're at the end of the level
  360|       |				 * "cont_level" continuations.
  361|       |				 */
  362|   151k|				cont_level = m->cont_level;
  363|   151k|			}
  364|  1.80M|			if (msetoffset(ms, m, &bb, b, offset, cont_level)
  ------------------
  |  Branch (364:8): [True: 135, False: 1.80M]
  ------------------
  365|  1.80M|			    == -1) {
  366|    135|				if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  183|    135|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|    135|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (366:9): [True: 0, False: 135]
  ------------------
  367|      0|					continue;
  368|    135|				else
  369|    135|					goto flush;
  370|    135|			}
  371|  1.80M|			if (m->flag & OFFADD) {
  ------------------
  |  |  235|  1.80M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (371:8): [True: 108k, False: 1.69M]
  ------------------
  372|   108k|				if (cont_level == 0) {
  ------------------
  |  Branch (372:9): [True: 0, False: 108k]
  ------------------
  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|   108k|				ms->offset +=
  380|   108k|				    ms->c.li[cont_level - 1].off;
  381|   108k|			}
  382|       |
  383|  1.80M|#ifdef ENABLE_CONDITIONALS
  384|  1.80M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  371|  3.60M|#define				COND_ELSE	3
  ------------------
  |  Branch (384:8): [True: 0, False: 1.80M]
  ------------------
  385|  1.80M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  370|  1.80M|#define				COND_ELIF	2
  ------------------
  |  Branch (385:8): [True: 0, False: 1.80M]
  ------------------
  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.80M|#endif
  390|  1.80M|			switch (mget(ms, m, b, &bb, offset,
  391|  1.80M|			    cont_level, mode, text, flip, indir_count,
  392|  1.80M|			    name_count, printed_something, need_separator,
  393|  1.80M|			    firstline, returnval, found_match)) {
  394|  3.00k|			case -1:
  ------------------
  |  Branch (394:4): [True: 3.00k, False: 1.79M]
  ------------------
  395|  3.00k|				return -1;
  396|   117k|			case 0:
  ------------------
  |  Branch (396:4): [True: 117k, False: 1.68M]
  ------------------
  397|   117k|				if (m->reln != '!')
  ------------------
  |  Branch (397:9): [True: 114k, False: 2.97k]
  ------------------
  398|   114k|					continue;
  399|  2.97k|				flush = 1;
  400|  2.97k|				break;
  401|  1.68M|			default:
  ------------------
  |  Branch (401:4): [True: 1.68M, False: 120k]
  ------------------
  402|  1.68M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  294|  1.68M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (402:9): [True: 14.0k, False: 1.66M]
  ------------------
  403|  14.0k|					*found_match = 1;
  404|  14.0k|					*returnval = 1;
  405|  14.0k|				}
  406|  1.68M|				flush = 0;
  407|  1.68M|				break;
  408|  1.80M|			}
  409|       |
  410|  1.68M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (410:12): [True: 2.97k, False: 1.68M]
  ------------------
  411|      0|			case -1:
  ------------------
  |  Branch (411:4): [True: 0, False: 1.68M]
  ------------------
  412|      0|				return -1;
  413|  1.25M|			case 0:
  ------------------
  |  Branch (413:4): [True: 1.25M, False: 432k]
  ------------------
  414|  1.25M|#ifdef ENABLE_CONDITIONALS
  415|  1.25M|				ms->c.li[cont_level].last_match = 0;
  416|  1.25M|#endif
  417|  1.25M|				break;
  418|   432k|			default:
  ------------------
  |  Branch (418:4): [True: 432k, False: 1.25M]
  ------------------
  419|   432k|#ifdef ENABLE_CONDITIONALS
  420|   432k|				ms->c.li[cont_level].last_match = 1;
  421|   432k|#endif
  422|   432k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  300|   432k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (422:9): [True: 3.24k, False: 429k]
  ------------------
  423|  3.24k|					ms->c.li[cont_level].got_match = 0;
  424|   429k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (424:14): [True: 106k, False: 323k]
  ------------------
  425|   106k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  256|   106k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (425:10): [True: 2.71k, False: 103k]
  ------------------
  426|  2.71k|						break;
  427|   106k|				} else
  428|   323k|					ms->c.li[cont_level].got_match = 1;
  429|       |
  430|   430k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (430:9): [True: 0, False: 430k]
  ------------------
  431|   430k|				    != 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|   430k|				if (*m->desc) {
  ------------------
  |  Branch (439:9): [True: 137k, False: 292k]
  ------------------
  440|   137k|					*found_match = 1;
  441|   137k|				}
  442|   430k|				if (print && *m->desc) {
  ------------------
  |  Branch (442:9): [True: 430k, False: 0]
  |  Branch (442:18): [True: 137k, False: 292k]
  ------------------
  443|   137k|					*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|   137k|					if (!*printed_something) {
  ------------------
  |  Branch (455:10): [True: 25.3k, False: 112k]
  ------------------
  456|  25.3k|						*printed_something = 1;
  457|  25.3k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (457:11): [True: 0, False: 25.3k]
  ------------------
  458|  25.3k|						    == -1)
  459|      0|							return -1;
  460|  25.3k|					}
  461|       |					/* space if previous printed */
  462|   137k|					if (*need_separator
  ------------------
  |  Branch (462:10): [True: 129k, False: 8.28k]
  ------------------
  463|   129k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  238|   129k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (463:13): [True: 57.1k, False: 72.3k]
  ------------------
  464|  57.1k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (464:11): [True: 0, False: 57.1k]
  ------------------
  465|      0|							return -1;
  466|  57.1k|					}
  467|   137k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (467:10): [True: 0, False: 137k]
  ------------------
  468|      0|						return -1;
  469|   137k|					*need_separator = 1;
  470|   137k|				}
  471|       |
  472|   430k|				switch (moffset(ms, m, bb.flen, offset,
  473|   430k|				    &ms->c.li[cont_level].off)) {
  474|  6.42k|				case -1:
  ------------------
  |  Branch (474:5): [True: 6.42k, False: 423k]
  ------------------
  475|  6.42k|				case 0:
  ------------------
  |  Branch (475:5): [True: 0, False: 430k]
  ------------------
  476|  6.42k|					cont_level--;
  477|  6.42k|					break;
  478|   423k|				default:
  ------------------
  |  Branch (478:5): [True: 423k, False: 6.42k]
  ------------------
  479|   423k|					break;
  480|   430k|				}
  481|       |
  482|       |				/*
  483|       |				 * If we see any continuations
  484|       |				 * at a higher level,
  485|       |				 * process them.
  486|       |				 */
  487|   430k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (487:9): [True: 0, False: 430k]
  ------------------
  488|      0|					return -1;
  489|   430k|				break;
  490|  1.68M|			}
  491|  1.68M|		}
  492|   424k|		if (*printed_something) {
  ------------------
  |  Branch (492:7): [True: 116k, False: 308k]
  ------------------
  493|   116k|			*firstline = 0;
  494|   116k|		}
  495|   424k|		if (*found_match) {
  ------------------
  |  Branch (495:7): [True: 289k, False: 135k]
  ------------------
  496|   289k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   289k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (496:8): [True: 0, False: 289k]
  ------------------
  497|      0|				return *returnval;
  498|       |			// So that we print a separator
  499|   289k|			*printed_something = 0;
  500|   289k|			*firstline = 0;
  501|   289k|		}
  502|   424k|		cont_level = 0;
  503|   424k|	}
  504|  99.7k|	return *returnval;
  505|   102k|}
softmagic.c:msetoffset:
 1571|   118M|{
 1572|   118M|	int32_t offset;
 1573|   118M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  242|   118M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1573:6): [True: 353k, False: 118M]
  ------------------
 1574|   353k|		offset = -m->offset;
 1575|   353k|		if (cont_level > 0) {
  ------------------
  |  Branch (1575:7): [True: 18.8k, False: 334k]
  ------------------
 1576|  18.8k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  235|  18.8k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  236|  18.8k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1576:8): [True: 9.97k, False: 8.85k]
  ------------------
 1577|  9.97k|				goto normal;
 1578|       |#if 0
 1579|       |			file_error(ms, 0, "negative offset %d at continuation"
 1580|       |			    "level %u", m->offset, cont_level);
 1581|       |			return -1;
 1582|       |#endif
 1583|  18.8k|		}
 1584|   343k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1584:7): [True: 0, False: 343k]
  ------------------
 1585|      0|			return -1;
 1586|   343k|		if (o != 0) {
  ------------------
  |  Branch (1586:7): [True: 57, False: 343k]
  ------------------
 1587|       |			// Not yet!
 1588|     57|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1589|     57|			    "u at level %u", o, cont_level);
 1590|     57|			return -1;
 1591|     57|		}
 1592|   343k|		if (b->fd == -1) {
  ------------------
  |  Branch (1592:7): [True: 104k, False: 238k]
  ------------------
 1593|   104k|			if (CAST(size_t, m->offset) > b->flen)
  ------------------
  |  |  460|   104k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1593:8): [True: 17.7k, False: 86.6k]
  ------------------
 1594|  17.7k|				return -1;
 1595|  86.6k|			ms->eoffset = ms->offset =
 1596|  86.6k|			    CAST(int32_t, b->flen - m->offset);
  ------------------
  |  |  460|  86.6k|#define CAST(T, b)	((T)(b))
  ------------------
 1597|   238k|		} else {
 1598|   238k|			if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  460|   238k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1598:8): [True: 74.7k, False: 164k]
  ------------------
 1599|  74.7k|				return -1;
 1600|   164k|			buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1601|   164k|			ms->eoffset = ms->offset =
 1602|   164k|			    CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  460|   164k|#define CAST(T, b)	((T)(b))
  ------------------
 1603|   164k|		}
 1604|   118M|	} else {
 1605|   118M|		offset = m->offset;
 1606|   118M|		if ((m->flag & OFFPOSITIVE) || cont_level == 0) {
  ------------------
  |  |  243|   118M|#define OFFPOSITIVE	0x100	/* relative to the beginning of file */
  ------------------
  |  Branch (1606:7): [True: 86, False: 118M]
  |  Branch (1606:34): [True: 116M, False: 1.78M]
  ------------------
 1607|   116M|normal:
 1608|       |			// XXX: Pass real fd, then who frees bb?
 1609|   116M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1610|   116M|			ms->offset = offset;
 1611|   116M|			ms->eoffset = 0;
 1612|   116M|		} else {
 1613|  1.78M|			ms->offset = ms->eoffset + offset;
 1614|  1.78M|		}
 1615|   118M|	}
 1616|   118M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   118M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1616:6): [True: 0, False: 118M]
  ------------------
 1617|       |		fprintf(stderr, "bb=[%p,%" SIZE_T_FORMAT "u,%"
 1618|      0|		    SIZE_T_FORMAT "u], %d [b=%p,%"
 1619|      0|		    SIZE_T_FORMAT "u,%" SIZE_T_FORMAT "u], [o=%#x, c=%d]\n",
 1620|      0|		    bb->fbuf, bb->flen, bb->elen, ms->offset, b->fbuf,
 1621|      0|		    b->flen, b->elen, offset, cont_level);
 1622|      0|	}
 1623|   118M|	return 0;
 1624|   118M|}
softmagic.c:mget:
 1654|   118M|{
 1655|   118M|	uint32_t eoffset, offset = ms->offset;
 1656|   118M|	struct buffer sbb;
 1657|   118M|	intmax_t lhs;
 1658|   118M|	file_pushbuf_t *pb;
 1659|   118M|	int rv, oneed_separator, in_type, nfound_match;
 1660|   118M|	char *rbuf;
 1661|   118M|	union VALUETYPE *p = &ms->ms_value;
 1662|   118M|	struct mlist ml, *mlp;
 1663|   118M|	struct cont c;
 1664|   118M|	const unsigned char *s = CAST(const unsigned char *, bb->fbuf);
  ------------------
  |  |  460|   118M|#define CAST(T, b)	((T)(b))
  ------------------
 1665|   118M|	size_t nbytes = bb->flen;
 1666|       |
 1667|   118M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1667:6): [True: 55, False: 118M]
  ------------------
 1668|     55|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1669|     55|		    *indir_count);
 1670|     55|		return -1;
 1671|     55|	}
 1672|       |
 1673|   118M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1673:6): [True: 2, False: 118M]
  ------------------
 1674|      2|		file_error(ms, 0, "name use count (%hu) exceeded",
 1675|      2|		    *name_count);
 1676|      2|		return -1;
 1677|      2|	}
 1678|       |
 1679|       |
 1680|   118M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  234|   118M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1680:6): [True: 0, False: 118M]
  ------------------
 1681|   118M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  460|   118M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  460|   118M|#define CAST(T, b)	((T)(b))
  ------------------
 1682|      0|		return -1;
 1683|       |
 1684|   118M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   118M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1684:6): [True: 0, False: 118M]
  ------------------
 1685|      0|		fprintf(stderr, "mget(type=%d, flag=%#x, offset=%u, o=%"
 1686|      0|		    SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
 1687|      0|		    "u, il=%hu, nc=%hu)\n",
 1688|      0|		    m->type, m->flag, offset, o, nbytes,
 1689|      0|		    *indir_count, *name_count);
 1690|      0|		mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  461|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1691|      0|		    sizeof(union VALUETYPE));
 1692|      0|#ifndef COMPILE_ONLY
 1693|      0|		file_mdump(m);
 1694|      0|#endif
 1695|      0|	}
 1696|       |
 1697|   118M|	if (m->flag & INDIR) {
  ------------------
  |  |  234|   118M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1697:6): [True: 847k, False: 117M]
  ------------------
 1698|   847k|		intmax_t off = m->in_offset;
 1699|   847k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  363|   847k|#define				FILE_OPSIGNED	0x20
  ------------------
 1700|   847k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  365|   847k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1700:7): [True: 1.04k, False: 846k]
  ------------------
 1701|  1.04k|			uint8_t *hb;
 1702|  1.04k|			uint16_t hs;
 1703|  1.04k|			uint32_t hl;
 1704|  1.04k|			int op;
 1705|       |
 1706|  1.04k|			if (offset_oob(nbytes, offset + off, 0))
  ------------------
  |  Branch (1706:8): [True: 201, False: 847]
  ------------------
 1707|    201|				return 0;
 1708|    847|			hb = CCAST(uint8_t *, s + offset + off);
  ------------------
  |  |  462|    847|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1709|    847|			switch (op = cvt_flip(m->in_type, flip)) {
 1710|      0|			case FILE_BYTE:
  ------------------
  |  |  254|      0|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1710:4): [True: 0, False: 847]
  ------------------
 1711|      0|				if (offset_oob(nbytes, offset + off, 1))
  ------------------
  |  Branch (1711:9): [True: 0, False: 0]
  ------------------
 1712|      0|					return 0;
 1713|      0|				off = SEXT(sgn,8,hb[0]);
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1714|      0|				break;
 1715|      0|			case FILE_SHORT:
  ------------------
  |  |  255|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1715:4): [True: 0, False: 847]
  ------------------
 1716|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1716:9): [True: 0, False: 0]
  ------------------
 1717|      0|					return 0;
 1718|      0|				memcpy(&hs, hb, sizeof(hs));
 1719|      0|				off = SEXT(sgn,16,hs);
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1720|      0|				break;
 1721|      0|			case FILE_BESHORT:
  ------------------
  |  |  260|      0|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1721:4): [True: 0, False: 847]
  ------------------
 1722|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1722:9): [True: 0, False: 0]
  ------------------
 1723|      0|					return 0;
 1724|      0|				off = SEXT(sgn,16,BE16(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1725|      0|				break;
 1726|      0|			case FILE_LESHORT:
  ------------------
  |  |  263|      0|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1726:4): [True: 0, False: 847]
  ------------------
 1727|      0|				if (offset_oob(nbytes, offset + off, 2))
  ------------------
  |  Branch (1727:9): [True: 0, False: 0]
  ------------------
 1728|      0|					return 0;
 1729|      0|				off = SEXT(sgn,16,LE16(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1730|      0|				break;
 1731|      0|			case FILE_LONG:
  ------------------
  |  |  257|      0|#define				FILE_LONG		4
  ------------------
  |  Branch (1731:4): [True: 0, False: 847]
  ------------------
 1732|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1732:9): [True: 0, False: 0]
  ------------------
 1733|      0|					return 0;
 1734|      0|				memcpy(&hl, hb, sizeof(hl));
 1735|      0|				off = SEXT(sgn,32,hl);
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1736|      0|				break;
 1737|      0|			case FILE_BELONG:
  ------------------
  |  |  261|      0|#define				FILE_BELONG		8
  ------------------
  |  Branch (1737:4): [True: 0, False: 847]
  ------------------
 1738|      0|			case FILE_BEID3:
  ------------------
  |  |  292|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1738:4): [True: 0, False: 847]
  ------------------
 1739|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1739:9): [True: 0, False: 0]
  ------------------
 1740|      0|					return 0;
 1741|      0|				off = SEXT(sgn,32,BE32(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1742|      0|				break;
 1743|      0|			case FILE_LEID3:
  ------------------
  |  |  293|      0|#define				FILE_LEID3		40
  ------------------
  |  Branch (1743:4): [True: 0, False: 847]
  ------------------
 1744|    847|			case FILE_LELONG:
  ------------------
  |  |  264|    847|#define				FILE_LELONG		11
  ------------------
  |  Branch (1744:4): [True: 847, False: 0]
  ------------------
 1745|    847|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1745:9): [True: 235, False: 612]
  ------------------
 1746|    235|					return 0;
 1747|    612|				off = SEXT(sgn,32,LE32(hb));
  ------------------
  |  |  108|    612|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 612]
  |  |  ------------------
  |  |  109|    612|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    612|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    612|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1748|    612|				break;
 1749|      0|			case FILE_MELONG:
  ------------------
  |  |  276|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1749:4): [True: 0, False: 847]
  ------------------
 1750|      0|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1750:9): [True: 0, False: 0]
  ------------------
 1751|      0|					return 0;
 1752|      0|				off = SEXT(sgn,32,ME32(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1753|      0|				break;
 1754|      0|			case FILE_BEQUAD:
  ------------------
  |  |  279|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1754:4): [True: 0, False: 847]
  ------------------
 1755|      0|				if (offset_oob(nbytes, offset + off, 8))
  ------------------
  |  Branch (1755:9): [True: 0, False: 0]
  ------------------
 1756|      0|					return 0;
 1757|      0|				off = SEXT(sgn,64,BE64(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1758|      0|				break;
 1759|      0|			case FILE_LEQUAD:
  ------------------
  |  |  278|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1759:4): [True: 0, False: 847]
  ------------------
 1760|      0|				if (offset_oob(nbytes, offset + off, 8))
  ------------------
  |  Branch (1760:9): [True: 0, False: 0]
  ------------------
 1761|      0|					return 0;
 1762|      0|				off = SEXT(sgn,64,LE64(hb));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1763|      0|				break;
 1764|      0|			case FILE_OCTAL:
  ------------------
  |  |  314|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1764:4): [True: 0, False: 847]
  ------------------
 1765|      0|				if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1765:9): [True: 0, False: 0]
  ------------------
 1766|      0|					return 0;
 1767|      0|				off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1768|      0|				break;
 1769|      0|			default:
  ------------------
  |  Branch (1769:4): [True: 0, False: 847]
  ------------------
 1770|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1770:9): [True: 0, False: 0]
  ------------------
 1771|      0|					fprintf(stderr, "bad op=%d\n", op);
 1772|      0|				return 0;
 1773|    847|			}
 1774|    612|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    612|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1774:8): [True: 0, False: 612]
  ------------------
 1775|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1776|    612|		}
 1777|   847k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1778|  30.6k|		case FILE_BYTE:
  ------------------
  |  |  254|  30.6k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1778:3): [True: 30.6k, False: 816k]
  ------------------
 1779|  30.6k|			if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1779:8): [True: 69, False: 30.5k]
  ------------------
 1780|     69|				return 0;
 1781|  30.5k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  108|  30.5k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 30.5k]
  |  |  ------------------
  |  |  109|  30.5k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  30.5k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  30.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1781:8): [True: 0, False: 30.5k]
  ------------------
 1782|      0|				return 0;
 1783|  30.5k|			break;
 1784|  30.5k|		case FILE_BESHORT:
  ------------------
  |  |  260|  26.2k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1784:3): [True: 26.2k, False: 820k]
  ------------------
 1785|  26.2k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1785:8): [True: 237, False: 26.0k]
  ------------------
 1786|    237|				return 0;
 1787|  26.0k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p->hs)), off))
  ------------------
  |  |  108|  26.0k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 26.0k]
  |  |  ------------------
  |  |  109|  26.0k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  26.0k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  26.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1787:8): [True: 0, False: 26.0k]
  ------------------
 1788|      0|				return 0;
 1789|  26.0k|			break;
 1790|  26.0k|		case FILE_LESHORT:
  ------------------
  |  |  263|  12.0k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1790:3): [True: 12.0k, False: 835k]
  ------------------
 1791|  12.0k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1791:8): [True: 1.13k, False: 10.8k]
  ------------------
 1792|  1.13k|				return 0;
 1793|  10.8k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p->hs)), off))
  ------------------
  |  |  108|  10.8k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 10.8k]
  |  |  ------------------
  |  |  109|  10.8k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  10.8k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  10.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1793:8): [True: 0, False: 10.8k]
  ------------------
 1794|      0|				return 0;
 1795|  10.8k|			break;
 1796|  10.8k|		case FILE_SHORT:
  ------------------
  |  |  255|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1796:3): [True: 0, False: 847k]
  ------------------
 1797|      0|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1797:8): [True: 0, False: 0]
  ------------------
 1798|      0|				return 0;
 1799|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,16,p->h), off))
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1799:8): [True: 0, False: 0]
  ------------------
 1800|      0|				return 0;
 1801|      0|			break;
 1802|  8.46k|		case FILE_BELONG:
  ------------------
  |  |  261|  8.46k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1802:3): [True: 8.46k, False: 838k]
  ------------------
 1803|  8.59k|		case FILE_BEID3:
  ------------------
  |  |  292|  8.59k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1803:3): [True: 133, False: 846k]
  ------------------
 1804|  8.59k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1804:8): [True: 145, False: 8.45k]
  ------------------
 1805|    145|				return 0;
 1806|  8.45k|			lhs = BE32(p->hl);
  ------------------
  |  |   95|  8.45k|#define BE32(p) ( \
  |  |   96|  8.45k|    (CAST(uint32_t, (p)[0])<<24)| \
  |  |  ------------------
  |  |  |  |  460|  8.45k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|  8.45k|    (CAST(uint32_t, (p)[1])<<16)| \
  |  |  ------------------
  |  |  |  |  460|  8.45k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  8.45k|    (CAST(uint32_t, (p)[2])<<8)| \
  |  |  ------------------
  |  |  |  |  460|  8.45k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  8.45k|    (CAST(uint32_t, (p)[3])))
  |  |  ------------------
  |  |  |  |  460|  8.45k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1807|  8.45k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  292|  8.45k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1807:8): [True: 116, False: 8.33k]
  ------------------
 1808|    116|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  460|    116|#define CAST(T, b)	((T)(b))
  ------------------
 1809|  8.45k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|  8.45k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 8.45k]
  |  |  ------------------
  |  |  109|  8.45k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  8.45k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  8.45k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1809:8): [True: 583, False: 7.87k]
  ------------------
 1810|    583|				return 0;
 1811|  7.87k|			break;
 1812|   765k|		case FILE_LELONG:
  ------------------
  |  |  264|   765k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1812:3): [True: 765k, False: 82.1k]
  ------------------
 1813|   765k|		case FILE_LEID3:
  ------------------
  |  |  293|   765k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1813:3): [True: 0, False: 847k]
  ------------------
 1814|   765k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1814:8): [True: 300k, False: 464k]
  ------------------
 1815|   300k|				return 0;
 1816|   464k|			lhs = LE32(p->hl);
  ------------------
  |  |   90|   464k|#define LE32(p) ( \
  |  |   91|   464k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  460|   464k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|   464k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  460|   464k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|   464k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  460|   464k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|   464k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  460|   464k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1817|   464k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  293|   464k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1817:8): [True: 0, False: 464k]
  ------------------
 1818|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1819|   464k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|   464k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 464k]
  |  |  ------------------
  |  |  109|   464k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|   464k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|   464k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1819:8): [True: 7.95k, False: 456k]
  ------------------
 1820|  7.95k|				return 0;
 1821|   456k|			break;
 1822|   456k|		case FILE_MELONG:
  ------------------
  |  |  276|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1822:3): [True: 0, False: 847k]
  ------------------
 1823|      0|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1823:8): [True: 0, False: 0]
  ------------------
 1824|      0|				return 0;
 1825|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,32,ME32(p->hl)), off))
  ------------------
  |  |  108|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  109|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1825:8): [True: 0, False: 0]
  ------------------
 1826|      0|				return 0;
 1827|      0|			break;
 1828|  3.84k|		case FILE_LONG:
  ------------------
  |  |  257|  3.84k|#define				FILE_LONG		4
  ------------------
  |  Branch (1828:3): [True: 3.84k, False: 843k]
  ------------------
 1829|  3.84k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1829:8): [True: 401, False: 3.43k]
  ------------------
 1830|    401|				return 0;
 1831|  3.43k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  108|  3.43k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 3.43k]
  |  |  ------------------
  |  |  109|  3.43k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  3.43k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  3.43k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1831:8): [True: 141, False: 3.29k]
  ------------------
 1832|    141|				return 0;
 1833|  3.29k|			break;
 1834|  3.29k|		case FILE_LEQUAD:
  ------------------
  |  |  278|    175|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1834:3): [True: 175, False: 846k]
  ------------------
 1835|    175|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1835:8): [True: 0, False: 175]
  ------------------
 1836|      0|				return 0;
 1837|    175|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p->hq)), off))	
  ------------------
  |  |  108|    175|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 175]
  |  |  ------------------
  |  |  109|    175|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    175|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    175|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1837:8): [True: 93, False: 82]
  ------------------
 1838|     93|				return 0;
 1839|     82|			break;
 1840|    331|		case FILE_BEQUAD:
  ------------------
  |  |  279|    331|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1840:3): [True: 331, False: 846k]
  ------------------
 1841|    331|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1841:8): [True: 0, False: 331]
  ------------------
 1842|      0|				return 0;
 1843|    331|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p->hq)), off))
  ------------------
  |  |  108|    331|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 331]
  |  |  ------------------
  |  |  109|    331|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    331|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    331|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1843:8): [True: 210, False: 121]
  ------------------
 1844|    210|				return 0;
 1845|    121|			break;
 1846|    301|		case FILE_OCTAL:
  ------------------
  |  |  314|    301|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1846:3): [True: 301, False: 846k]
  ------------------
 1847|    301|			if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1847:8): [True: 116, False: 185]
  ------------------
 1848|    116|				return 0;
 1849|    185|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1849:7): [True: 66, False: 119]
  ------------------
 1850|    185|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  108|    185|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 185]
  |  |  ------------------
  |  |  109|    185|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    185|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    185|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1851|     66|				return 0;
 1852|    119|			break;
 1853|    119|		default:
  ------------------
  |  Branch (1853:3): [True: 0, False: 847k]
  ------------------
 1854|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1854:8): [True: 0, False: 0]
  ------------------
 1855|      0|				fprintf(stderr, "bad in_type=%d\n", in_type);
 1856|      0|			return 0;
 1857|   847k|		}
 1858|       |
 1859|   535k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  236|   535k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1859:7): [True: 2.08k, False: 533k]
  ------------------
 1860|  2.08k|			if (cont_level == 0) {
  ------------------
  |  Branch (1860:8): [True: 0, False: 2.08k]
  ------------------
 1861|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1861:9): [True: 0, False: 0]
  ------------------
 1862|      0|					fprintf(stderr,
 1863|      0|					    "indirect *zero* cont_level\n");
 1864|      0|				return 0;
 1865|      0|			}
 1866|  2.08k|			offset += ms->c.li[cont_level - 1].off;
 1867|  2.08k|			if (offset == 0) {
  ------------------
  |  Branch (1867:8): [True: 97, False: 1.99k]
  ------------------
 1868|     97|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     97|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1868:9): [True: 0, False: 97]
  ------------------
 1869|      0|					fprintf(stderr,
 1870|      0|					    "indirect *zero* offset\n");
 1871|     97|				return 0;
 1872|     97|			}
 1873|  1.99k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.99k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1873:8): [True: 0, False: 1.99k]
  ------------------
 1874|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1875|  1.99k|		}
 1876|   535k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1876:7): [True: 0, False: 535k]
  ------------------
 1877|      0|			return -1;
 1878|   535k|		ms->offset = offset;
 1879|       |
 1880|   535k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   535k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1880:7): [True: 0, False: 535k]
  ------------------
 1881|      0|			mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  461|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1882|      0|			    sizeof(union VALUETYPE));
 1883|      0|#ifndef COMPILE_ONLY
 1884|      0|			file_mdump(m);
 1885|      0|#endif
 1886|      0|		}
 1887|   535k|	}
 1888|       |
 1889|       |	/* Verify we have enough data to match magic type */
 1890|   118M|	switch (m->type) {
 1891|  2.01M|	case FILE_BYTE:
  ------------------
  |  |  254|  2.01M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1891:2): [True: 2.01M, False: 116M]
  ------------------
 1892|  2.01M|		if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1892:7): [True: 192k, False: 1.82M]
  ------------------
 1893|   192k|			return 0;
 1894|  1.82M|		break;
 1895|       |
 1896|  2.20M|	case FILE_SHORT:
  ------------------
  |  |  255|  2.20M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1896:2): [True: 2.20M, False: 115M]
  ------------------
 1897|  7.01M|	case FILE_BESHORT:
  ------------------
  |  |  260|  7.01M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1897:2): [True: 4.81M, False: 113M]
  ------------------
 1898|  11.7M|	case FILE_LESHORT:
  ------------------
  |  |  263|  11.7M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1898:2): [True: 4.72M, False: 113M]
  ------------------
 1899|  11.7M|		if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1899:7): [True: 955k, False: 10.7M]
  ------------------
 1900|   955k|			return 0;
 1901|  10.7M|		break;
 1902|       |
 1903|  10.7M|	case FILE_LONG:
  ------------------
  |  |  257|  1.73M|#define				FILE_LONG		4
  ------------------
  |  Branch (1903:2): [True: 1.73M, False: 116M]
  ------------------
 1904|  16.4M|	case FILE_BELONG:
  ------------------
  |  |  261|  16.4M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1904:2): [True: 14.7M, False: 103M]
  ------------------
 1905|  24.0M|	case FILE_LELONG:
  ------------------
  |  |  264|  24.0M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1905:2): [True: 7.60M, False: 110M]
  ------------------
 1906|  24.0M|	case FILE_MELONG:
  ------------------
  |  |  276|  24.0M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1906:2): [True: 34, False: 118M]
  ------------------
 1907|  24.0M|	case FILE_DATE:
  ------------------
  |  |  259|  24.0M|#define				FILE_DATE		6
  ------------------
  |  Branch (1907:2): [True: 0, False: 118M]
  ------------------
 1908|  24.0M|	case FILE_BEDATE:
  ------------------
  |  |  262|  24.0M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1908:2): [True: 438, False: 118M]
  ------------------
 1909|  24.0M|	case FILE_LEDATE:
  ------------------
  |  |  265|  24.0M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1909:2): [True: 804, False: 118M]
  ------------------
 1910|  24.0M|	case FILE_MEDATE:
  ------------------
  |  |  274|  24.0M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1910:2): [True: 42, False: 118M]
  ------------------
 1911|  24.0M|	case FILE_LDATE:
  ------------------
  |  |  267|  24.0M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1911:2): [True: 0, False: 118M]
  ------------------
 1912|  24.0M|	case FILE_BELDATE:
  ------------------
  |  |  268|  24.0M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1912:2): [True: 334, False: 118M]
  ------------------
 1913|  24.0M|	case FILE_LELDATE:
  ------------------
  |  |  269|  24.0M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1913:2): [True: 65, False: 118M]
  ------------------
 1914|  24.0M|	case FILE_MELDATE:
  ------------------
  |  |  275|  24.0M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1914:2): [True: 0, False: 118M]
  ------------------
 1915|  24.0M|	case FILE_FLOAT:
  ------------------
  |  |  286|  24.0M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1915:2): [True: 0, False: 118M]
  ------------------
 1916|  24.0M|	case FILE_BEFLOAT:
  ------------------
  |  |  287|  24.0M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1916:2): [True: 0, False: 118M]
  ------------------
 1917|  24.0M|	case FILE_LEFLOAT:
  ------------------
  |  |  288|  24.0M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1917:2): [True: 3.28k, False: 118M]
  ------------------
 1918|  24.0M|		if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1918:7): [True: 2.33M, False: 21.7M]
  ------------------
 1919|  2.33M|			return 0;
 1920|  21.7M|		break;
 1921|       |
 1922|  21.7M|	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1922:2): [True: 0, False: 118M]
  ------------------
 1923|    233|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|    233|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1923:2): [True: 233, False: 118M]
  ------------------
 1924|  1.49k|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|  1.49k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1924:2): [True: 1.26k, False: 118M]
  ------------------
 1925|  1.49k|		if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1925:7): [True: 786, False: 708]
  ------------------
 1926|    786|			return 0;
 1927|    708|		break;
 1928|       |
 1929|    708|	case FILE_LEGUID:
  ------------------
  |  |  303|      0|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1929:2): [True: 0, False: 118M]
  ------------------
 1930|    139|	case FILE_BEGUID:
  ------------------
  |  |  304|    139|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1930:2): [True: 139, False: 118M]
  ------------------
 1931|   213k|	case FILE_GUID:
  ------------------
  |  |  302|   213k|#define				FILE_GUID		49
  ------------------
  |  Branch (1931:2): [True: 213k, False: 117M]
  ------------------
 1932|   213k|		if (offset_oob(nbytes, offset, 16))
  ------------------
  |  Branch (1932:7): [True: 24.4k, False: 188k]
  ------------------
 1933|  24.4k|			return 0;
 1934|   188k|		break;
 1935|       |
 1936|  75.5M|	case FILE_STRING:
  ------------------
  |  |  258|  75.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1936:2): [True: 75.5M, False: 42.4M]
  ------------------
 1937|  75.6M|	case FILE_PSTRING:
  ------------------
  |  |  266|  75.6M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1937:2): [True: 35.3k, False: 118M]
  ------------------
 1938|  76.7M|	case FILE_SEARCH:
  ------------------
  |  |  273|  76.7M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1938:2): [True: 1.17M, False: 116M]
  ------------------
 1939|  76.7M|	case FILE_OCTAL:
  ------------------
  |  |  314|  76.7M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1939:2): [True: 0, False: 118M]
  ------------------
 1940|  76.7M|		if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1940:7): [True: 13.7M, False: 63.0M]
  ------------------
 1941|  13.7M|			return 0;
 1942|  63.0M|		break;
 1943|       |
 1944|  63.0M|	case FILE_REGEX:
  ------------------
  |  |  270|   494k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1944:2): [True: 494k, False: 117M]
  ------------------
 1945|   494k|		if (nbytes < offset)
  ------------------
  |  Branch (1945:7): [True: 1.21k, False: 493k]
  ------------------
 1946|  1.21k|			return 0;
 1947|   493k|		break;
 1948|       |
 1949|   493k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  21.6k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1949:2): [True: 21.6k, False: 118M]
  ------------------
 1950|  21.6k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  390|  21.6k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  443|  21.6k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  403|  21.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1950:7): [True: 12.4k, False: 9.25k]
  ------------------
 1951|  12.4k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  460|  12.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1952|  21.6k|		if (offset == 0)
  ------------------
  |  Branch (1952:7): [True: 1.28k, False: 20.3k]
  ------------------
 1953|  1.28k|			return 0;
 1954|       |
 1955|  20.3k|		if (nbytes < offset)
  ------------------
  |  Branch (1955:7): [True: 1.94k, False: 18.4k]
  ------------------
 1956|  1.94k|			return 0;
 1957|       |
 1958|  18.4k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1958:7): [True: 0, False: 18.4k]
  ------------------
 1959|      0|			return -1;
 1960|       |
 1961|  18.4k|		(*indir_count)++;
 1962|  18.4k|		sbb = *b;
 1963|  18.4k|		sbb.fbuf = s + offset;
 1964|  18.4k|		sbb.flen = nbytes - offset;
 1965|  18.4k|		sbb.ebuf = NULL;
 1966|  18.4k|		sbb.elen = 0;
 1967|  18.4k|		rv = -1;
 1968|  21.0k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1968:34): [True: 18.4k, False: 2.59k]
  ------------------
 1969|  18.4k|		    mlp = mlp->next)
 1970|  18.4k|		{
 1971|  18.4k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1971:8): [True: 15.8k, False: 2.59k]
  ------------------
 1972|  18.4k|			    mlp->nmagic, &sbb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  239|  18.4k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1973|  18.4k|			    name_count, printed_something, need_separator,
 1974|  18.4k|			    firstline, NULL, NULL)) != 0)
 1975|  15.8k|				break;
 1976|  18.4k|		}
 1977|  18.4k|		buffer_fini(&sbb);
 1978|       |
 1979|  18.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  18.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1979:7): [True: 0, False: 18.4k]
  ------------------
 1980|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1981|       |
 1982|  18.4k|		rbuf = file_pop_buffer(ms, pb);
 1983|  18.4k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  495|  3.40k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1983:7): [True: 3.40k, False: 15.0k]
  |  Branch (1983:23): [True: 1.72k, False: 1.67k]
  ------------------
 1984|  1.72k|			return -1;
 1985|       |
 1986|  16.7k|		if (rv == 1) {
  ------------------
  |  Branch (1986:7): [True: 14.1k, False: 2.59k]
  ------------------
 1987|  14.1k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  14.1k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  14.1k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  14.1k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  14.1k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  14.1k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  14.1k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1987:8): [True: 14.1k, False: 0]
  ------------------
 1988|  14.1k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  167|  14.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1988:8): [True: 0, False: 14.1k]
  ------------------
 1989|      0|				goto out;
 1990|  14.1k|			if (rbuf && file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1990:8): [True: 14.1k, False: 0]
  |  Branch (1990:16): [True: 127, False: 14.0k]
  ------------------
 1991|    127|out:				free(rbuf);
 1992|    127|				return -1;
 1993|    127|			}
 1994|  14.1k|		}
 1995|  16.5k|		free(rbuf);
 1996|  16.5k|		return rv;
 1997|       |
 1998|  76.6k|	case FILE_USE:
  ------------------
  |  |  299|  76.6k|#define				FILE_USE		46
  ------------------
  |  Branch (1998:2): [True: 76.6k, False: 117M]
  ------------------
 1999|  76.6k|		if (nbytes < offset)
  ------------------
  |  Branch (1999:7): [True: 9.97k, False: 66.6k]
  ------------------
 2000|  9.97k|			return 0;
 2001|  66.6k|		rbuf = m->value.s;
 2002|  66.6k|		if (*rbuf == '^') {
  ------------------
  |  Branch (2002:7): [True: 564, False: 66.0k]
  ------------------
 2003|    564|			rbuf++;
 2004|    564|			flip = !flip;
 2005|    564|		}
 2006|  66.6k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (2006:7): [True: 0, False: 66.6k]
  ------------------
 2007|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 2008|      0|			return -1;
 2009|      0|		}
 2010|  66.6k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (2010:7): [True: 0, False: 66.6k]
  ------------------
 2011|      0|			file_error(ms, errno, "can't allocate continuation");
 2012|      0|			return -1;
 2013|      0|		}
 2014|       |
 2015|  66.6k|		oneed_separator = *need_separator;
 2016|  66.6k|		if (m->flag & NOSPACE)
  ------------------
  |  |  238|  66.6k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (2016:7): [True: 12.3k, False: 54.2k]
  ------------------
 2017|  12.3k|			*need_separator = 0;
 2018|       |
 2019|  66.6k|		nfound_match = 0;
 2020|  66.6k|		(*name_count)++;
 2021|  66.6k|		eoffset = ms->eoffset;
 2022|  66.6k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 2023|  66.6k|		    offset + o, mode, text, flip, indir_count, name_count,
 2024|  66.6k|		    printed_something, need_separator, firstline, returnval,
 2025|  66.6k|		    &nfound_match);
 2026|  66.6k|		ms->ms_value.q = nfound_match;
 2027|  66.6k|		(*name_count)--;
 2028|  66.6k|		*found_match |= nfound_match;
 2029|       |
 2030|  66.6k|		restore_cont(ms, &c);
 2031|       |
 2032|  66.6k|		if (rv != 1)
  ------------------
  |  Branch (2032:7): [True: 6.36k, False: 60.2k]
  ------------------
 2033|  6.36k|		    *need_separator = oneed_separator;
 2034|  66.6k|		ms->offset = offset;
 2035|  66.6k|		ms->eoffset = eoffset;
 2036|  66.6k|		return rv ? rv : *found_match;
  ------------------
  |  Branch (2036:10): [True: 61.4k, False: 5.22k]
  ------------------
 2037|       |
 2038|  66.6k|	case FILE_NAME:
  ------------------
  |  |  298|  66.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (2038:2): [True: 66.6k, False: 117M]
  ------------------
 2039|  66.6k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  66.6k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  66.6k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  66.6k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  66.6k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  66.6k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  66.6k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (2039:7): [True: 0, False: 66.6k]
  ------------------
 2040|      0|			return 1;
 2041|  66.6k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (2041:7): [True: 0, False: 66.6k]
  ------------------
 2042|      0|			return -1;
 2043|  66.6k|		return 1;
 2044|   417k|	case FILE_DER:
  ------------------
  |  |  301|   417k|#define				FILE_DER		48
  ------------------
  |  Branch (2044:2): [True: 417k, False: 117M]
  ------------------
 2045|   430k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  256|   430k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2045:2): [True: 12.8k, False: 118M]
  ------------------
 2046|   433k|	case FILE_CLEAR:
  ------------------
  |  |  300|   433k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2046:2): [True: 3.24k, False: 118M]
  ------------------
 2047|  2.56M|	default:
  ------------------
  |  Branch (2047:2): [True: 2.12M, False: 115M]
  ------------------
 2048|  2.56M|		break;
 2049|   118M|	}
 2050|   100M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (2050:6): [True: 66, False: 100M]
  ------------------
 2051|     66|		return 0;
 2052|   100M|	return 1;
 2053|   100M|}
softmagic.c:mcopy:
 1380|   118M|{
 1381|   118M|	size_t size = sizeof(*p);
 1382|       |	/*
 1383|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1384|       |	 * anything, but setup pointers into the source
 1385|       |	 */
 1386|   118M|	if (indir == 0) {
  ------------------
  |  Branch (1386:6): [True: 118M, False: 847k]
  ------------------
 1387|   118M|		switch (type) {
 1388|   417k|		case FILE_DER:
  ------------------
  |  |  301|   417k|#define				FILE_DER		48
  ------------------
  |  Branch (1388:3): [True: 417k, False: 117M]
  ------------------
 1389|  1.59M|		case FILE_SEARCH:
  ------------------
  |  |  273|  1.59M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1389:3): [True: 1.17M, False: 116M]
  ------------------
 1390|  1.59M|			if (offset > nbytes)
  ------------------
  |  Branch (1390:8): [True: 70.8k, False: 1.52M]
  ------------------
 1391|  70.8k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  460|  70.8k|#define CAST(T, b)	((T)(b))
  ------------------
 1392|  1.59M|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  461|  1.59M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1393|  1.59M|			ms->search.s_len = nbytes - offset;
 1394|  1.59M|			ms->search.offset = offset;
 1395|  1.59M|			return 0;
 1396|       |
 1397|   494k|		case FILE_REGEX: {
  ------------------
  |  |  270|   494k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1397:3): [True: 494k, False: 117M]
  ------------------
 1398|   494k|			const char *b;
 1399|   494k|			const char *c;
 1400|   494k|			const char *last;	/* end of search region */
 1401|   494k|			const char *buf;	/* start of search region */
 1402|   494k|			const char *end;
 1403|   494k|			size_t lines, linecnt, bytecnt;
 1404|       |
 1405|   494k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1405:8): [True: 0, False: 494k]
  |  Branch (1405:21): [True: 1.24k, False: 493k]
  ------------------
 1406|  1.24k|				ms->search.s_len = 0;
 1407|  1.24k|				ms->search.s = NULL;
 1408|  1.24k|				return 0;
 1409|  1.24k|			}
 1410|       |
 1411|   493k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  390|   493k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  417|   493k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  403|   493k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1411:8): [True: 62.3k, False: 430k]
  ------------------
 1412|  62.3k|				linecnt = m->str_range;
  ------------------
  |  |  389|  62.3k|#define str_range _u._s._count
  ------------------
 1413|  62.3k|				bytecnt = linecnt * 80;
 1414|   430k|			} else {
 1415|   430k|				linecnt = 0;
 1416|   430k|				bytecnt = m->str_range;
  ------------------
  |  |  389|   430k|#define str_range _u._s._count
  ------------------
 1417|   430k|			}
 1418|       |
 1419|   493k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1419:8): [True: 224k, False: 268k]
  |  Branch (1419:24): [True: 211k, False: 56.7k]
  ------------------
 1420|   436k|				bytecnt = nbytes - offset;
 1421|   493k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1421:8): [True: 36.6k, False: 456k]
  ------------------
 1422|  36.6k|				bytecnt = ms->regex_max;
 1423|       |
 1424|   493k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  461|   493k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1425|   493k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  461|   493k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1426|       |			/* mget() guarantees buf <= last */
 1427|   711k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1427:35): [True: 278k, False: 432k]
  |  Branch (1427:44): [True: 274k, False: 3.67k]
  ------------------
 1428|   274k|			     ((b = CAST(const char *,
  ------------------
  |  |  460|   274k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1428:10): [True: 105k, False: 168k]
  ------------------
 1429|   274k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1430|   168k|			     || (b = CAST(const char *,
  ------------------
  |  |  460|   168k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1430:12): [True: 112k, False: 56.6k]
  ------------------
 1431|   168k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1432|   493k|			     lines--, b++) {
 1433|   218k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1433:9): [True: 215k, False: 2.86k]
  |  Branch (1433:24): [True: 111k, False: 103k]
  |  Branch (1433:40): [True: 0, False: 111k]
  ------------------
 1434|      0|					b++;
 1435|   218k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1435:9): [True: 215k, False: 2.86k]
  |  Branch (1435:24): [True: 103k, False: 111k]
  ------------------
 1436|   103k|					b++;
 1437|   218k|				last = b;
 1438|   218k|			}
 1439|   493k|			if (lines)
  ------------------
  |  Branch (1439:8): [True: 60.2k, False: 432k]
  ------------------
 1440|  60.2k|				last = end;
 1441|       |
 1442|   493k|			ms->search.s = buf;
 1443|   493k|			ms->search.s_len = last - buf;
 1444|   493k|			ms->search.offset = offset;
 1445|   493k|			ms->search.rm_len = 0;
 1446|   493k|			return 0;
 1447|   494k|		}
 1448|    148|		case FILE_BESTRING16:
  ------------------
  |  |  271|    148|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1448:3): [True: 148, False: 118M]
  ------------------
 1449|  68.0k|		case FILE_LESTRING16: {
  ------------------
  |  |  272|  68.0k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1449:3): [True: 67.8k, False: 117M]
  ------------------
 1450|  68.0k|			const unsigned char *src = s + offset;
 1451|  68.0k|			const unsigned char *esrc = s + nbytes;
 1452|  68.0k|			char *dst = p->s;
 1453|  68.0k|			char *edst = &p->s[sizeof(p->s) - 1];
 1454|       |
 1455|  68.0k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  271|  68.0k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1455:8): [True: 148, False: 67.8k]
  ------------------
 1456|    148|				src++;
 1457|       |
 1458|       |			/* check that offset is within range */
 1459|  68.0k|			if (offset >= nbytes)
  ------------------
  |  Branch (1459:8): [True: 1.88k, False: 66.1k]
  ------------------
 1460|  1.88k|				break;
 1461|  3.55M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1461:20): [True: 3.50M, False: 47.2k]
  ------------------
 1462|  3.50M|				if (dst < edst)
  ------------------
  |  Branch (1462:9): [True: 3.49M, False: 18.9k]
  ------------------
 1463|  3.49M|					*dst = *src;
 1464|  18.9k|				else
 1465|  18.9k|					break;
 1466|  3.49M|				if (*dst == '\0') {
  ------------------
  |  Branch (1466:9): [True: 1.66M, False: 1.82M]
  ------------------
 1467|  1.66M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  271|  1.66M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1467:10): [True: 3.52k, False: 1.66M]
  |  Branch (1467:10): [True: 726k, False: 941k]
  ------------------
 1468|  3.52k|					    *(src - 1) != '\0' :
 1469|  1.66M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1469:11): [True: 1.65M, False: 4.54k]
  ------------------
 1470|  1.65M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1470:10): [True: 726k, False: 933k]
  ------------------
 1471|   726k|						*dst = ' ';
 1472|  1.66M|				}
 1473|  3.49M|			}
 1474|  66.1k|			*edst = '\0';
 1475|  66.1k|			*dst = '\0';
 1476|  66.1k|			return 0;
 1477|  68.0k|		}
 1478|  75.5M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  258|  75.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1478:3): [True: 75.5M, False: 42.4M]
  ------------------
 1479|  75.6M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  266|  75.6M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1479:3): [True: 35.3k, False: 118M]
  ------------------
 1480|  75.6M|			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  389|  75.6M|#define str_range _u._s._count
  ------------------
              			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  389|  66.8k|#define str_range _u._s._count
  ------------------
  |  Branch (1480:8): [True: 66.8k, False: 75.5M]
  |  Branch (1480:29): [True: 66.8k, False: 0]
  ------------------
 1481|  66.8k|				size = m->str_range;
  ------------------
  |  |  389|  66.8k|#define str_range _u._s._count
  ------------------
 1482|  75.6M|			break;
 1483|  40.2M|		default:
  ------------------
  |  Branch (1483:3): [True: 40.2M, False: 77.7M]
  ------------------
 1484|  40.2M|			break;
 1485|   118M|		}
 1486|   118M|	}
 1487|       |
 1488|   116M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  305|   116M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1488:6): [True: 6.71k, False: 116M]
  ------------------
 1489|  6.71k|		(void)memset(p, '\0', sizeof(*p));
 1490|  6.71k|		p->q = offset;
 1491|  6.71k|		return 0;
 1492|  6.71k|	}
 1493|       |
 1494|   116M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1494:6): [True: 7.74M, False: 109M]
  ------------------
 1495|  7.74M|		(void)memset(p, '\0', sizeof(*p));
 1496|  7.74M|		return 0;
 1497|  7.74M|	}
 1498|   109M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1498:6): [True: 70.9M, False: 38.0M]
  ------------------
 1499|  70.9M|		nbytes = nbytes - offset;
 1500|  38.0M|	else
 1501|  38.0M|		nbytes = size;
 1502|       |
 1503|   109M|	(void)memcpy(p, s + offset, nbytes);
 1504|       |
 1505|       |	/*
 1506|       |	 * the usefulness of padding with zeroes eludes me, it
 1507|       |	 * might even cause problems
 1508|       |	 */
 1509|   109M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1509:6): [True: 71.0M, False: 37.9M]
  ------------------
 1510|  71.0M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  461|  71.0M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1511|  71.0M|		    sizeof(*p) - nbytes);
 1512|   109M|	return 0;
 1513|   116M|}
softmagic.c:offset_oob:
  114|   115M| {
  115|   115M|	if (o < 0)
  ------------------
  |  Branch (115:6): [True: 0, False: 115M]
  ------------------
  116|      0|		return 1;
  117|   115M|        if ((uintmax_t)o > n)
  ------------------
  |  Branch (117:13): [True: 6.55M, False: 109M]
  ------------------
  118|  6.55M|		return 1;
  119|   109M|        return i > n - (uintmax_t)o;
  120|   115M|}
softmagic.c:cvt_flip:
 1028|   101M|{
 1029|   101M|	if (flip == 0)
  ------------------
  |  Branch (1029:6): [True: 101M, False: 8.56k]
  ------------------
 1030|   101M|		return type;
 1031|  8.56k|	switch (type) {
 1032|     46|	case FILE_BESHORT:
  ------------------
  |  |  260|     46|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1032:2): [True: 46, False: 8.52k]
  ------------------
 1033|     46|		return FILE_LESHORT;
  ------------------
  |  |  263|     46|#define				FILE_LESHORT		10
  ------------------
 1034|  3.02k|	case FILE_BELONG:
  ------------------
  |  |  261|  3.02k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1034:2): [True: 3.02k, False: 5.54k]
  ------------------
 1035|  3.02k|		return FILE_LELONG;
  ------------------
  |  |  264|  3.02k|#define				FILE_LELONG		11
  ------------------
 1036|     34|	case FILE_BEDATE:
  ------------------
  |  |  262|     34|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1036:2): [True: 34, False: 8.53k]
  ------------------
 1037|     34|		return FILE_LEDATE;
  ------------------
  |  |  265|     34|#define				FILE_LEDATE		12
  ------------------
 1038|      0|	case FILE_BELDATE:
  ------------------
  |  |  268|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1038:2): [True: 0, False: 8.56k]
  ------------------
 1039|      0|		return FILE_LELDATE;
  ------------------
  |  |  269|      0|#define				FILE_LELDATE		16
  ------------------
 1040|     60|	case FILE_BEQUAD:
  ------------------
  |  |  279|     60|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1040:2): [True: 60, False: 8.50k]
  ------------------
 1041|     60|		return FILE_LEQUAD;
  ------------------
  |  |  278|     60|#define				FILE_LEQUAD		25
  ------------------
 1042|    286|	case FILE_BEQDATE:
  ------------------
  |  |  282|    286|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1042:2): [True: 286, False: 8.28k]
  ------------------
 1043|    286|		return FILE_LEQDATE;
  ------------------
  |  |  281|    286|#define				FILE_LEQDATE		28
  ------------------
 1044|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  285|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1044:2): [True: 0, False: 8.56k]
  ------------------
 1045|      0|		return FILE_LEQLDATE;
  ------------------
  |  |  284|      0|#define				FILE_LEQLDATE		31
  ------------------
 1046|      0|	case FILE_BEQWDATE:
  ------------------
  |  |  297|      0|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1046:2): [True: 0, False: 8.56k]
  ------------------
 1047|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  296|      0|#define				FILE_LEQWDATE		43
  ------------------
 1048|  3.77k|	case FILE_LESHORT:
  ------------------
  |  |  263|  3.77k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1048:2): [True: 3.77k, False: 4.79k]
  ------------------
 1049|  3.77k|		return FILE_BESHORT;
  ------------------
  |  |  260|  3.77k|#define				FILE_BESHORT		7
  ------------------
 1050|    171|	case FILE_LELONG:
  ------------------
  |  |  264|    171|#define				FILE_LELONG		11
  ------------------
  |  Branch (1050:2): [True: 171, False: 8.39k]
  ------------------
 1051|    171|		return FILE_BELONG;
  ------------------
  |  |  261|    171|#define				FILE_BELONG		8
  ------------------
 1052|      0|	case FILE_LEDATE:
  ------------------
  |  |  265|      0|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1052:2): [True: 0, False: 8.56k]
  ------------------
 1053|      0|		return FILE_BEDATE;
  ------------------
  |  |  262|      0|#define				FILE_BEDATE		9
  ------------------
 1054|      0|	case FILE_LELDATE:
  ------------------
  |  |  269|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1054:2): [True: 0, False: 8.56k]
  ------------------
 1055|      0|		return FILE_BELDATE;
  ------------------
  |  |  268|      0|#define				FILE_BELDATE		15
  ------------------
 1056|     80|	case FILE_LEQUAD:
  ------------------
  |  |  278|     80|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1056:2): [True: 80, False: 8.48k]
  ------------------
 1057|     80|		return FILE_BEQUAD;
  ------------------
  |  |  279|     80|#define				FILE_BEQUAD		26
  ------------------
 1058|      0|	case FILE_LEQDATE:
  ------------------
  |  |  281|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1058:2): [True: 0, False: 8.56k]
  ------------------
 1059|      0|		return FILE_BEQDATE;
  ------------------
  |  |  282|      0|#define				FILE_BEQDATE		29
  ------------------
 1060|      0|	case FILE_LEQLDATE:
  ------------------
  |  |  284|      0|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1060:2): [True: 0, False: 8.56k]
  ------------------
 1061|      0|		return FILE_BEQLDATE;
  ------------------
  |  |  285|      0|#define				FILE_BEQLDATE		32
  ------------------
 1062|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  296|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1062:2): [True: 0, False: 8.56k]
  ------------------
 1063|      0|		return FILE_BEQWDATE;
  ------------------
  |  |  297|      0|#define				FILE_BEQWDATE		44
  ------------------
 1064|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1064:2): [True: 0, False: 8.56k]
  ------------------
 1065|      0|		return FILE_LEFLOAT;
  ------------------
  |  |  288|      0|#define				FILE_LEFLOAT		35
  ------------------
 1066|      0|	case FILE_LEFLOAT:
  ------------------
  |  |  288|      0|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1066:2): [True: 0, False: 8.56k]
  ------------------
 1067|      0|		return FILE_BEFLOAT;
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
 1068|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1068:2): [True: 0, False: 8.56k]
  ------------------
 1069|      0|		return FILE_LEDOUBLE;
  ------------------
  |  |  291|      0|#define				FILE_LEDOUBLE		38
  ------------------
 1070|      0|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|      0|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1070:2): [True: 0, False: 8.56k]
  ------------------
 1071|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  290|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1072|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1072:2): [True: 0, False: 8.56k]
  ------------------
 1073|      0|		return FILE_LEMSDOSDATE;
  ------------------
  |  |  309|      0|#define				FILE_LEMSDOSDATE	56
  ------------------
 1074|      0|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|      0|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1074:2): [True: 0, False: 8.56k]
  ------------------
 1075|      0|		return FILE_BEMSDOSDATE;
  ------------------
  |  |  310|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
 1076|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1076:2): [True: 0, False: 8.56k]
  ------------------
 1077|      0|		return FILE_LEMSDOSTIME;
  ------------------
  |  |  312|      0|#define				FILE_LEMSDOSTIME	59
  ------------------
 1078|      0|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|      0|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1078:2): [True: 0, False: 8.56k]
  ------------------
 1079|      0|		return FILE_BEMSDOSTIME;
  ------------------
  |  |  313|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
 1080|  1.09k|	default:
  ------------------
  |  Branch (1080:2): [True: 1.09k, False: 7.47k]
  ------------------
 1081|  1.09k|		return type;
 1082|  8.56k|	}
 1083|  8.56k|}
softmagic.c:do_ops:
 1518|   544k|{
 1519|   544k|	intmax_t offset;
 1520|       |	// On purpose not INTMAX_MAX
 1521|   544k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1521:6): [True: 8.18k, False: 536k]
  |  Branch (1521:25): [True: 155, False: 536k]
  ------------------
 1522|   536k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1522:6): [True: 194, False: 535k]
  |  Branch (1522:25): [True: 0, False: 535k]
  ------------------
 1523|  8.53k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  8.53k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1523:7): [True: 0, False: 8.53k]
  ------------------
 1524|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1525|  8.53k|		return 1;
 1526|  8.53k|	}
 1527|       |	   
 1528|   535k|	if (off) {
  ------------------
  |  Branch (1528:6): [True: 90.0k, False: 445k]
  ------------------
 1529|  90.0k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  360|  90.0k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1529:11): [True: 90.0k, False: 0]
  ------------------
 1530|     34|		case FILE_OPAND:
  ------------------
  |  |  352|     34|#define				FILE_OPAND	0
  ------------------
  |  Branch (1530:3): [True: 34, False: 89.9k]
  ------------------
 1531|     34|			offset = lhs & off;
 1532|     34|			break;
 1533|      0|		case FILE_OPOR:
  ------------------
  |  |  353|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1533:3): [True: 0, False: 90.0k]
  ------------------
 1534|      0|			offset = lhs | off;
 1535|      0|			break;
 1536|      0|		case FILE_OPXOR:
  ------------------
  |  |  354|      0|#define				FILE_OPXOR	2
  ------------------
  |  Branch (1536:3): [True: 0, False: 90.0k]
  ------------------
 1537|      0|			offset = lhs ^ off;
 1538|      0|			break;
 1539|  77.9k|		case FILE_OPADD:
  ------------------
  |  |  355|  77.9k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1539:3): [True: 77.9k, False: 12.1k]
  ------------------
 1540|  77.9k|			offset = lhs + off;
 1541|  77.9k|			break;
 1542|    920|		case FILE_OPMINUS:
  ------------------
  |  |  356|    920|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1542:3): [True: 920, False: 89.1k]
  ------------------
 1543|    920|			offset = lhs - off;
 1544|    920|			break;
 1545|  11.0k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  357|  11.0k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1545:3): [True: 11.0k, False: 78.9k]
  ------------------
 1546|  11.0k|			offset = lhs * off;
 1547|  11.0k|			break;
 1548|     74|		case FILE_OPDIVIDE:
  ------------------
  |  |  358|     74|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1548:3): [True: 74, False: 89.9k]
  ------------------
 1549|     74|			offset = lhs / off;
 1550|     74|			break;
 1551|      0|		case FILE_OPMODULO:
  ------------------
  |  |  359|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1551:3): [True: 0, False: 90.0k]
  ------------------
 1552|      0|			offset = lhs % off;
 1553|      0|			break;
 1554|  90.0k|		}
 1555|  90.0k|	} else
 1556|   445k|		offset = lhs;
 1557|   535k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  364|   535k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1557:6): [True: 0, False: 535k]
  ------------------
 1558|      0|		offset = ~offset;
 1559|   535k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1559:6): [True: 513, False: 535k]
  ------------------
 1560|    513|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    513|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1560:7): [True: 0, False: 513]
  ------------------
 1561|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1562|    513|		return 1;
 1563|    513|	}
 1564|   535k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  460|   535k|#define CAST(T, b)	((T)(b))
  ------------------
 1565|   535k|	return 0;
 1566|   535k|}
softmagic.c:cvt_id3:
 1016|    116|{
 1017|    116|	v = ((((v >>  0) & 0x7f) <<  0) |
 1018|    116|	     (((v >>  8) & 0x7f) <<  7) |
 1019|    116|	     (((v >> 16) & 0x7f) << 14) |
 1020|    116|	     (((v >> 24) & 0x7f) << 21));
 1021|    116|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    116|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1021:6): [True: 0, False: 116]
  ------------------
 1022|      0|		fprintf(stderr, "id3 offs=%u\n", v);
 1023|    116|	return v;
 1024|    116|}
softmagic.c:file_fmtcheck:
  172|   170k|{
  173|   170k|	const char *ptr;
  174|       |
  175|   170k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (175:6): [True: 113k, False: 57.4k]
  ------------------
  176|   113k|		return desc;
  177|       |
  178|  57.4k|	ptr = fmtcheck(desc, def);
  179|  57.4k|	if (ptr == def)
  ------------------
  |  Branch (179:6): [True: 0, False: 57.4k]
  ------------------
  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|  57.4k|	return ptr;
  184|   170k|}
softmagic.c:save_cont:
 1628|  66.6k|{
 1629|  66.6k|	size_t len;
 1630|  66.6k|	*c = ms->c;
 1631|  66.6k|	len = c->len * sizeof(*c->li);
 1632|  66.6k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  460|  66.6k|#define CAST(T, b)	((T)(b))
  ------------------
 1633|  66.6k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1633:6): [True: 0, False: 66.6k]
  ------------------
 1634|      0|		ms->c = *c;
 1635|      0|		return -1;
 1636|      0|	}
 1637|  66.6k|	memcpy(ms->c.li, c->li, len);
 1638|  66.6k|	return 0;
 1639|  66.6k|}
softmagic.c:restore_cont:
 1643|  66.6k|{
 1644|  66.6k|	free(ms->c.li);
 1645|  66.6k|	ms->c = *c;
 1646|  66.6k|}
softmagic.c:mconvert:
 1205|   100M|{
 1206|   100M|	union VALUETYPE *p = &ms->ms_value;
 1207|       |
 1208|   100M|	switch (cvt_flip(m->type, flip)) {
 1209|  1.82M|	case FILE_BYTE:
  ------------------
  |  |  254|  1.82M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1209:2): [True: 1.82M, False: 98.8M]
  ------------------
 1210|  1.82M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1210:7): [True: 0, False: 1.82M]
  ------------------
 1211|      0|			goto out;
 1212|  1.82M|		return 1;
 1213|  1.85M|	case FILE_SHORT:
  ------------------
  |  |  255|  1.85M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1213:2): [True: 1.85M, False: 98.8M]
  ------------------
 1214|  1.85M|	case FILE_MSDOSDATE:
  ------------------
  |  |  308|  1.85M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1214:2): [True: 0, False: 100M]
  ------------------
 1215|  1.85M|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|  1.85M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1215:2): [True: 0, False: 100M]
  ------------------
 1216|  1.85M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1216:7): [True: 0, False: 1.85M]
  ------------------
 1217|      0|			goto out;
 1218|  1.85M|		return 1;
 1219|  1.60M|	case FILE_LONG:
  ------------------
  |  |  257|  1.60M|#define				FILE_LONG		4
  ------------------
  |  Branch (1219:2): [True: 1.60M, False: 99.0M]
  ------------------
 1220|  1.60M|	case FILE_DATE:
  ------------------
  |  |  259|  1.60M|#define				FILE_DATE		6
  ------------------
  |  Branch (1220:2): [True: 0, False: 100M]
  ------------------
 1221|  1.60M|	case FILE_LDATE:
  ------------------
  |  |  267|  1.60M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1221:2): [True: 0, False: 100M]
  ------------------
 1222|  1.60M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1222:7): [True: 0, False: 1.60M]
  ------------------
 1223|      0|			goto out;
 1224|  1.60M|		return 1;
 1225|  70.1k|	case FILE_QUAD:
  ------------------
  |  |  277|  70.1k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1225:2): [True: 70.1k, False: 100M]
  ------------------
 1226|  70.1k|	case FILE_QDATE:
  ------------------
  |  |  280|  70.1k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1226:2): [True: 0, False: 100M]
  ------------------
 1227|  70.1k|	case FILE_QLDATE:
  ------------------
  |  |  283|  70.1k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1227:2): [True: 0, False: 100M]
  ------------------
 1228|  70.5k|	case FILE_QWDATE:
  ------------------
  |  |  295|  70.5k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1228:2): [True: 373, False: 100M]
  ------------------
 1229|  77.2k|	case FILE_OFFSET:
  ------------------
  |  |  305|  77.2k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1229:2): [True: 6.71k, False: 100M]
  ------------------
 1230|  77.2k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1230:7): [True: 0, False: 77.2k]
  ------------------
 1231|      0|			goto out;
 1232|  77.2k|		return 1;
 1233|  62.3M|	case FILE_STRING:
  ------------------
  |  |  258|  62.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1233:2): [True: 62.3M, False: 38.3M]
  ------------------
 1234|  62.3M|	case FILE_BESTRING16:
  ------------------
  |  |  271|  62.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1234:2): [True: 148, False: 100M]
  ------------------
 1235|  62.4M|	case FILE_LESTRING16:
  ------------------
  |  |  272|  62.4M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1235:2): [True: 67.8k, False: 100M]
  ------------------
 1236|  62.4M|	case FILE_OCTAL: {
  ------------------
  |  |  314|  62.4M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1236:2): [True: 0, False: 100M]
  ------------------
 1237|       |		/* Null terminate and eat *trailing* return */
 1238|  62.4M|		p->s[sizeof(p->s) - 1] = '\0';
 1239|  62.4M|		return 1;
 1240|  62.4M|	}
 1241|  26.2k|	case FILE_PSTRING: {
  ------------------
  |  |  266|  26.2k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1241:2): [True: 26.2k, False: 100M]
  ------------------
 1242|  26.2k|		char *ptr1, *ptr2;
 1243|  26.2k|		size_t len, sz = file_pstring_length_size(ms, m);
 1244|  26.2k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  183|  26.2k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  26.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1244:7): [True: 0, False: 26.2k]
  ------------------
 1245|      0|			return 0;
 1246|  26.2k|		ptr1 = p->s;
 1247|  26.2k|		ptr2 = ptr1 + sz;
 1248|  26.2k|		len = file_pstring_get_length(ms, m, ptr1);
 1249|  26.2k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  183|  26.2k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  26.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1249:7): [True: 66, False: 26.2k]
  ------------------
 1250|     66|			return 0;
 1251|  26.2k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1252|  26.2k|		if (len >= sz) {
  ------------------
  |  Branch (1252:7): [True: 14.9k, False: 11.2k]
  ------------------
 1253|       |			/*
 1254|       |			 * The size of the pascal string length (sz)
 1255|       |			 * is 1, 2, or 4. We need at least 1 byte for NUL
 1256|       |			 * termination, but we've already truncated the
 1257|       |			 * string by p->s, so we need to deduct sz.
 1258|       |			 * Because we can use one of the bytes of the length
 1259|       |			 * after we shifted as NUL termination.
 1260|       |			 */
 1261|  14.9k|			len = sz;
 1262|  14.9k|		}
 1263|  2.28M|		while (len--)
  ------------------
  |  Branch (1263:10): [True: 2.25M, False: 26.2k]
  ------------------
 1264|  2.25M|			*ptr1++ = *ptr2++;
 1265|  26.2k|		*ptr1 = '\0';
 1266|  26.2k|		return 1;
 1267|  26.2k|	}
 1268|  4.50M|	case FILE_BESHORT:
  ------------------
  |  |  260|  4.50M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1268:2): [True: 4.50M, False: 96.1M]
  ------------------
 1269|  4.50M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|  4.50M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1269:2): [True: 0, False: 100M]
  ------------------
 1270|  4.50M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|  4.50M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1270:2): [True: 0, False: 100M]
  ------------------
 1271|  4.50M|		p->h = CAST(short, BE16(p->hs));
  ------------------
  |  |  460|  4.50M|#define CAST(T, b)	((T)(b))
  ------------------
 1272|  4.50M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1272:7): [True: 0, False: 4.50M]
  ------------------
 1273|      0|			goto out;
 1274|  4.50M|		return 1;
 1275|  13.4M|	case FILE_BELONG:
  ------------------
  |  |  261|  13.4M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1275:2): [True: 13.4M, False: 87.2M]
  ------------------
 1276|  13.4M|	case FILE_BEDATE:
  ------------------
  |  |  262|  13.4M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1276:2): [True: 354, False: 100M]
  ------------------
 1277|  13.4M|	case FILE_BELDATE:
  ------------------
  |  |  268|  13.4M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1277:2): [True: 294, False: 100M]
  ------------------
 1278|  13.4M|		p->l = CAST(int32_t, BE32(p->hl));
  ------------------
  |  |  460|  13.4M|#define CAST(T, b)	((T)(b))
  ------------------
 1279|  13.4M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1279:7): [True: 0, False: 13.4M]
  ------------------
 1280|      0|			goto out;
 1281|  13.4M|		return 1;
 1282|  1.07M|	case FILE_BEQUAD:
  ------------------
  |  |  279|  1.07M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1282:2): [True: 1.07M, False: 99.5M]
  ------------------
 1283|  1.07M|	case FILE_BEQDATE:
  ------------------
  |  |  282|  1.07M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1283:2): [True: 100, False: 100M]
  ------------------
 1284|  1.07M|	case FILE_BEQLDATE:
  ------------------
  |  |  285|  1.07M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1284:2): [True: 176, False: 100M]
  ------------------
 1285|  1.07M|	case FILE_BEQWDATE:
  ------------------
  |  |  297|  1.07M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1285:2): [True: 0, False: 100M]
  ------------------
 1286|  1.07M|		p->q = CAST(uint64_t, BE64(p->hq));
  ------------------
  |  |  460|  1.07M|#define CAST(T, b)	((T)(b))
  ------------------
 1287|  1.07M|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1287:7): [True: 0, False: 1.07M]
  ------------------
 1288|      0|			goto out;
 1289|  1.07M|		return 1;
 1290|  4.42M|	case FILE_LESHORT:
  ------------------
  |  |  263|  4.42M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1290:2): [True: 4.42M, False: 96.2M]
  ------------------
 1291|  4.42M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|  4.42M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1291:2): [True: 213, False: 100M]
  ------------------
 1292|  4.42M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|  4.42M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1292:2): [True: 213, False: 100M]
  ------------------
 1293|  4.42M|		p->h = CAST(short, LE16(p->hs));
  ------------------
  |  |  460|  4.42M|#define CAST(T, b)	((T)(b))
  ------------------
 1294|  4.42M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1294:7): [True: 0, False: 4.42M]
  ------------------
 1295|      0|			goto out;
 1296|  4.42M|		return 1;
 1297|  6.67M|	case FILE_LELONG:
  ------------------
  |  |  264|  6.67M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1297:2): [True: 6.67M, False: 93.9M]
  ------------------
 1298|  6.67M|	case FILE_LEDATE:
  ------------------
  |  |  265|  6.67M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1298:2): [True: 787, False: 100M]
  ------------------
 1299|  6.67M|	case FILE_LELDATE:
  ------------------
  |  |  269|  6.67M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1299:2): [True: 34, False: 100M]
  ------------------
 1300|  6.67M|		p->l = CAST(int32_t, LE32(p->hl));
  ------------------
  |  |  460|  6.67M|#define CAST(T, b)	((T)(b))
  ------------------
 1301|  6.67M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1301:7): [True: 0, False: 6.67M]
  ------------------
 1302|      0|			goto out;
 1303|  6.67M|		return 1;
 1304|   901k|	case FILE_LEQUAD:
  ------------------
  |  |  278|   901k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1304:2): [True: 901k, False: 99.7M]
  ------------------
 1305|   901k|	case FILE_LEQDATE:
  ------------------
  |  |  281|   901k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1305:2): [True: 286, False: 100M]
  ------------------
 1306|   901k|	case FILE_LEQLDATE:
  ------------------
  |  |  284|   901k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1306:2): [True: 10, False: 100M]
  ------------------
 1307|   902k|	case FILE_LEQWDATE:
  ------------------
  |  |  296|   902k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1307:2): [True: 1.34k, False: 100M]
  ------------------
 1308|   902k|		p->q = CAST(uint64_t, LE64(p->hq));
  ------------------
  |  |  460|   902k|#define CAST(T, b)	((T)(b))
  ------------------
 1309|   902k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1309:7): [True: 0, False: 902k]
  ------------------
 1310|      0|			goto out;
 1311|   902k|		return 1;
 1312|     34|	case FILE_MELONG:
  ------------------
  |  |  276|     34|#define				FILE_MELONG		23
  ------------------
  |  Branch (1312:2): [True: 34, False: 100M]
  ------------------
 1313|     76|	case FILE_MEDATE:
  ------------------
  |  |  274|     76|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1313:2): [True: 42, False: 100M]
  ------------------
 1314|     76|	case FILE_MELDATE:
  ------------------
  |  |  275|     76|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1314:2): [True: 0, False: 100M]
  ------------------
 1315|     76|		p->l = CAST(int32_t, ME32(p->hl));
  ------------------
  |  |  460|     76|#define CAST(T, b)	((T)(b))
  ------------------
 1316|     76|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1316:7): [True: 0, False: 76]
  ------------------
 1317|      0|			goto out;
 1318|     76|		return 1;
 1319|      0|	case FILE_FLOAT:
  ------------------
  |  |  286|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1319:2): [True: 0, False: 100M]
  ------------------
 1320|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1320:7): [True: 0, False: 0]
  ------------------
 1321|      0|			goto out;
 1322|      0|		return 1;
 1323|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1323:2): [True: 0, False: 100M]
  ------------------
 1324|      0|		p->l = BE32(p->hl);
  ------------------
  |  |   95|      0|#define BE32(p) ( \
  |  |   96|      0|    (CAST(uint32_t, (p)[0])<<24)| \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|      0|    (CAST(uint32_t, (p)[1])<<16)| \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|      0|    (CAST(uint32_t, (p)[2])<<8)| \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|      0|    (CAST(uint32_t, (p)[3])))
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1325|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1325:7): [True: 0, False: 0]
  ------------------
 1326|      0|			goto out;
 1327|      0|		return 1;
 1328|  3.28k|	case FILE_LEFLOAT:
  ------------------
  |  |  288|  3.28k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1328:2): [True: 3.28k, False: 100M]
  ------------------
 1329|  3.28k|		p->l = LE32(p->hl);
  ------------------
  |  |   90|  3.28k|#define LE32(p) ( \
  |  |   91|  3.28k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  460|  3.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|  3.28k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  460|  3.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  3.28k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  460|  3.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  3.28k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  460|  3.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1330|  3.28k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1330:7): [True: 0, False: 3.28k]
  ------------------
 1331|      0|			goto out;
 1332|  3.28k|		return 1;
 1333|      0|	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1333:2): [True: 0, False: 100M]
  ------------------
 1334|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1334:7): [True: 0, False: 0]
  ------------------
 1335|      0|			goto out;
 1336|      0|		return 1;
 1337|    134|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|    134|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1337:2): [True: 134, False: 100M]
  ------------------
 1338|    134|		p->q = BE64(p->hq);
  ------------------
  |  |   72|    134|#define BE64(p) ( \
  |  |   73|    134|    (CAST(uint64_t, (p)[0])<<56)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   74|    134|    (CAST(uint64_t, (p)[1])<<48)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    134|    (CAST(uint64_t, (p)[2])<<40)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    134|    (CAST(uint64_t, (p)[3])<<32)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    134|    (CAST(uint64_t, (p)[4])<<24)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    134|    (CAST(uint64_t, (p)[5])<<16)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    134|    (CAST(uint64_t, (p)[6])<<8)| \
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   80|    134|    (CAST(uint64_t, (p)[7])))
  |  |  ------------------
  |  |  |  |  460|    134|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1339|    134|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1339:7): [True: 0, False: 134]
  ------------------
 1340|      0|			goto out;
 1341|    134|		return 1;
 1342|    574|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    574|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1342:2): [True: 574, False: 100M]
  ------------------
 1343|    574|		p->q = LE64(p->hq);
  ------------------
  |  |   81|    574|#define LE64(p) ( \
  |  |   82|    574|    (CAST(uint64_t, (p)[7])<<56)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   83|    574|    (CAST(uint64_t, (p)[6])<<48)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    574|    (CAST(uint64_t, (p)[5])<<40)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    574|    (CAST(uint64_t, (p)[4])<<32)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    574|    (CAST(uint64_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    574|    (CAST(uint64_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    574|    (CAST(uint64_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    574|    (CAST(uint64_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  460|    574|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1344|    574|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1344:7): [True: 0, False: 574]
  ------------------
 1345|      0|			goto out;
 1346|    574|		return 1;
 1347|   493k|	case FILE_REGEX:
  ------------------
  |  |  270|   493k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1347:2): [True: 493k, False: 100M]
  ------------------
 1348|  1.19M|	case FILE_SEARCH:
  ------------------
  |  |  273|  1.19M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1348:2): [True: 704k, False: 99.9M]
  ------------------
 1349|  1.21M|	case FILE_DEFAULT:
  ------------------
  |  |  256|  1.21M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1349:2): [True: 12.8k, False: 100M]
  ------------------
 1350|  1.21M|	case FILE_CLEAR:
  ------------------
  |  |  300|  1.21M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1350:2): [True: 3.24k, False: 100M]
  ------------------
 1351|  1.21M|	case FILE_NAME:
  ------------------
  |  |  298|  1.21M|#define				FILE_NAME		45
  ------------------
  |  Branch (1351:2): [True: 0, False: 100M]
  ------------------
 1352|  1.21M|	case FILE_USE:
  ------------------
  |  |  299|  1.21M|#define				FILE_USE		46
  ------------------
  |  Branch (1352:2): [True: 0, False: 100M]
  ------------------
 1353|  1.63M|	case FILE_DER:
  ------------------
  |  |  301|  1.63M|#define				FILE_DER		48
  ------------------
  |  Branch (1353:2): [True: 417k, False: 100M]
  ------------------
 1354|  1.82M|	case FILE_GUID:
  ------------------
  |  |  302|  1.82M|#define				FILE_GUID		49
  ------------------
  |  Branch (1354:2): [True: 188k, False: 100M]
  ------------------
 1355|  1.82M|	case FILE_LEGUID:
  ------------------
  |  |  303|  1.82M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1355:2): [True: 0, False: 100M]
  ------------------
 1356|  1.82M|	case FILE_BEGUID:
  ------------------
  |  |  304|  1.82M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1356:2): [True: 84, False: 100M]
  ------------------
 1357|  1.82M|		return 1;
 1358|      0|	default:
  ------------------
  |  Branch (1358:2): [True: 0, False: 100M]
  ------------------
 1359|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1360|      0|		return 0;
 1361|   100M|	}
 1362|      0|out:
 1363|      0|	file_magerror(ms, "zerodivide/overflow/underflow in mconvert()");
 1364|      0|	return 0;
 1365|   100M|}
softmagic.c:cvt_8:
 1139|  1.82M|{
 1140|  1.82M|	DO_CVT(m, b, 8);
  ------------------
  |  | 1131|  1.82M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  1.82M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 789k, False: 1.03M]
  |  |  ------------------
  |  | 1132|   789k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|   789k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|   789k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 103k, False: 685k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   789k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   103k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 103k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  86.2k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  86.2k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 86.2k, False: 17.3k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  86.2k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  86.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  86.2k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 103k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 103k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 103k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|  16.3k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  16.3k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 16.3k, False: 87.2k]
  |  |  |  |  ------------------
  |  |  |  | 1109|  16.3k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  16.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|  16.3k|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 103k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    491|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    491|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 491, False: 103k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    491|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    491|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    491|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 491]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    491|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    491|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    491|		return -1; \
  |  |  |  |  |  | 1090|    491|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    491|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 491]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    491|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    491|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    491|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    491|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    491|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 491]
  |  |  |  |  ------------------
  |  |  |  | 1117|    491|				return -1; \
  |  |  |  | 1118|    491|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    491|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    491|			break; \
  |  |  |  | 1120|    491|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|    489|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 489, False: 103k]
  |  |  |  |  ------------------
  |  |  |  | 1121|    489|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    489|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    489|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 489]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    489|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    489|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    489|		return -1; \
  |  |  |  |  |  | 1090|    489|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    489|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 489]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    489|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    489|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    489|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    489|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    489|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 489]
  |  |  |  |  ------------------
  |  |  |  | 1123|    489|				return -1; \
  |  |  |  | 1124|    489|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    489|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    489|			break; \
  |  |  |  | 1126|   103k|		} \
  |  |  |  | 1127|   789k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|   789k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 789k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   789k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  1.03M|	} else { \
  |  | 1134|  1.03M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  1.03M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  1.03M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 47.1k, False: 985k]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.03M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|  47.1k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 47.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  38.7k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  38.7k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 38.7k, False: 8.45k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  38.7k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  38.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  38.7k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 47.1k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 47.1k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 47.1k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|  8.38k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  8.38k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 8.38k, False: 38.8k]
  |  |  |  |  ------------------
  |  |  |  | 1109|  8.38k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  8.38k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|  8.38k|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 47.1k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|     70|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|     70|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 70, False: 47.1k]
  |  |  |  |  ------------------
  |  |  |  | 1115|     70|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|     70|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 70]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|     70|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|     70|		return -1; \
  |  |  |  |  |  | 1090|     70|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 70]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|     70|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|     70|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|     70|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 70]
  |  |  |  |  ------------------
  |  |  |  | 1117|     70|				return -1; \
  |  |  |  | 1118|     70|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|     70|			break; \
  |  |  |  | 1120|     70|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|      0|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 0, False: 47.1k]
  |  |  |  |  ------------------
  |  |  |  | 1121|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|				return -1; \
  |  |  |  | 1124|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|      0|			break; \
  |  |  |  | 1126|  47.1k|		} \
  |  |  |  | 1127|  1.03M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  1.03M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.03M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.03M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  1.03M|	}
  ------------------
 1141|  1.82M|	return 0;
 1142|  1.82M|}
softmagic.c:cvt_16:
 1146|  10.7M|{
 1147|  10.7M|	DO_CVT(m, h, 16);
  ------------------
  |  | 1131|  10.7M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  10.7M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 1.38M, False: 9.39M]
  |  |  ------------------
  |  | 1132|  1.38M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|  1.38M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  1.38M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 138k, False: 1.25M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.38M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   138k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 138k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   137k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   137k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 137k, False: 622]
  |  |  |  |  ------------------
  |  |  |  | 1097|   137k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   137k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   137k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 138k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 138k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     68|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|     68|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 68, False: 138k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     68|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     68|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     68|			break; \
  |  |  |  | 1108|    148|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|    148|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 148, False: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1109|    148|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    148|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|    148|			break; \
  |  |  |  | 1111|     70|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|     70|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 70, False: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1112|     70|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|     70|			break; \
  |  |  |  | 1114|    270|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    270|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 270, False: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    270|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    270|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 270]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    270|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    270|		return -1; \
  |  |  |  |  |  | 1090|    270|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 270]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    270|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    270|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    270|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 270]
  |  |  |  |  ------------------
  |  |  |  | 1117|    270|				return -1; \
  |  |  |  | 1118|    270|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    270|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    270|			break; \
  |  |  |  | 1120|    270|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|     66|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 66, False: 138k]
  |  |  |  |  ------------------
  |  |  |  | 1121|     66|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|     66|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 66]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|     66|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|     66|		return -1; \
  |  |  |  |  |  | 1090|     66|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 66]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|     66|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|     66|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|     66|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  |  | 1123|     66|				return -1; \
  |  |  |  | 1124|     66|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|     66|			break; \
  |  |  |  | 1126|   138k|		} \
  |  |  |  | 1127|  1.38M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  1.38M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.38M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.38M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  9.39M|	} else { \
  |  | 1134|  9.39M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  9.39M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  9.39M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 502k, False: 8.89M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  9.39M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   502k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 502k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   473k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   473k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 473k, False: 28.9k]
  |  |  |  |  ------------------
  |  |  |  | 1097|   473k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   473k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   473k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 502k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 502k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     74|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|     74|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 74, False: 502k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     74|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     74|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     74|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 502k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 502k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 0, False: 502k]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|				return -1; \
  |  |  |  | 1118|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			break; \
  |  |  |  | 1120|  28.9k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|  28.9k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 28.9k, False: 473k]
  |  |  |  |  ------------------
  |  |  |  | 1121|  28.9k|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  28.9k|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 28.9k]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|  28.9k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|  28.9k|		return -1; \
  |  |  |  |  |  | 1090|  28.9k|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 28.9k]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|  28.9k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|  28.9k|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|  28.9k|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 28.9k]
  |  |  |  |  ------------------
  |  |  |  | 1123|  28.9k|				return -1; \
  |  |  |  | 1124|  28.9k|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|  28.9k|			break; \
  |  |  |  | 1126|   502k|		} \
  |  |  |  | 1127|  9.39M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  9.39M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 9.39M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  9.39M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  9.39M|	}
  ------------------
 1148|  10.7M|	return 0;
 1149|  10.7M|}
softmagic.c:cvt_32:
 1153|  21.7M|{
 1154|  21.7M|	DO_CVT(m, l, 32);
  ------------------
  |  | 1131|  21.7M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  21.7M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 3.18M, False: 18.5M]
  |  |  ------------------
  |  | 1132|  3.18M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|  3.18M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  3.18M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 483k, False: 2.70M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  3.18M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   483k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 483k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   482k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   482k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 482k, False: 1.28k]
  |  |  |  |  ------------------
  |  |  |  | 1097|   482k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   482k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   482k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|    109|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|    109|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 109, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1103|    109|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    109|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|    109|			break; \
  |  |  |  | 1105|    198|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|    198|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 198, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1106|    198|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    198|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|    198|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    616|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    616|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 616, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    616|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    616|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    616|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    616|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    616|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    616|		return -1; \
  |  |  |  |  |  | 1090|    616|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    616|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 616]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    616|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    616|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    616|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    616|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    616|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 616]
  |  |  |  |  ------------------
  |  |  |  | 1117|    616|				return -1; \
  |  |  |  | 1118|    616|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    616|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    616|			break; \
  |  |  |  | 1120|    616|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|    366|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 366, False: 483k]
  |  |  |  |  ------------------
  |  |  |  | 1121|    366|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    366|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    366|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    366|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    366|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    366|		return -1; \
  |  |  |  |  |  | 1090|    366|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    366|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 366]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    366|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    366|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    366|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    366|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    366|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 366]
  |  |  |  |  ------------------
  |  |  |  | 1123|    366|				return -1; \
  |  |  |  | 1124|    366|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    366|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    366|			break; \
  |  |  |  | 1126|   483k|		} \
  |  |  |  | 1127|  3.18M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  3.18M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 3.18M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  3.18M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  18.5M|	} else { \
  |  | 1134|  18.5M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  18.5M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.5M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 3.28M, False: 15.2M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  18.5M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|  3.28M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 3.28M, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  3.28M|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  3.28M|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 3.28M, False: 407]
  |  |  |  |  ------------------
  |  |  |  | 1097|  3.28M|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  3.28M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  3.28M|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     34|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|     34|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 34, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1106|     34|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     34|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     34|			break; \
  |  |  |  | 1108|    180|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|    180|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 180, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1109|    180|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    180|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|    180|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 0, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|				return -1; \
  |  |  |  | 1118|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			break; \
  |  |  |  | 1120|    193|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|    193|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 193, False: 3.28M]
  |  |  |  |  ------------------
  |  |  |  | 1121|    193|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    193|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    386|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 70, False: 123]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    193|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    263|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 70]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    193|		return -1; \
  |  |  |  |  |  | 1090|    193|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 193]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    193|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    193|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    193|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 193]
  |  |  |  |  ------------------
  |  |  |  | 1123|    193|				return -1; \
  |  |  |  | 1124|    193|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    193|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    193|			break; \
  |  |  |  | 1126|  3.28M|		} \
  |  |  |  | 1127|  18.5M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  18.5M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 18.5M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  18.5M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  18.5M|	}
  ------------------
 1155|  21.7M|	return 0;
 1156|  21.7M|}
softmagic.c:cvt_64:
 1160|  2.05M|{
 1161|  2.05M|	DO_CVT(m, q, 64);
  ------------------
  |  | 1131|  2.05M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  2.05M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 778k, False: 1.28M]
  |  |  ------------------
  |  | 1132|   778k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|   778k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|   778k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 235k, False: 542k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   778k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   235k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 235k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   235k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   235k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 235k, False: 70]
  |  |  |  |  ------------------
  |  |  |  | 1097|   235k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   235k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   235k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     70|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|     70|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 70, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     70|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     70|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|      0|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|      0|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 0, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1115|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1117|      0|				return -1; \
  |  |  |  | 1118|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|      0|			break; \
  |  |  |  | 1120|      0|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|      0|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 0, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1121|      0|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|      0|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|      0|		return -1; \
  |  |  |  |  |  | 1090|      0|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|      0|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|      0|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|				return -1; \
  |  |  |  | 1124|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|      0|			break; \
  |  |  |  | 1126|   235k|		} \
  |  |  |  | 1127|   778k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|   778k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 778k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   778k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  1.28M|	} else { \
  |  | 1134|  1.28M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  1.28M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  1.28M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 35.3k, False: 1.24M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.28M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|  35.3k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 35.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  33.4k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  33.4k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 33.4k, False: 1.80k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  33.4k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  33.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  33.4k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 35.3k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|      0|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|      0|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 0, False: 35.3k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|      0|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|      0|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 0, False: 35.3k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 35.3k]
  |  |  |  |  ------------------
  |  |  |  | 1109|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|      0|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 35.3k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    176|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    176|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 176, False: 35.1k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    176|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    176|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    176|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 176]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    176|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    176|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    176|		return -1; \
  |  |  |  |  |  | 1090|    176|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    176|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    352|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 18, False: 158]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    176|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     18|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    194|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 18]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    176|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    176|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    176|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 176]
  |  |  |  |  ------------------
  |  |  |  | 1117|    176|				return -1; \
  |  |  |  | 1118|    176|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    176|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    176|			break; \
  |  |  |  | 1120|  1.63k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|  1.63k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 1.63k, False: 33.6k]
  |  |  |  |  ------------------
  |  |  |  | 1121|  1.63k|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  1.63k|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  1.63k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 1.63k]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|  1.63k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  1.63k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|  1.63k|		return -1; \
  |  |  |  |  |  | 1090|  1.63k|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  1.63k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  3.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 1.63k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|  1.63k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  1.63k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|  1.63k|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|  1.63k|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  1.63k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 1.63k]
  |  |  |  |  ------------------
  |  |  |  | 1123|  1.63k|				return -1; \
  |  |  |  | 1124|  1.63k|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  1.63k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|  1.63k|			break; \
  |  |  |  | 1126|  35.3k|		} \
  |  |  |  | 1127|  1.28M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  1.28M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.28M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.28M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  1.28M|	}
  ------------------
 1162|  2.05M|	return 0;
 1163|  2.05M|}
softmagic.c:cvt_float:
 1186|  3.28k|{
 1187|  3.28k|	DO_CVT2(f, float);
  ------------------
  |  | 1166|  3.28k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  388|  3.28k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1166:6): [True: 0, False: 3.28k]
  |  |  ------------------
  |  | 1167|  3.28k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  360|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1167:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1168|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  355|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1168:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1169|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1170|      0|			break; \
  |  | 1171|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1171:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1172|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1173|      0|			break; \
  |  | 1174|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1174:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1175|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1176|      0|			break; \
  |  | 1177|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  358|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1177:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1178|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1178:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1179|      0|				return -1; \
  |  | 1180|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1181|      0|			break; \
  |  | 1182|      0|		} \
  ------------------
 1188|  3.28k|	return 0;
 1189|  3.28k|}
softmagic.c:cvt_double:
 1193|    708|{
 1194|    708|	DO_CVT2(d, double);
  ------------------
  |  | 1166|    708|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  388|    708|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1166:6): [True: 0, False: 708]
  |  |  ------------------
  |  | 1167|    708|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  360|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1167:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1168|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  355|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1168:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1169|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1170|      0|			break; \
  |  | 1171|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1171:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1172|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1173|      0|			break; \
  |  | 1174|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1174:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1175|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1176|      0|			break; \
  |  | 1177|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  358|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1177:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1178|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1178:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1179|      0|				return -1; \
  |  | 1180|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1181|      0|			break; \
  |  | 1182|      0|		} \
  ------------------
 1195|    708|	return 0;
 1196|    708|}
softmagic.c:magiccheck:
 2168|   100M|{
 2169|   100M|	uint64_t l = m->value.q;
 2170|   100M|	uint64_t v;
 2171|   100M|	float fl, fv;
 2172|   100M|	double dl, dv;
 2173|   100M|	int matched;
 2174|   100M|	union VALUETYPE *p = &ms->ms_value;
 2175|       |
 2176|   100M|	switch (m->type) {
 2177|  1.82M|	case FILE_BYTE:
  ------------------
  |  |  254|  1.82M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2177:2): [True: 1.82M, False: 98.9M]
  ------------------
 2178|  1.82M|		v = p->b;
 2179|  1.82M|		break;
 2180|       |
 2181|  1.85M|	case FILE_SHORT:
  ------------------
  |  |  255|  1.85M|#define				FILE_SHORT		2
  ------------------
  |  Branch (2181:2): [True: 1.85M, False: 98.9M]
  ------------------
 2182|  6.35M|	case FILE_BESHORT:
  ------------------
  |  |  260|  6.35M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2182:2): [True: 4.49M, False: 96.3M]
  ------------------
 2183|  10.7M|	case FILE_LESHORT:
  ------------------
  |  |  263|  10.7M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2183:2): [True: 4.43M, False: 96.3M]
  ------------------
 2184|  10.7M|	case FILE_MSDOSDATE:
  ------------------
  |  |  308|  10.7M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (2184:2): [True: 0, False: 100M]
  ------------------
 2185|  10.7M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|  10.7M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (2185:2): [True: 213, False: 100M]
  ------------------
 2186|  10.7M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|  10.7M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (2186:2): [True: 0, False: 100M]
  ------------------
 2187|  10.7M|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|  10.7M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (2187:2): [True: 0, False: 100M]
  ------------------
 2188|  10.7M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|  10.7M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (2188:2): [True: 213, False: 100M]
  ------------------
 2189|  10.7M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|  10.7M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (2189:2): [True: 0, False: 100M]
  ------------------
 2190|  10.7M|		v = p->h;
 2191|  10.7M|		break;
 2192|       |
 2193|  1.60M|	case FILE_LONG:
  ------------------
  |  |  257|  1.60M|#define				FILE_LONG		4
  ------------------
  |  Branch (2193:2): [True: 1.60M, False: 99.1M]
  ------------------
 2194|  15.0M|	case FILE_BELONG:
  ------------------
  |  |  261|  15.0M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2194:2): [True: 13.4M, False: 87.3M]
  ------------------
 2195|  21.7M|	case FILE_LELONG:
  ------------------
  |  |  264|  21.7M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2195:2): [True: 6.66M, False: 94.1M]
  ------------------
 2196|  21.7M|	case FILE_MELONG:
  ------------------
  |  |  276|  21.7M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2196:2): [True: 34, False: 100M]
  ------------------
 2197|  21.7M|	case FILE_DATE:
  ------------------
  |  |  259|  21.7M|#define				FILE_DATE		6
  ------------------
  |  Branch (2197:2): [True: 0, False: 100M]
  ------------------
 2198|  21.7M|	case FILE_BEDATE:
  ------------------
  |  |  262|  21.7M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2198:2): [True: 388, False: 100M]
  ------------------
 2199|  21.7M|	case FILE_LEDATE:
  ------------------
  |  |  265|  21.7M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2199:2): [True: 753, False: 100M]
  ------------------
 2200|  21.7M|	case FILE_MEDATE:
  ------------------
  |  |  274|  21.7M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2200:2): [True: 42, False: 100M]
  ------------------
 2201|  21.7M|	case FILE_LDATE:
  ------------------
  |  |  267|  21.7M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2201:2): [True: 0, False: 100M]
  ------------------
 2202|  21.7M|	case FILE_BELDATE:
  ------------------
  |  |  268|  21.7M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2202:2): [True: 294, False: 100M]
  ------------------
 2203|  21.7M|	case FILE_LELDATE:
  ------------------
  |  |  269|  21.7M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2203:2): [True: 34, False: 100M]
  ------------------
 2204|  21.7M|	case FILE_MELDATE:
  ------------------
  |  |  275|  21.7M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2204:2): [True: 0, False: 100M]
  ------------------
 2205|  21.7M|		v = p->l;
 2206|  21.7M|		break;
 2207|       |
 2208|  70.1k|	case FILE_QUAD:
  ------------------
  |  |  277|  70.1k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2208:2): [True: 70.1k, False: 100M]
  ------------------
 2209|   971k|	case FILE_LEQUAD:
  ------------------
  |  |  278|   971k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2209:2): [True: 901k, False: 99.9M]
  ------------------
 2210|  2.05M|	case FILE_BEQUAD:
  ------------------
  |  |  279|  2.05M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2210:2): [True: 1.07M, False: 99.7M]
  ------------------
 2211|  2.05M|	case FILE_QDATE:
  ------------------
  |  |  280|  2.05M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2211:2): [True: 0, False: 100M]
  ------------------
 2212|  2.05M|	case FILE_BEQDATE:
  ------------------
  |  |  282|  2.05M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2212:2): [True: 386, False: 100M]
  ------------------
 2213|  2.05M|	case FILE_LEQDATE:
  ------------------
  |  |  281|  2.05M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2213:2): [True: 0, False: 100M]
  ------------------
 2214|  2.05M|	case FILE_QLDATE:
  ------------------
  |  |  283|  2.05M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2214:2): [True: 0, False: 100M]
  ------------------
 2215|  2.05M|	case FILE_BEQLDATE:
  ------------------
  |  |  285|  2.05M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2215:2): [True: 176, False: 100M]
  ------------------
 2216|  2.05M|	case FILE_LEQLDATE:
  ------------------
  |  |  284|  2.05M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2216:2): [True: 10, False: 100M]
  ------------------
 2217|  2.05M|	case FILE_QWDATE:
  ------------------
  |  |  295|  2.05M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2217:2): [True: 373, False: 100M]
  ------------------
 2218|  2.05M|	case FILE_BEQWDATE:
  ------------------
  |  |  297|  2.05M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2218:2): [True: 0, False: 100M]
  ------------------
 2219|  2.05M|	case FILE_LEQWDATE:
  ------------------
  |  |  296|  2.05M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2219:2): [True: 1.34k, False: 100M]
  ------------------
 2220|  2.05M|	case FILE_OFFSET:
  ------------------
  |  |  305|  2.05M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (2220:2): [True: 6.71k, False: 100M]
  ------------------
 2221|  2.05M|		v = p->q;
 2222|  2.05M|		break;
 2223|       |
 2224|      0|	case FILE_FLOAT:
  ------------------
  |  |  286|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2224:2): [True: 0, False: 100M]
  ------------------
 2225|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2225:2): [True: 0, False: 100M]
  ------------------
 2226|  3.28k|	case FILE_LEFLOAT:
  ------------------
  |  |  288|  3.28k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2226:2): [True: 3.28k, False: 100M]
  ------------------
 2227|  3.28k|		fl = m->value.f;
 2228|  3.28k|		fv = p->f;
 2229|  3.28k|		switch (m->reln) {
 2230|    399|		case 'x':
  ------------------
  |  Branch (2230:3): [True: 399, False: 2.88k]
  ------------------
 2231|    399|			matched = 1;
 2232|    399|			break;
 2233|       |
 2234|      0|		case '!':
  ------------------
  |  Branch (2234:3): [True: 0, False: 3.28k]
  ------------------
 2235|      0|			matched = isunordered(fl, fv) ? 1 : fv != fl;
  ------------------
  |  Branch (2235:14): [True: 0, False: 0]
  ------------------
 2236|      0|			break;
 2237|       |
 2238|      0|		case '=':
  ------------------
  |  Branch (2238:3): [True: 0, False: 3.28k]
  ------------------
 2239|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
  ------------------
  |  Branch (2239:14): [True: 0, False: 0]
  ------------------
 2240|      0|			break;
 2241|       |
 2242|  2.88k|		case '>':
  ------------------
  |  Branch (2242:3): [True: 2.88k, False: 399]
  ------------------
 2243|  2.88k|			matched = isgreater(fv, fl);
 2244|  2.88k|			break;
 2245|       |
 2246|      0|		case '<':
  ------------------
  |  Branch (2246:3): [True: 0, False: 3.28k]
  ------------------
 2247|      0|			matched = isless(fv, fl);
 2248|      0|			break;
 2249|       |
 2250|      0|		default:
  ------------------
  |  Branch (2250:3): [True: 0, False: 3.28k]
  ------------------
 2251|      0|			file_magerror(ms, "cannot happen with float: "
 2252|      0|			    "invalid relation `%c'", m->reln);
 2253|      0|			return -1;
 2254|  3.28k|		}
 2255|  3.28k|		return matched;
 2256|       |
 2257|      0|	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2257:2): [True: 0, False: 100M]
  ------------------
 2258|    134|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|    134|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2258:2): [True: 134, False: 100M]
  ------------------
 2259|    708|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    708|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2259:2): [True: 574, False: 100M]
  ------------------
 2260|    708|		dl = m->value.d;
 2261|    708|		dv = p->d;
 2262|    708|		switch (m->reln) {
 2263|    510|		case 'x':
  ------------------
  |  Branch (2263:3): [True: 510, False: 198]
  ------------------
 2264|    510|			matched = 1;
 2265|    510|			break;
 2266|       |
 2267|      0|		case '!':
  ------------------
  |  Branch (2267:3): [True: 0, False: 708]
  ------------------
 2268|      0|			matched = isunordered(dv, dl) ? 1 : dv != dl;
  ------------------
  |  Branch (2268:14): [True: 0, False: 0]
  ------------------
 2269|      0|			break;
 2270|       |
 2271|    198|		case '=':
  ------------------
  |  Branch (2271:3): [True: 198, False: 510]
  ------------------
 2272|    198|			matched = isunordered(dv, dl) ? 0 : dv == dl;
  ------------------
  |  Branch (2272:14): [True: 90, False: 108]
  ------------------
 2273|    198|			break;
 2274|       |
 2275|      0|		case '>':
  ------------------
  |  Branch (2275:3): [True: 0, False: 708]
  ------------------
 2276|      0|			matched = isgreater(dv, dl);
 2277|      0|			break;
 2278|       |
 2279|      0|		case '<':
  ------------------
  |  Branch (2279:3): [True: 0, False: 708]
  ------------------
 2280|      0|			matched = isless(dv, dl);
 2281|      0|			break;
 2282|       |
 2283|      0|		default:
  ------------------
  |  Branch (2283:3): [True: 0, False: 708]
  ------------------
 2284|      0|			file_magerror(ms, "cannot happen with double: "
 2285|      0|			    "invalid relation `%c'", m->reln);
 2286|      0|			return -1;
 2287|    708|		}
 2288|    708|		return matched;
 2289|       |
 2290|  12.8k|	case FILE_DEFAULT:
  ------------------
  |  |  256|  12.8k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2290:2): [True: 12.8k, False: 100M]
  ------------------
 2291|  16.0k|	case FILE_CLEAR:
  ------------------
  |  |  300|  16.0k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2291:2): [True: 3.24k, False: 100M]
  ------------------
 2292|  16.0k|		l = 0;
 2293|  16.0k|		v = 0;
 2294|  16.0k|		break;
 2295|       |
 2296|  62.3M|	case FILE_STRING:
  ------------------
  |  |  258|  62.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (2296:2): [True: 62.3M, False: 38.4M]
  ------------------
 2297|  62.3M|	case FILE_PSTRING:
  ------------------
  |  |  266|  62.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2297:2): [True: 26.2k, False: 100M]
  ------------------
 2298|  62.3M|	case FILE_OCTAL:
  ------------------
  |  |  314|  62.3M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (2298:2): [True: 0, False: 100M]
  ------------------
 2299|  62.3M|		l = 0;
 2300|  62.3M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  460|  62.3M|#define CAST(T, b)	((T)(b))
  ------------------
 2301|  62.3M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  390|  62.3M|#define str_flags _u._s._flags
  ------------------
 2302|  62.3M|		break;
 2303|       |
 2304|    148|	case FILE_BESTRING16:
  ------------------
  |  |  271|    148|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2304:2): [True: 148, False: 100M]
  ------------------
 2305|  68.0k|	case FILE_LESTRING16:
  ------------------
  |  |  272|  68.0k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2305:2): [True: 67.8k, False: 100M]
  ------------------
 2306|  68.0k|		l = 0;
 2307|  68.0k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  460|  68.0k|#define CAST(T, b)	((T)(b))
  ------------------
 2308|  68.0k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  390|  68.0k|#define str_flags _u._s._flags
  ------------------
 2309|  68.0k|		break;
 2310|       |
 2311|   704k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  273|   704k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2311:2): [True: 704k, False: 100M]
  ------------------
 2312|   704k|		size_t slen;
 2313|   704k|		size_t idx;
 2314|       |
 2315|   704k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2315:7): [True: 0, False: 704k]
  ------------------
 2316|      0|			return 0;
 2317|       |
 2318|   704k|		slen = MIN(m->vallen, sizeof(m->value.s));
  ------------------
  |  Branch (2318:10): [True: 704k, False: 0]
  ------------------
 2319|   704k|		l = 0;
 2320|   704k|		v = 0;
 2321|   704k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   704k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2321:7): [True: 0, False: 704k]
  ------------------
 2322|      0|			size_t xlen = ms->search.s_len > 100 ? 100
  ------------------
  |  Branch (2322:18): [True: 0, False: 0]
  ------------------
 2323|      0|			    : ms->search.s_len;
 2324|       |
 2325|      0|			fprintf(stderr, "search: [");
 2326|      0|			file_showstr(stderr, ms->search.s, xlen);
 2327|      0|			fprintf(stderr, "%s] for [", ms->search.s_len == xlen
  ------------------
  |  Branch (2327:33): [True: 0, False: 0]
  ------------------
 2328|      0|			    ? "" : "...");
 2329|      0|			file_showstr(stderr, m->value.s, slen);
 2330|      0|		}
 2331|   704k|#ifdef HAVE_MEMMEM
 2332|   704k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  390|   704k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2332:7): [True: 704k, False: 0]
  |  Branch (2332:19): [True: 330k, False: 373k]
  ------------------
 2333|   330k|			const char *found;
 2334|   330k|			idx = m->str_range + slen;
  ------------------
  |  |  389|   330k|#define str_range _u._s._count
  ------------------
 2335|   330k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  389|   330k|#define str_range _u._s._count
  ------------------
  |  Branch (2335:8): [True: 4.47k, False: 326k]
  |  Branch (2335:29): [True: 111k, False: 215k]
  ------------------
 2336|   115k|				idx = ms->search.s_len;
 2337|   330k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  460|   330k|#define CAST(T, b)	((T)(b))
  ------------------
 2338|   330k|			    m->value.s, slen));
 2339|   330k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   330k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2339:8): [True: 0, False: 330k]
  ------------------
 2340|      0|				fprintf(stderr, "] %sfound\n",
 2341|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2341:9): [True: 0, False: 0]
  ------------------
 2342|      0|			}
 2343|   330k|			if (!found) {
  ------------------
  |  Branch (2343:8): [True: 328k, False: 2.44k]
  ------------------
 2344|   328k|				v = 1;
 2345|   328k|				break;
 2346|   328k|			}
 2347|  2.44k|			idx = found - ms->search.s;
 2348|  2.44k|			ms->search.offset += idx;
 2349|  2.44k|			ms->search.rm_len = ms->search.s_len - idx;
 2350|  2.44k|			break;
 2351|   330k|		}
 2352|   373k|#endif
 2353|       |
 2354|  5.03G|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  389|  5.03G|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  389|  5.03G|#define str_range _u._s._count
  ------------------
  |  Branch (2354:17): [True: 0, False: 5.03G]
  |  Branch (2354:38): [True: 5.03G, False: 194k]
  ------------------
 2355|  5.03G|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2355:8): [True: 178k, False: 5.03G]
  ------------------
 2356|   178k|				v = 1;
 2357|   178k|				break;
 2358|   178k|			}
 2359|       |
 2360|  5.03G|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2361|  5.03G|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  390|  5.03G|#define str_flags _u._s._flags
  ------------------
 2362|  5.03G|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2362:8): [True: 780, False: 5.03G]
  ------------------
 2363|    780|				ms->search.offset += idx;
 2364|    780|				ms->search.rm_len = ms->search.s_len - idx;
 2365|    780|				break;
 2366|    780|			}
 2367|  5.03G|		}
 2368|   373k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   373k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2368:7): [True: 0, False: 373k]
  ------------------
 2369|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2369:35): [True: 0, False: 0]
  ------------------
 2370|      0|		}
 2371|   373k|		break;
 2372|   704k|	}
 2373|   493k|	case FILE_REGEX: {
  ------------------
  |  |  270|   493k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2373:2): [True: 493k, False: 100M]
  ------------------
 2374|   493k|		int rc;
 2375|   493k|		file_regex_t *rx = *m_cache;
 2376|   493k|		const char *search;
 2377|   493k|		regmatch_t pmatch;
 2378|   493k|		size_t slen = ms->search.s_len;
 2379|   493k|		char *copy;
 2380|       |
 2381|   493k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2381:7): [True: 34, False: 493k]
  ------------------
 2382|     34|			return 0;
 2383|       |
 2384|   493k|		if (rx == NULL) {
  ------------------
  |  Branch (2384:7): [True: 169, False: 493k]
  ------------------
 2385|    169|			rx = *m_cache = alloc_regex(ms, m);
 2386|    169|			if (rx == NULL)
  ------------------
  |  Branch (2386:8): [True: 0, False: 169]
  ------------------
 2387|      0|				return -1;
 2388|    169|		}
 2389|   493k|		l = 0;
 2390|   493k|		if (slen != 0) {
  ------------------
  |  Branch (2390:7): [True: 489k, False: 4.23k]
  ------------------
 2391|   489k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  460|   489k|#define CAST(T, b)	((T)(b))
  ------------------
 2392|   489k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2392:11): [True: 0, False: 489k]
  ------------------
 2393|      0|			file_error(ms, errno,
 2394|      0|			    "can't allocate %" SIZE_T_FORMAT "u bytes",
 2395|      0|			    slen);
 2396|      0|			return -1;
 2397|      0|		    }
 2398|   489k|		    memcpy(copy, ms->search.s, slen);
 2399|   489k|		    copy[--slen] = '\0';
 2400|   489k|		    search = copy;
 2401|   489k|		} else {
 2402|  4.23k|		    search = CCAST(char *, "");
  ------------------
  |  |  462|  4.23k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2403|  4.23k|		    copy = NULL;
 2404|  4.23k|		}
 2405|   493k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  461|   493k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2406|   493k|		    1, &pmatch, 0);
 2407|   493k|		free(copy);
 2408|   493k|		switch (rc) {
 2409|  3.41k|		case 0:
  ------------------
  |  Branch (2409:3): [True: 3.41k, False: 489k]
  ------------------
 2410|  3.41k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  460|  3.41k|#define CAST(T, b)	((T)(b))
  ------------------
 2411|  3.41k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  460|  3.41k|#define CAST(T, b)	((T)(b))
  ------------------
 2412|  3.41k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  460|  3.41k|#define CAST(T, b)	((T)(b))
  ------------------
 2413|  3.41k|			    pmatch.rm_eo - pmatch.rm_so);
 2414|  3.41k|			v = 0;
 2415|  3.41k|			break;
 2416|       |
 2417|   489k|		case REG_NOMATCH:
  ------------------
  |  Branch (2417:3): [True: 489k, False: 3.41k]
  ------------------
 2418|   489k|			v = 1;
 2419|   489k|			break;
 2420|       |
 2421|      0|		default:
  ------------------
  |  Branch (2421:3): [True: 0, False: 493k]
  ------------------
 2422|      0|			return -1;
 2423|   493k|		}
 2424|   493k|		break;
 2425|   493k|	}
 2426|   493k|	case FILE_USE:
  ------------------
  |  |  299|  60.2k|#define				FILE_USE		46
  ------------------
  |  Branch (2426:2): [True: 60.2k, False: 100M]
  ------------------
 2427|  60.2k|		return ms->ms_value.q != 0;
 2428|  66.6k|	case FILE_NAME:
  ------------------
  |  |  298|  66.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (2428:2): [True: 66.6k, False: 100M]
  ------------------
 2429|  80.6k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  80.6k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2429:2): [True: 14.0k, False: 100M]
  ------------------
 2430|  80.6k|		return 1;
 2431|   417k|	case FILE_DER:
  ------------------
  |  |  301|   417k|#define				FILE_DER		48
  ------------------
  |  Branch (2431:2): [True: 417k, False: 100M]
  ------------------
 2432|   417k|		matched = der_cmp(ms, m);
 2433|   417k|		if (matched == -1) {
  ------------------
  |  Branch (2433:7): [True: 147k, False: 270k]
  ------------------
 2434|   147k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   147k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2434:8): [True: 0, False: 147k]
  ------------------
 2435|      0|				(void) fprintf(stderr,
 2436|      0|				    "EOF comparing DER entries\n");
 2437|      0|			}
 2438|   147k|			return 0;
 2439|   147k|		}
 2440|   270k|		return matched;
 2441|     84|	case FILE_BEGUID:
  ------------------
  |  |  304|     84|#define				FILE_BEGUID		51
  ------------------
  |  Branch (2441:2): [True: 84, False: 100M]
  ------------------
 2442|     84|	case FILE_LEGUID:
  ------------------
  |  |  303|     84|#define				FILE_LEGUID		50
  ------------------
  |  Branch (2442:2): [True: 0, False: 100M]
  ------------------
 2443|   188k|	case FILE_GUID:
  ------------------
  |  |  302|   188k|#define				FILE_GUID		49
  ------------------
  |  Branch (2443:2): [True: 188k, False: 100M]
  ------------------
 2444|   188k|		l = 0;
 2445|   188k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2446|   188k|		break;
 2447|      0|	default:
  ------------------
  |  Branch (2447:2): [True: 0, False: 100M]
  ------------------
 2448|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2449|      0|		return -1;
 2450|   100M|	}
 2451|       |
 2452|   100M|	v = file_signextend(ms, m, v);
 2453|       |
 2454|   100M|	switch (m->reln) {
 2455|   114k|	case 'x':
  ------------------
  |  Branch (2455:2): [True: 114k, False: 100M]
  ------------------
 2456|   114k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   114k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2456:7): [True: 0, False: 114k]
  ------------------
 2457|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT
 2458|      0|			    "u == *any* = 1", CAST(unsigned long long, v));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2459|   114k|		matched = 1;
 2460|   114k|		break;
 2461|       |
 2462|  70.2k|	case '!':
  ------------------
  |  Branch (2462:2): [True: 70.2k, False: 100M]
  ------------------
 2463|  70.2k|		matched = v != l;
 2464|  70.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  70.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2464:7): [True: 0, False: 70.2k]
  ------------------
 2465|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u != %"
 2466|      0|			    INT64_T_FORMAT "u = %d",
 2467|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2468|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2469|  70.2k|		break;
 2470|       |
 2471|  99.3M|	case '=':
  ------------------
  |  Branch (2471:2): [True: 99.3M, False: 846k]
  ------------------
 2472|  99.3M|		matched = v == l;
 2473|  99.3M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  99.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2473:7): [True: 0, False: 99.3M]
  ------------------
 2474|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u == %"
 2475|      0|			    INT64_T_FORMAT "u = %d",
 2476|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2477|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2478|  99.3M|		break;
 2479|       |
 2480|   274k|	case '>':
  ------------------
  |  Branch (2480:2): [True: 274k, False: 99.9M]
  ------------------
 2481|   274k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  237|   274k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2481:7): [True: 197k, False: 76.9k]
  ------------------
 2482|   197k|			matched = v > l;
 2483|   197k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   197k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2483:8): [True: 0, False: 197k]
  ------------------
 2484|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2485|      0|				    "u > %" INT64_T_FORMAT "u = %d",
 2486|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2487|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2488|   197k|		}
 2489|  76.9k|		else {
 2490|  76.9k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  460|  76.9k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  460|  76.9k|#define CAST(T, b)	((T)(b))
  ------------------
 2491|  76.9k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  76.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2491:8): [True: 0, False: 76.9k]
  ------------------
 2492|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2493|      0|				    "d > %" INT64_T_FORMAT "d = %d",
 2494|      0|				    CAST(long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2495|      0|				    CAST(long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2496|  76.9k|		}
 2497|   274k|		break;
 2498|       |
 2499|   344k|	case '<':
  ------------------
  |  Branch (2499:2): [True: 344k, False: 99.8M]
  ------------------
 2500|   344k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  237|   344k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2500:7): [True: 291k, False: 52.9k]
  ------------------
 2501|   291k|			matched = v < l;
 2502|   291k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   291k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2502:8): [True: 0, False: 291k]
  ------------------
 2503|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2504|      0|				    "u < %" INT64_T_FORMAT "u = %d",
 2505|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2506|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2507|   291k|		}
 2508|  52.9k|		else {
 2509|  52.9k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  460|  52.9k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  460|  52.9k|#define CAST(T, b)	((T)(b))
  ------------------
 2510|  52.9k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  52.9k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2510:8): [True: 0, False: 52.9k]
  ------------------
 2511|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2512|      0|				    "d < %" INT64_T_FORMAT "d = %d",
 2513|      0|				     CAST(long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2514|      0|				     CAST(long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2515|  52.9k|		}
 2516|   344k|		break;
 2517|       |
 2518|  39.8k|	case '&':
  ------------------
  |  Branch (2518:2): [True: 39.8k, False: 100M]
  ------------------
 2519|  39.8k|		matched = (v & l) == l;
 2520|  39.8k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  39.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2520:7): [True: 0, False: 39.8k]
  ------------------
 2521|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2522|      0|			    INT64_T_FORMAT "x) == %" INT64_T_FORMAT
 2523|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2524|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2525|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2526|      0|			    matched);
 2527|  39.8k|		break;
 2528|       |
 2529|  2.98k|	case '^':
  ------------------
  |  Branch (2529:2): [True: 2.98k, False: 100M]
  ------------------
 2530|  2.98k|		matched = (v & l) != l;
 2531|  2.98k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.98k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2531:7): [True: 0, False: 2.98k]
  ------------------
 2532|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2533|      0|			    INT64_T_FORMAT "x) != %" INT64_T_FORMAT
 2534|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2535|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2536|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2537|  2.98k|		break;
 2538|       |
 2539|      0|	default:
  ------------------
  |  Branch (2539:2): [True: 0, False: 100M]
  ------------------
 2540|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2541|      0|		    m->reln);
 2542|      0|		return -1;
 2543|   100M|	}
 2544|   100M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   100M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2544:6): [True: 0, False: 100M]
  ------------------
 2545|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2546|      0|		    file_magic_strength(m, 1));
 2547|      0|	}
 2548|       |
 2549|   100M|	return matched;
 2550|   100M|}
softmagic.c:file_strncmp:
 2058|  5.10G|{
 2059|       |	/*
 2060|       |	 * Convert the source args to unsigned here so that (1) the
 2061|       |	 * compare will be unsigned as it is in strncmp() and (2) so
 2062|       |	 * the ctype functions will work correctly without extra
 2063|       |	 * casting.
 2064|       |	 */
 2065|  5.10G|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  461|  5.10G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2066|  5.10G|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  461|  5.10G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2067|  5.10G|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  404|  5.10G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  403|  5.10G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2068|  5.10G|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  405|  5.10G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  403|  5.10G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2069|  5.10G|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (2069:33): [True: 56.9M, False: 5.04G]
  ------------------
 2070|  5.10G|	uint64_t v;
 2071|       |
 2072|       |	/*
 2073|       |	 * What we want here is v = strncmp(s1, s2, len),
 2074|       |	 * but ignoring any nulls.
 2075|       |	 */
 2076|  5.10G|	v = 0;
 2077|  5.10G|	len++;
 2078|  5.10G|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2078:6): [True: 59.1M, False: 5.04G]
  ------------------
 2079|  60.1M|		while (--len > 0)
  ------------------
  |  Branch (2079:10): [True: 60.0M, False: 50.9k]
  ------------------
 2080|  60.0M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2080:8): [True: 59.1M, False: 966k]
  ------------------
 2081|  59.1M|				break;
 2082|  59.1M|	}
 2083|  5.04G|	else { /* combine the others */
 2084|  5.04G|		while (--len > 0) {
  ------------------
  |  Branch (2084:10): [True: 5.04G, False: 34.7k]
  ------------------
 2085|  5.04G|			if (b >= eb) {
  ------------------
  |  Branch (2085:8): [True: 253k, False: 5.04G]
  ------------------
 2086|   253k|				v = 1;
 2087|   253k|				break;
 2088|   253k|			}
 2089|  5.04G|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  406|  5.04G|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  403|  5.04G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2089:8): [True: 56.9M, False: 4.98G]
  ------------------
 2090|  5.04G|			    islower(*a)) {
  ------------------
  |  Branch (2090:8): [True: 3.32M, False: 53.6M]
  ------------------
 2091|  3.32M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2091:9): [True: 3.29M, False: 29.5k]
  |  Branch (2091:14): [True: 0, False: 0]
  |  Branch (2091:14): [Folded, False: 0]
  |  Branch (2091:14): [Folded, False: 3.32M]
  ------------------
 2092|  3.29M|					break;
 2093|  3.32M|			}
 2094|  5.03G|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  407|  5.03G|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  403|  5.03G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2094:13): [True: 17.2k, False: 5.03G]
  ------------------
 2095|  5.03G|			    isupper(*a)) {
  ------------------
  |  Branch (2095:8): [True: 15.9k, False: 1.25k]
  ------------------
 2096|  15.9k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2096:9): [True: 15.8k, False: 150]
  |  Branch (2096:14): [True: 0, False: 0]
  |  Branch (2096:14): [Folded, False: 0]
  |  Branch (2096:14): [Folded, False: 15.9k]
  ------------------
 2097|  15.8k|					break;
 2098|  15.9k|			}
 2099|  5.03G|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  404|  5.03G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  403|  5.03G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2099:13): [True: 43.4M, False: 4.99G]
  ------------------
 2100|  5.03G|			    isspace(*a)) {
  ------------------
  |  Branch (2100:8): [True: 1.51M, False: 41.9M]
  ------------------
 2101|  1.51M|				a++;
 2102|  1.51M|				if (isspace(*b)) {
  ------------------
  |  Branch (2102:9): [True: 264k, False: 1.25M]
  ------------------
 2103|   264k|					b++;
 2104|   264k|					if (!isspace(*a))
  ------------------
  |  Branch (2104:10): [True: 264k, False: 0]
  ------------------
 2105|  11.7G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2105:14): [True: 11.7G, False: 253k]
  |  Branch (2105:24): [True: 11.7G, False: 11.0k]
  ------------------
 2106|  11.7G|							b++;
 2107|   264k|				}
 2108|  1.25M|				else {
 2109|  1.25M|					v = 1;
 2110|  1.25M|					break;
 2111|  1.25M|				}
 2112|  1.51M|			}
 2113|  5.03G|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  405|  5.03G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  403|  5.03G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2113:13): [True: 13.6M, False: 5.02G]
  ------------------
 2114|  5.03G|			    isspace(*a)) {
  ------------------
  |  Branch (2114:8): [True: 2.29k, False: 13.6M]
  ------------------
 2115|  2.29k|				a++;
 2116|  9.20k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2116:12): [True: 9.13k, False: 63]
  |  Branch (2116:22): [True: 6.91k, False: 2.22k]
  ------------------
 2117|  6.91k|					b++;
 2118|  2.29k|			}
 2119|  5.03G|			else {
 2120|  5.03G|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2120:9): [True: 5.03G, False: 1.90M]
  ------------------
 2121|  5.03G|					break;
 2122|  5.03G|			}
 2123|  5.04G|		}
 2124|  5.04G|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  422|  34.7k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  403|  34.7k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2124:7): [True: 34.7k, False: 5.04G]
  |  Branch (2124:19): [True: 34.7k, False: 0]
  |  Branch (2124:29): [True: 102, False: 34.6k]
  ------------------
 2125|    102|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2125:8): [True: 68, False: 34]
  |  Branch (2125:14): [True: 34, False: 34]
  ------------------
 2126|     34|				v = 1;
 2127|    102|		}
 2128|  5.04G|	}
 2129|  5.10G|	return v;
 2130|  5.10G|}
softmagic.c:file_strncmp16:
 2135|  68.0k|{
 2136|       |	/*
 2137|       |	 * XXX - The 16-bit string compare probably needs to be done
 2138|       |	 * differently, especially if the flags are to be supported.
 2139|       |	 * At the moment, I am unsure.
 2140|       |	 */
 2141|  68.0k|	flags = 0;
 2142|  68.0k|	return file_strncmp(a, b, len, maxlen, flags);
 2143|  68.0k|}
softmagic.c:alloc_regex:
 2147|    169|{
 2148|    169|	int rc;
 2149|    169|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  460|    169|#define CAST(T, b)	((T)(b))
  ------------------
 2150|       |
 2151|    169|	if (rx == NULL) {
  ------------------
  |  Branch (2151:6): [True: 0, False: 169]
  ------------------
 2152|      0|		file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT
 2153|      0|		    "u bytes", sizeof(*rx));
 2154|      0|		return NULL;
 2155|      0|	}
 2156|       |
 2157|    169|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2158|    169|	    REGEX_ICASE(m));
  ------------------
  |  |  440|    169|#define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  390|    169|#define str_flags _u._s._flags
  |  |  ------------------
  |  |               #define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  439|    169|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  406|    169|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  403|    169|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  407|    169|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  403|    169|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (440:25): [True: 19, False: 150]
  |  |  ------------------
  ------------------
 2159|    169|	if (rc == 0)
  ------------------
  |  Branch (2159:6): [True: 169, False: 0]
  ------------------
 2160|    169|		return rx;
 2161|       |
 2162|      0|	free(rx);
 2163|       |	return NULL;
 2164|    169|}
softmagic.c:handle_annotation:
 2554|   884k|{
 2555|   884k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   884k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2555:6): [True: 0, False: 884k]
  |  Branch (2555:35): [True: 0, False: 0]
  ------------------
 2556|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2556:7): [True: 0, False: 0]
  |  Branch (2556:21): [True: 0, False: 0]
  ------------------
 2557|      0|			return 1;
 2558|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2558:7): [True: 0, False: 0]
  ------------------
 2559|      0|			return -1;
 2560|      0|		if (file_printf(ms, "%.8s", m->apple) == -1)
  ------------------
  |  Branch (2560:7): [True: 0, False: 0]
  ------------------
 2561|      0|			return -1;
 2562|      0|		return 1;
 2563|      0|	}
 2564|   884k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   884k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2564:6): [True: 0, False: 884k]
  |  Branch (2564:39): [True: 0, False: 0]
  ------------------
 2565|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2565:7): [True: 0, False: 0]
  |  Branch (2565:21): [True: 0, False: 0]
  ------------------
 2566|      0|			return 1;
 2567|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2567:7): [True: 0, False: 0]
  ------------------
 2568|      0|			return -1;
 2569|      0|		if (file_printf(ms, "%s", m->ext) == -1)
  ------------------
  |  Branch (2569:7): [True: 0, False: 0]
  ------------------
 2570|      0|			return -1;
 2571|      0|		return 1;
 2572|      0|	}
 2573|   884k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   884k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2573:6): [True: 0, False: 884k]
  |  Branch (2573:39): [True: 0, False: 0]
  ------------------
 2574|      0|		char buf[1024];
 2575|      0|		const char *p;
 2576|      0|		if (!firstline && !(ms->flags & MAGIC_CONTINUE))
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (2576:7): [True: 0, False: 0]
  |  Branch (2576:21): [True: 0, False: 0]
  ------------------
 2577|      0|			return 1;
 2578|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2578:7): [True: 0, False: 0]
  ------------------
 2579|      0|			return -1;
 2580|      0|		if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
  ------------------
  |  Branch (2580:7): [True: 0, False: 0]
  ------------------
 2581|      0|			p = m->mimetype;
 2582|      0|		else
 2583|      0|			p = buf;
 2584|      0|		if (file_printf(ms, "%s", p) == -1)
  ------------------
  |  Branch (2584:7): [True: 0, False: 0]
  ------------------
 2585|      0|			return -1;
 2586|      0|		return 1;
 2587|      0|	}
 2588|   884k|	return 0;
 2589|   884k|}
softmagic.c:varexpand:
  549|   168k|{
  550|   168k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  551|   168k|	size_t l;
  552|       |
  553|   169k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (553:19): [True: 473, False: 168k]
  ------------------
  554|    473|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  460|    473|#define CAST(T, b)	((T)(b))
  ------------------
  555|    473|		if (l >= len)
  ------------------
  |  Branch (555:7): [True: 0, False: 473]
  ------------------
  556|      0|			return -1;
  557|    473|		memcpy(buf, sptr, l);
  558|    473|		buf += l;
  559|    473|		len -= l;
  560|    473|		ptr += 2;
  561|    473|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (561:7): [True: 0, False: 473]
  |  Branch (561:16): [True: 0, False: 473]
  ------------------
  562|      0|			return -1;
  563|  7.09k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (563:26): [True: 7.09k, False: 0]
  |  Branch (563:33): [True: 6.62k, False: 473]
  ------------------
  564|  6.62k|			continue;
  565|    473|		if (*et != ':')
  ------------------
  |  Branch (565:7): [True: 0, False: 473]
  ------------------
  566|      0|			return -1;
  567|  6.62k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (567:25): [True: 6.62k, False: 0]
  |  Branch (567:32): [True: 6.14k, False: 473]
  ------------------
  568|  6.14k|			continue;
  569|    473|		if (*ee != '}')
  ------------------
  |  Branch (569:7): [True: 0, False: 473]
  ------------------
  570|      0|			return -1;
  571|    473|		switch (*ptr) {
  572|    473|		case 'x':
  ------------------
  |  Branch (572:3): [True: 473, False: 0]
  ------------------
  573|    473|			if (ms->mode & 0111) {
  ------------------
  |  Branch (573:8): [True: 1, False: 472]
  ------------------
  574|      1|				ptr = t;
  575|      1|				l = et - t;
  576|    472|			} else {
  577|    472|				ptr = e;
  578|    472|				l = ee - e;
  579|    472|			}
  580|    473|			break;
  581|      0|		default:
  ------------------
  |  Branch (581:3): [True: 0, False: 473]
  ------------------
  582|      0|			return -1;
  583|    473|		}
  584|    473|		if (l >= len)
  ------------------
  |  Branch (584:7): [True: 0, False: 473]
  ------------------
  585|      0|			return -1;
  586|    473|		memcpy(buf, ptr, l);
  587|    473|		buf += l;
  588|    473|		len -= l;
  589|    473|		sptr = ee + 1;
  590|    473|	}
  591|       |
  592|   168k|	l = strlen(sptr);
  593|   168k|	if (l >= len)
  ------------------
  |  Branch (593:6): [True: 0, False: 168k]
  ------------------
  594|      0|		return -1;
  595|       |
  596|   168k|	memcpy(buf, sptr, l);
  597|   168k|	buf[l] = '\0';
  598|   168k|	return 0;
  599|   168k|}
softmagic.c:print_sep:
 2593|  56.2k|{
 2594|  56.2k|	if (firstline)
  ------------------
  |  Branch (2594:6): [True: 14.0k, False: 42.1k]
  ------------------
 2595|  14.0k|		return 0;
 2596|       |	/*
 2597|       |	 * we found another match
 2598|       |	 * put a newline and '-' to do some simple formatting
 2599|       |	 */
 2600|  42.1k|	return file_separator(ms);
 2601|  56.2k|}
softmagic.c:mprint:
  604|   168k|{
  605|   168k|	uint64_t v;
  606|   168k|	float vf;
  607|   168k|	double vd;
  608|   168k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  609|   168k|	const char *desc;
  610|   168k|	union VALUETYPE *p = &ms->ms_value;
  611|       |
  612|   168k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (612:6): [True: 0, False: 168k]
  ------------------
  613|      0|		desc = m->desc;
  614|   168k|	else
  615|   168k|		desc = ebuf;
  616|       |
  617|   168k|#define	PRINTER(value, format, stype, utype)	\
  618|   168k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  619|   168k|	switch (check_fmt(ms, desc)) { \
  620|   168k|	case -1: \
  621|   168k|		return -1; \
  622|   168k|	case 1: \
  623|   168k|		if (m->flag & UNSIGNED) { \
  624|   168k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  625|   168k|			    CAST(utype, v)); \
  626|   168k|		} else { \
  627|   168k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  628|   168k|			    CAST(stype, v)); \
  629|   168k|		} \
  630|   168k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  631|   168k|			return -1; \
  632|   168k|		break; \
  633|   168k|	default: \
  634|   168k|		if (m->flag & UNSIGNED) { \
  635|   168k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  636|   168k|			   CAST(utype, v)) == -1) \
  637|   168k|			   return -1; \
  638|   168k|		} else { \
  639|   168k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  640|   168k|			   CAST(stype, v)) == -1) \
  641|   168k|			   return -1; \
  642|   168k|		} \
  643|   168k|		break; \
  644|   168k|	} \
  645|   168k|	break
  646|       |
  647|   168k|  	switch (m->type) {
  648|  27.4k|  	case FILE_BYTE:
  ------------------
  |  |  254|  27.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (648:4): [True: 27.4k, False: 141k]
  ------------------
  649|  27.4k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  618|  27.4k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  27.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  27.4k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 27.4k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 27.4k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  27.4k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 27.4k, False: 0]
  |  |  ------------------
  |  |  634|  27.4k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  27.4k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 11.8k, False: 15.6k]
  |  |  ------------------
  |  |  635|  11.8k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  11.8k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 11.8k]
  |  |  ------------------
  |  |  636|  11.8k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  11.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  11.8k|			   return -1; \
  |  |  638|  15.6k|		} else { \
  |  |  639|  15.6k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  15.6k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  640|  15.6k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  15.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  15.6k|			   return -1; \
  |  |  642|  15.6k|		} \
  |  |  643|  27.4k|		break; \
  |  |  644|  27.4k|	} \
  |  |  645|  27.4k|	break
  ------------------
  650|       |
  651|  27.4k|  	case FILE_SHORT:
  ------------------
  |  |  255|  1.96k|#define				FILE_SHORT		2
  ------------------
  |  Branch (651:4): [True: 1.96k, False: 166k]
  ------------------
  652|  15.5k|  	case FILE_BESHORT:
  ------------------
  |  |  260|  15.5k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (652:4): [True: 13.5k, False: 154k]
  ------------------
  653|  37.0k|  	case FILE_LESHORT:
  ------------------
  |  |  263|  37.0k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (653:4): [True: 21.5k, False: 147k]
  ------------------
  654|  37.0k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  618|  37.0k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  37.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  37.0k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 37.0k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 37.0k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  37.0k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 37.0k, False: 0]
  |  |  ------------------
  |  |  634|  37.0k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  37.0k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 23.6k, False: 13.3k]
  |  |  ------------------
  |  |  635|  23.6k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  23.6k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 23.6k]
  |  |  ------------------
  |  |  636|  23.6k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  23.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  23.6k|			   return -1; \
  |  |  638|  23.6k|		} else { \
  |  |  639|  13.3k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  13.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 13.3k]
  |  |  ------------------
  |  |  640|  13.3k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  13.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  13.3k|			   return -1; \
  |  |  642|  13.3k|		} \
  |  |  643|  37.0k|		break; \
  |  |  644|  37.0k|	} \
  |  |  645|  37.0k|	break
  ------------------
  655|       |
  656|  37.0k|  	case FILE_LONG:
  ------------------
  |  |  257|    349|#define				FILE_LONG		4
  ------------------
  |  Branch (656:4): [True: 349, False: 168k]
  ------------------
  657|  23.9k|  	case FILE_BELONG:
  ------------------
  |  |  261|  23.9k|#define				FILE_BELONG		8
  ------------------
  |  Branch (657:4): [True: 23.5k, False: 145k]
  ------------------
  658|  35.1k|  	case FILE_LELONG:
  ------------------
  |  |  264|  35.1k|#define				FILE_LELONG		11
  ------------------
  |  Branch (658:4): [True: 11.2k, False: 157k]
  ------------------
  659|  35.1k|  	case FILE_MELONG:
  ------------------
  |  |  276|  35.1k|#define				FILE_MELONG		23
  ------------------
  |  Branch (659:4): [True: 34, False: 168k]
  ------------------
  660|  35.1k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  618|  35.1k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  35.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  35.1k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 35.1k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 35.1k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  35.1k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 35.1k, False: 0]
  |  |  ------------------
  |  |  634|  35.1k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  35.1k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 9.67k, False: 25.5k]
  |  |  ------------------
  |  |  635|  9.67k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  9.67k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 9.67k]
  |  |  ------------------
  |  |  636|  9.67k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  9.67k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  9.67k|			   return -1; \
  |  |  638|  25.5k|		} else { \
  |  |  639|  25.5k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  25.5k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 25.5k]
  |  |  ------------------
  |  |  640|  25.5k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  25.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  25.5k|			   return -1; \
  |  |  642|  25.5k|		} \
  |  |  643|  35.1k|		break; \
  |  |  644|  35.1k|	} \
  |  |  645|  35.1k|	break
  ------------------
  661|       |
  662|  35.1k|  	case FILE_QUAD:
  ------------------
  |  |  277|    257|#define				FILE_QUAD		24
  ------------------
  |  Branch (662:4): [True: 257, False: 168k]
  ------------------
  663|  1.82k|  	case FILE_BEQUAD:
  ------------------
  |  |  279|  1.82k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (663:4): [True: 1.56k, False: 167k]
  ------------------
  664|  2.09k|  	case FILE_LEQUAD:
  ------------------
  |  |  278|  2.09k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (664:4): [True: 273, False: 168k]
  ------------------
  665|  2.80k|	case FILE_OFFSET:
  ------------------
  |  |  305|  2.80k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (665:2): [True: 702, False: 167k]
  ------------------
  666|  2.80k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  618|  2.80k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  2.80k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  2.80k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 2.80k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 2.80k]
  |  |  ------------------
  |  |  623|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (623:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  624|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  625|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  626|      0|		} else { \
  |  |  627|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  628|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  629|      0|		} \
  |  |  630|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (630:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  631|      0|			return -1; \
  |  |  632|      0|		break; \
  |  |  633|  2.80k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 2.80k, False: 0]
  |  |  ------------------
  |  |  634|  2.80k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  2.80k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 1.67k, False: 1.12k]
  |  |  ------------------
  |  |  635|  1.67k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  1.67k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 1.67k]
  |  |  ------------------
  |  |  636|  1.67k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  1.67k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  1.67k|			   return -1; \
  |  |  638|  1.67k|		} else { \
  |  |  639|  1.12k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  1.12k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 1.12k]
  |  |  ------------------
  |  |  640|  1.12k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  1.12k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  1.12k|			   return -1; \
  |  |  642|  1.12k|		} \
  |  |  643|  2.80k|		break; \
  |  |  644|  2.80k|	} \
  |  |  645|  2.80k|	break
  ------------------
  667|       |
  668|  45.1k|  	case FILE_STRING:
  ------------------
  |  |  258|  45.1k|#define				FILE_STRING		5
  ------------------
  |  Branch (668:4): [True: 45.1k, False: 123k]
  ------------------
  669|  46.9k|  	case FILE_PSTRING:
  ------------------
  |  |  266|  46.9k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (669:4): [True: 1.80k, False: 166k]
  ------------------
  670|  47.0k|  	case FILE_BESTRING16:
  ------------------
  |  |  271|  47.0k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (670:4): [True: 148, False: 168k]
  ------------------
  671|  47.6k|  	case FILE_LESTRING16:
  ------------------
  |  |  272|  47.6k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (671:4): [True: 560, False: 168k]
  ------------------
  672|  47.6k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (672:7): [True: 23.8k, False: 23.7k]
  |  Branch (672:25): [True: 312, False: 23.4k]
  ------------------
  673|  24.1k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  24.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (673:8): [True: 0, False: 24.1k]
  ------------------
  674|  24.1k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  675|  24.1k|			    sizeof(m->value.s))) == -1)
  676|      0|				return -1;
  677|  24.1k|		}
  678|  23.4k|		else {
  679|  23.4k|			char *str = p->s;
  680|       |
  681|       |			/* compute t before we mangle the string? */
  682|       |
  683|  23.4k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (683:8): [True: 23.3k, False: 104]
  ------------------
  684|  23.3k|				str[strcspn(str, "\r\n")] = '\0';
  685|       |
  686|  23.4k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  390|  23.4k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  421|  23.4k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  403|  23.4k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (686:8): [True: 375, False: 23.0k]
  ------------------
  687|    375|				str = file_strtrim(str);
  688|       |
  689|  23.4k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  23.4k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (689:8): [True: 0, False: 23.4k]
  ------------------
  690|  23.4k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  691|  23.4k|				sizeof(p->s) - (str - p->s))) == -1)
  692|      0|				return -1;
  693|       |
  694|  23.4k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  266|  23.4k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (694:8): [True: 1.80k, False: 21.6k]
  ------------------
  695|  1.80k|				size_t l = file_pstring_length_size(ms, m);
  696|  1.80k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  183|  1.80k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  1.80k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (696:9): [True: 0, False: 1.80k]
  ------------------
  697|      0|					return -1;
  698|  1.80k|			}
  699|  23.4k|		}
  700|  47.6k|		break;
  701|       |
  702|  47.6k|	case FILE_DATE:
  ------------------
  |  |  259|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (702:2): [True: 0, False: 168k]
  ------------------
  703|    307|	case FILE_BEDATE:
  ------------------
  |  |  262|    307|#define				FILE_BEDATE		9
  ------------------
  |  Branch (703:2): [True: 307, False: 168k]
  ------------------
  704|    908|	case FILE_LEDATE:
  ------------------
  |  |  265|    908|#define				FILE_LEDATE		12
  ------------------
  |  Branch (704:2): [True: 601, False: 167k]
  ------------------
  705|    950|	case FILE_MEDATE:
  ------------------
  |  |  274|    950|#define				FILE_MEDATE		21
  ------------------
  |  Branch (705:2): [True: 42, False: 168k]
  ------------------
  706|    950|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    950|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (706:7): [True: 0, False: 950]
  ------------------
  707|    950|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  708|      0|			return -1;
  709|    950|		break;
  710|       |
  711|    950|	case FILE_LDATE:
  ------------------
  |  |  267|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (711:2): [True: 0, False: 168k]
  ------------------
  712|    294|	case FILE_BELDATE:
  ------------------
  |  |  268|    294|#define				FILE_BELDATE		15
  ------------------
  |  Branch (712:2): [True: 294, False: 168k]
  ------------------
  713|    328|	case FILE_LELDATE:
  ------------------
  |  |  269|    328|#define				FILE_LELDATE		16
  ------------------
  |  Branch (713:2): [True: 34, False: 168k]
  ------------------
  714|    328|	case FILE_MELDATE:
  ------------------
  |  |  275|    328|#define				FILE_MELDATE		22
  ------------------
  |  Branch (714:2): [True: 0, False: 168k]
  ------------------
  715|    328|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    328|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (715:7): [True: 0, False: 328]
  ------------------
  716|    328|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  548|    328|#define FILE_T_LOCAL	1
  ------------------
  717|    328|			== -1)
  718|      0|			return -1;
  719|    328|		break;
  720|       |
  721|    328|	case FILE_QDATE:
  ------------------
  |  |  280|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (721:2): [True: 0, False: 168k]
  ------------------
  722|    386|	case FILE_BEQDATE:
  ------------------
  |  |  282|    386|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (722:2): [True: 386, False: 168k]
  ------------------
  723|    386|	case FILE_LEQDATE:
  ------------------
  |  |  281|    386|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (723:2): [True: 0, False: 168k]
  ------------------
  724|    386|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    386|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (724:7): [True: 0, False: 386]
  ------------------
  725|    386|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  726|      0|			return -1;
  727|    386|		break;
  728|       |
  729|    386|	case FILE_QLDATE:
  ------------------
  |  |  283|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (729:2): [True: 0, False: 168k]
  ------------------
  730|    176|	case FILE_BEQLDATE:
  ------------------
  |  |  285|    176|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (730:2): [True: 176, False: 168k]
  ------------------
  731|    186|	case FILE_LEQLDATE:
  ------------------
  |  |  284|    186|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (731:2): [True: 10, False: 168k]
  ------------------
  732|    186|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    186|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (732:7): [True: 0, False: 186]
  ------------------
  733|    186|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  548|    186|#define FILE_T_LOCAL	1
  ------------------
  734|      0|			return -1;
  735|    186|		break;
  736|       |
  737|    373|	case FILE_QWDATE:
  ------------------
  |  |  295|    373|#define				FILE_QWDATE		42
  ------------------
  |  Branch (737:2): [True: 373, False: 168k]
  ------------------
  738|    373|	case FILE_BEQWDATE:
  ------------------
  |  |  297|    373|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (738:2): [True: 0, False: 168k]
  ------------------
  739|  1.40k|	case FILE_LEQWDATE:
  ------------------
  |  |  296|  1.40k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (739:2): [True: 1.02k, False: 167k]
  ------------------
  740|  1.40k|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  1.40k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (740:7): [True: 0, False: 1.40k]
  ------------------
  741|  1.40k|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  549|  1.40k|#define FILE_T_WINDOWS	2
  ------------------
  742|  1.40k|		    == -1)
  743|      0|			return -1;
  744|  1.40k|		break;
  745|       |
  746|  1.40k|	case FILE_FLOAT:
  ------------------
  |  |  286|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (746:2): [True: 0, False: 168k]
  ------------------
  747|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (747:2): [True: 0, False: 168k]
  ------------------
  748|    532|	case FILE_LEFLOAT:
  ------------------
  |  |  288|    532|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (748:2): [True: 532, False: 168k]
  ------------------
  749|    532|		vf = p->f;
  750|    532|		switch (check_fmt(ms, desc)) {
  751|      0|		case -1:
  ------------------
  |  Branch (751:3): [True: 0, False: 532]
  ------------------
  752|      0|			return -1;
  753|      0|		case 1:
  ------------------
  |  Branch (753:3): [True: 0, False: 532]
  ------------------
  754|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  755|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (755:8): [True: 0, False: 0]
  ------------------
  756|      0|				return -1;
  757|      0|			break;
  758|    532|		default:
  ------------------
  |  Branch (758:3): [True: 532, False: 0]
  ------------------
  759|    532|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  167|    532|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (759:8): [True: 0, False: 532]
  ------------------
  760|      0|				return -1;
  761|    532|			break;
  762|    532|		}
  763|    532|  		break;
  764|       |
  765|    532|	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (765:2): [True: 0, False: 168k]
  ------------------
  766|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (766:2): [True: 0, False: 168k]
  ------------------
  767|    510|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    510|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (767:2): [True: 510, False: 168k]
  ------------------
  768|    510|		vd = p->d;
  769|    510|		switch (check_fmt(ms, desc)) {
  770|      0|		case -1:
  ------------------
  |  Branch (770:3): [True: 0, False: 510]
  ------------------
  771|      0|			return -1;
  772|      0|		case 1:
  ------------------
  |  Branch (772:3): [True: 0, False: 510]
  ------------------
  773|      0|			(void)snprintf(buf, sizeof(buf), "%g", vd);
  774|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (774:8): [True: 0, False: 0]
  ------------------
  775|      0|				return -1;
  776|      0|			break;
  777|    510|		default:
  ------------------
  |  Branch (777:3): [True: 510, False: 0]
  ------------------
  778|    510|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  167|    510|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (778:8): [True: 0, False: 510]
  ------------------
  779|      0|				return -1;
  780|    510|			break;
  781|    510|		}
  782|    510|  		break;
  783|       |
  784|    510|	case FILE_SEARCH:
  ------------------
  |  |  273|    294|#define				FILE_SEARCH		20
  ------------------
  |  Branch (784:2): [True: 294, False: 168k]
  ------------------
  785|    798|	case FILE_REGEX: {
  ------------------
  |  |  270|    798|#define				FILE_REGEX		17
  ------------------
  |  Branch (785:2): [True: 504, False: 168k]
  ------------------
  786|    798|		char *cp, *scp;
  787|    798|		int rval;
  788|       |
  789|    798|		if (ms->search.s == NULL)
  ------------------
  |  Branch (789:7): [True: 0, False: 798]
  ------------------
  790|      0|			break;
  791|       |
  792|    798|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  461|    798|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  793|    798|		    ms->search.rm_len);
  794|    798|		if (cp == NULL) {
  ------------------
  |  Branch (794:7): [True: 0, False: 798]
  ------------------
  795|      0|			file_oomem(ms, ms->search.rm_len);
  796|      0|			return -1;
  797|      0|		}
  798|    798|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  390|    798|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  421|    798|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  403|    798|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (798:9): [True: 34, False: 764]
  ------------------
  799|       |
  800|    798|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  167|    798|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  801|    798|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  802|    798|		free(cp);
  803|       |
  804|    798|		if (rval == -1)
  ------------------
  |  Branch (804:7): [True: 0, False: 798]
  ------------------
  805|      0|			return -1;
  806|    798|		break;
  807|    798|	}
  808|       |
  809|  1.74k|	case FILE_DEFAULT:
  ------------------
  |  |  256|  1.74k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (809:2): [True: 1.74k, False: 166k]
  ------------------
  810|  2.16k|	case FILE_CLEAR:
  ------------------
  |  |  300|  2.16k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (810:2): [True: 416, False: 168k]
  ------------------
  811|  2.16k|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (811:9): [True: 0, False: 2.16k]
  ------------------
  812|      0|			return -1;
  813|  2.16k|		break;
  814|       |
  815|  3.55k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  3.55k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (815:2): [True: 3.55k, False: 165k]
  ------------------
  816|  3.64k|	case FILE_USE:
  ------------------
  |  |  299|  3.64k|#define				FILE_USE		46
  ------------------
  |  Branch (816:2): [True: 88, False: 168k]
  ------------------
  817|  10.0k|	case FILE_NAME:
  ------------------
  |  |  298|  10.0k|#define				FILE_NAME		45
  ------------------
  |  Branch (817:2): [True: 6.43k, False: 162k]
  ------------------
  818|  10.0k|		break;
  819|    253|	case FILE_DER:
  ------------------
  |  |  301|    253|#define				FILE_DER		48
  ------------------
  |  Branch (819:2): [True: 253, False: 168k]
  ------------------
  820|    253|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    253|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (820:7): [True: 0, False: 253]
  ------------------
  821|    253|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  822|    253|			sizeof(ms->ms_value.s))) == -1)
  823|      0|			return -1;
  824|    253|		break;
  825|    312|	case FILE_GUID:
  ------------------
  |  |  302|    312|#define				FILE_GUID		49
  ------------------
  |  Branch (825:2): [True: 312, False: 168k]
  ------------------
  826|    312|	case FILE_LEGUID:
  ------------------
  |  |  303|    312|#define				FILE_LEGUID		50
  ------------------
  |  Branch (826:2): [True: 0, False: 168k]
  ------------------
  827|    312|		(void) file_print_leguid(buf, sizeof(buf), ms->ms_value.guid);
  828|    312|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|    312|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (828:7): [True: 0, False: 312]
  ------------------
  829|      0|			return -1;
  830|    312|		break;
  831|    312|	case FILE_BEGUID:
  ------------------
  |  |  304|     84|#define				FILE_BEGUID		51
  ------------------
  |  Branch (831:2): [True: 84, False: 168k]
  ------------------
  832|     84|		(void) file_print_beguid(buf, sizeof(buf), ms->ms_value.guid);
  833|     84|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|     84|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (833:7): [True: 0, False: 84]
  ------------------
  834|      0|			return -1;
  835|     84|		break;
  836|     84|	case FILE_MSDOSDATE:
  ------------------
  |  |  308|      0|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (836:2): [True: 0, False: 168k]
  ------------------
  837|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (837:2): [True: 0, False: 168k]
  ------------------
  838|    213|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|    213|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (838:2): [True: 213, False: 168k]
  ------------------
  839|    213|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    213|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (839:7): [True: 0, False: 213]
  ------------------
  840|    213|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  841|      0|			return -1;
  842|    213|		break;
  843|    213|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|      0|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (843:2): [True: 0, False: 168k]
  ------------------
  844|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (844:2): [True: 0, False: 168k]
  ------------------
  845|    213|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|    213|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (845:2): [True: 213, False: 168k]
  ------------------
  846|    213|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    213|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (846:7): [True: 0, False: 213]
  ------------------
  847|    213|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  848|      0|			return -1;
  849|    213|		break;
  850|    213|	case FILE_OCTAL:
  ------------------
  |  |  314|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (850:2): [True: 0, False: 168k]
  ------------------
  851|      0|		file_fmtnum(buf, sizeof(buf), m->value.s, 8);
  852|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (852:7): [True: 0, False: 0]
  ------------------
  853|      0|			return -1;
  854|      0|		break;
  855|      0|	default:
  ------------------
  |  Branch (855:2): [True: 0, False: 168k]
  ------------------
  856|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  857|      0|		return -1;
  858|   168k|	}
  859|   168k|	return 0;
  860|   168k|}
softmagic.c:check_fmt:
  509|   103k|{
  510|   103k|	file_regex_t rx;
  511|   103k|	int rc;
  512|   103k|        const char* pat = "%[-0-9\\.]*s";
  513|       |
  514|   103k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (514:6): [True: 61.9k, False: 41.6k]
  ------------------
  515|  61.9k|		return 0;
  516|       |
  517|  41.6k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  518|  41.6k|	if (rc != 0)
  ------------------
  |  Branch (518:6): [True: 0, False: 41.6k]
  ------------------
  519|      0|		return -1;
  520|  41.6k|	rc = !file_regexec(ms, &rx, fmt, 0, 0, 0);
  521|  41.6k|	file_regfree(&rx);
  522|  41.6k|	return rc;
  523|  41.6k|}
softmagic.c:moffset:
  865|   884k|{
  866|   884k|	int32_t o;
  867|   884k|	size_t vlen;
  868|       |
  869|   884k|  	switch (m->type) {
  870|   268k|  	case FILE_BYTE:
  ------------------
  |  |  254|   268k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (870:4): [True: 268k, False: 615k]
  ------------------
  871|   268k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  460|   268k|#define CAST(T, b)	((T)(b))
  ------------------
  872|   268k|		break;
  873|       |
  874|  18.4k|  	case FILE_SHORT:
  ------------------
  |  |  255|  18.4k|#define				FILE_SHORT		2
  ------------------
  |  Branch (874:4): [True: 18.4k, False: 865k]
  ------------------
  875|  82.3k|  	case FILE_BESHORT:
  ------------------
  |  |  260|  82.3k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (875:4): [True: 63.8k, False: 820k]
  ------------------
  876|   156k|  	case FILE_LESHORT:
  ------------------
  |  |  263|   156k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (876:4): [True: 74.2k, False: 809k]
  ------------------
  877|   156k|	case FILE_MSDOSDATE:
  ------------------
  |  |  308|   156k|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (877:2): [True: 0, False: 884k]
  ------------------
  878|   156k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|   156k|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (878:2): [True: 213, False: 883k]
  ------------------
  879|   156k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|   156k|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (879:2): [True: 0, False: 884k]
  ------------------
  880|   156k|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|   156k|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (880:2): [True: 0, False: 884k]
  ------------------
  881|   156k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|   156k|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (881:2): [True: 213, False: 883k]
  ------------------
  882|   156k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|   156k|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (882:2): [True: 0, False: 884k]
  ------------------
  883|   156k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  460|   156k|#define CAST(T, b)	((T)(b))
  ------------------
  884|   156k|		break;
  885|       |
  886|  4.63k|  	case FILE_LONG:
  ------------------
  |  |  257|  4.63k|#define				FILE_LONG		4
  ------------------
  |  Branch (886:4): [True: 4.63k, False: 879k]
  ------------------
  887|  98.9k|  	case FILE_BELONG:
  ------------------
  |  |  261|  98.9k|#define				FILE_BELONG		8
  ------------------
  |  Branch (887:4): [True: 94.3k, False: 789k]
  ------------------
  888|   143k|  	case FILE_LELONG:
  ------------------
  |  |  264|   143k|#define				FILE_LELONG		11
  ------------------
  |  Branch (888:4): [True: 44.1k, False: 839k]
  ------------------
  889|   143k|  	case FILE_MELONG:
  ------------------
  |  |  276|   143k|#define				FILE_MELONG		23
  ------------------
  |  Branch (889:4): [True: 34, False: 883k]
  ------------------
  890|   143k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  460|   143k|#define CAST(T, b)	((T)(b))
  ------------------
  891|   143k|		break;
  892|       |
  893|  30.4k|  	case FILE_QUAD:
  ------------------
  |  |  277|  30.4k|#define				FILE_QUAD		24
  ------------------
  |  Branch (893:4): [True: 30.4k, False: 853k]
  ------------------
  894|  39.3k|  	case FILE_BEQUAD:
  ------------------
  |  |  279|  39.3k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (894:4): [True: 8.86k, False: 875k]
  ------------------
  895|  40.3k|  	case FILE_LEQUAD:
  ------------------
  |  |  278|  40.3k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (895:4): [True: 1.02k, False: 883k]
  ------------------
  896|  40.3k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  460|  40.3k|#define CAST(T, b)	((T)(b))
  ------------------
  897|  40.3k|		break;
  898|       |
  899|  96.7k|  	case FILE_STRING:
  ------------------
  |  |  258|  96.7k|#define				FILE_STRING		5
  ------------------
  |  Branch (899:4): [True: 96.7k, False: 787k]
  ------------------
  900|  98.5k|  	case FILE_PSTRING:
  ------------------
  |  |  266|  98.5k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (900:4): [True: 1.81k, False: 882k]
  ------------------
  901|  98.7k|  	case FILE_BESTRING16:
  ------------------
  |  |  271|  98.7k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (901:4): [True: 148, False: 883k]
  ------------------
  902|  99.2k|  	case FILE_LESTRING16:
  ------------------
  |  |  272|  99.2k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (902:4): [True: 560, False: 883k]
  ------------------
  903|  99.2k|	case FILE_OCTAL:
  ------------------
  |  |  314|  99.2k|#define				FILE_OCTAL		61
  ------------------
  |  Branch (903:2): [True: 0, False: 884k]
  ------------------
  904|  99.2k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (904:7): [True: 34.5k, False: 64.7k]
  |  Branch (904:25): [True: 2.33k, False: 62.4k]
  ------------------
  905|  36.8k|			o = ms->offset + m->vallen;
  906|  62.4k|		} else {
  907|  62.4k|			union VALUETYPE *p = &ms->ms_value;
  908|       |
  909|  62.4k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (909:8): [True: 52.6k, False: 9.78k]
  ------------------
  910|  52.6k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  911|  62.4k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  460|  62.4k|#define CAST(T, b)	((T)(b))
  ------------------
  912|  62.4k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  266|  62.4k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (912:8): [True: 1.81k, False: 60.5k]
  ------------------
  913|  1.81k|				size_t l = file_pstring_length_size(ms, m);
  914|  1.81k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  183|  1.81k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  1.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (914:9): [True: 0, False: 1.81k]
  ------------------
  915|      0|					return -1;
  916|  1.81k|				o += CAST(uint32_t, l);
  ------------------
  |  |  460|  1.81k|#define CAST(T, b)	((T)(b))
  ------------------
  917|  1.81k|			}
  918|  62.4k|		}
  919|  99.2k|		break;
  920|       |
  921|  99.2k|	case FILE_DATE:
  ------------------
  |  |  259|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (921:2): [True: 0, False: 884k]
  ------------------
  922|    307|	case FILE_BEDATE:
  ------------------
  |  |  262|    307|#define				FILE_BEDATE		9
  ------------------
  |  Branch (922:2): [True: 307, False: 883k]
  ------------------
  923|    908|	case FILE_LEDATE:
  ------------------
  |  |  265|    908|#define				FILE_LEDATE		12
  ------------------
  |  Branch (923:2): [True: 601, False: 883k]
  ------------------
  924|    950|	case FILE_MEDATE:
  ------------------
  |  |  274|    950|#define				FILE_MEDATE		21
  ------------------
  |  Branch (924:2): [True: 42, False: 883k]
  ------------------
  925|    950|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  460|    950|#define CAST(T, b)	((T)(b))
  ------------------
  926|    950|		break;
  927|       |
  928|      0|	case FILE_LDATE:
  ------------------
  |  |  267|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (928:2): [True: 0, False: 884k]
  ------------------
  929|    294|	case FILE_BELDATE:
  ------------------
  |  |  268|    294|#define				FILE_BELDATE		15
  ------------------
  |  Branch (929:2): [True: 294, False: 883k]
  ------------------
  930|    328|	case FILE_LELDATE:
  ------------------
  |  |  269|    328|#define				FILE_LELDATE		16
  ------------------
  |  Branch (930:2): [True: 34, False: 883k]
  ------------------
  931|    328|	case FILE_MELDATE:
  ------------------
  |  |  275|    328|#define				FILE_MELDATE		22
  ------------------
  |  Branch (931:2): [True: 0, False: 884k]
  ------------------
  932|    328|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  460|    328|#define CAST(T, b)	((T)(b))
  ------------------
  933|    328|		break;
  934|       |
  935|      0|	case FILE_QDATE:
  ------------------
  |  |  280|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (935:2): [True: 0, False: 884k]
  ------------------
  936|    386|	case FILE_BEQDATE:
  ------------------
  |  |  282|    386|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (936:2): [True: 386, False: 883k]
  ------------------
  937|    386|	case FILE_LEQDATE:
  ------------------
  |  |  281|    386|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (937:2): [True: 0, False: 884k]
  ------------------
  938|    386|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  460|    386|#define CAST(T, b)	((T)(b))
  ------------------
  939|    386|		break;
  940|       |
  941|      0|	case FILE_QLDATE:
  ------------------
  |  |  283|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (941:2): [True: 0, False: 884k]
  ------------------
  942|    176|	case FILE_BEQLDATE:
  ------------------
  |  |  285|    176|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (942:2): [True: 176, False: 883k]
  ------------------
  943|    186|	case FILE_LEQLDATE:
  ------------------
  |  |  284|    186|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (943:2): [True: 10, False: 884k]
  ------------------
  944|    186|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  460|    186|#define CAST(T, b)	((T)(b))
  ------------------
  945|    186|		break;
  946|       |
  947|      0|  	case FILE_FLOAT:
  ------------------
  |  |  286|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (947:4): [True: 0, False: 884k]
  ------------------
  948|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (948:4): [True: 0, False: 884k]
  ------------------
  949|    532|  	case FILE_LEFLOAT:
  ------------------
  |  |  288|    532|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (949:4): [True: 532, False: 883k]
  ------------------
  950|    532|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  460|    532|#define CAST(T, b)	((T)(b))
  ------------------
  951|    532|		break;
  952|       |
  953|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (953:4): [True: 0, False: 884k]
  ------------------
  954|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  290|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (954:4): [True: 0, False: 884k]
  ------------------
  955|    510|  	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    510|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (955:4): [True: 510, False: 883k]
  ------------------
  956|    510|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  460|    510|#define CAST(T, b)	((T)(b))
  ------------------
  957|    510|		break;
  958|       |
  959|  1.25k|	case FILE_REGEX:
  ------------------
  |  |  270|  1.25k|#define				FILE_REGEX		17
  ------------------
  |  Branch (959:2): [True: 1.25k, False: 882k]
  ------------------
  960|       |		/* Why is regex and search different? */
  961|  1.25k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  390|  1.25k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  408|  1.25k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  403|  1.25k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (961:10): [True: 1.18k, False: 70]
  ------------------
  962|  1.18k|		    ms->search.rm_len : 0;
  963|  1.25k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  460|  1.25k|#define CAST(T, b)	((T)(b))
  ------------------
  964|  1.25k|		break;
  965|       |
  966|  7.92k|	case FILE_SEARCH:
  ------------------
  |  |  273|  7.92k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (966:2): [True: 7.92k, False: 876k]
  ------------------
  967|  7.92k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  390|  7.92k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  408|  7.92k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  403|  7.92k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (967:10): [True: 7.64k, False: 288]
  ------------------
  968|  7.92k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  460|  7.92k|#define CAST(T, b)	((T)(b))
  ------------------
  969|  7.92k|		break;
  970|       |
  971|  3.24k|	case FILE_CLEAR:
  ------------------
  |  |  300|  3.24k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (971:2): [True: 3.24k, False: 880k]
  ------------------
  972|  13.3k|	case FILE_DEFAULT:
  ------------------
  |  |  256|  13.3k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (972:2): [True: 10.1k, False: 873k]
  ------------------
  973|  27.3k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  27.3k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (973:2): [True: 14.0k, False: 870k]
  ------------------
  974|  28.1k|	case FILE_OFFSET:
  ------------------
  |  |  305|  28.1k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (974:2): [True: 805, False: 883k]
  ------------------
  975|  67.3k|	case FILE_USE:
  ------------------
  |  |  299|  67.3k|#define				FILE_USE		46
  ------------------
  |  Branch (975:2): [True: 39.1k, False: 844k]
  ------------------
  976|  67.3k|		o = ms->offset;
  977|  67.3k|		break;
  978|       |
  979|  27.8k|	case FILE_DER:
  ------------------
  |  |  301|  27.8k|#define				FILE_DER		48
  ------------------
  |  Branch (979:2): [True: 27.8k, False: 856k]
  ------------------
  980|  27.8k|		o = der_offs(ms, m, nbytes);
  981|  27.8k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  460|  27.8k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (981:7): [True: 0, False: 27.8k]
  |  Branch (981:18): [True: 0, False: 27.8k]
  ------------------
  982|      0|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (982:8): [True: 0, False: 0]
  ------------------
  983|      0|				(void)fprintf(stderr,
  984|      0|				    "Bad DER offset %d nbytes=%"
  985|      0|				    SIZE_T_FORMAT "u", o, nbytes);
  986|      0|			}
  987|      0|			*op = 0;
  988|      0|			return 0;
  989|      0|		}
  990|  27.8k|		break;
  991|       |
  992|  27.8k|	case FILE_BEGUID:
  ------------------
  |  |  304|     84|#define				FILE_BEGUID		51
  ------------------
  |  Branch (992:2): [True: 84, False: 883k]
  ------------------
  993|     84|	case FILE_LEGUID:
  ------------------
  |  |  303|     84|#define				FILE_LEGUID		50
  ------------------
  |  Branch (993:2): [True: 0, False: 884k]
  ------------------
  994|    396|	case FILE_GUID:
  ------------------
  |  |  302|    396|#define				FILE_GUID		49
  ------------------
  |  Branch (994:2): [True: 312, False: 883k]
  ------------------
  995|    396|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  460|    396|#define CAST(T, b)	((T)(b))
  ------------------
  996|    396|		break;
  997|       |
  998|  68.0k|	default:
  ------------------
  |  Branch (998:2): [True: 68.0k, False: 815k]
  ------------------
  999|  68.0k|		o = 0;
 1000|  68.0k|		break;
 1001|   884k|	}
 1002|       |
 1003|   884k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  460|   884k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1003:6): [True: 32.5k, False: 851k]
  ------------------
 1004|       |#if 0
 1005|       |		file_error(ms, 0, "Offset out of range %" SIZE_T_FORMAT
 1006|       |		    "u > %" SIZE_T_FORMAT "u", (size_t)o, nbytes);
 1007|       |#endif
 1008|  32.5k|		return -1;
 1009|  32.5k|	}
 1010|   851k|	*op = o;
 1011|   851k|	return 1;
 1012|   884k|}

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

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|  11.9k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   53|  11.9k|  FuzzerTemporaryFile ftf (data, size);
   54|       |  int fd = open(ftf.filename(), O_RDONLY);
   55|  11.9k|  magic_descriptor(env->magic, fd);
   56|  11.9k|  close(fd);
   57|  11.9k|  return 0;
   58|  11.9k|}
_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|  }

