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|  99.8M|{
 1664|  99.8M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  237|  99.8M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1664:6): [True: 93.6M, False: 6.19M]
  ------------------
 1665|  93.6M|		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: 92.6M]
  ------------------
 1672|  1.04M|			v = CAST(signed char,  v);
  ------------------
  |  |  460|  1.04M|#define CAST(T, b)	((T)(b))
  ------------------
 1673|  1.04M|			break;
 1674|  1.78M|		case FILE_SHORT:
  ------------------
  |  |  255|  1.78M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1674:3): [True: 1.78M, False: 91.9M]
  ------------------
 1675|  5.78M|		case FILE_BESHORT:
  ------------------
  |  |  260|  5.78M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1675:3): [True: 3.99M, False: 89.6M]
  ------------------
 1676|  9.36M|		case FILE_LESHORT:
  ------------------
  |  |  263|  9.36M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1676:3): [True: 3.57M, False: 90.1M]
  ------------------
 1677|  9.36M|			v = CAST(short, v);
  ------------------
  |  |  460|  9.36M|#define CAST(T, b)	((T)(b))
  ------------------
 1678|  9.36M|			break;
 1679|      0|		case FILE_DATE:
  ------------------
  |  |  259|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1679:3): [True: 0, False: 93.6M]
  ------------------
 1680|    410|		case FILE_BEDATE:
  ------------------
  |  |  262|    410|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1680:3): [True: 410, False: 93.6M]
  ------------------
 1681|  1.35k|		case FILE_LEDATE:
  ------------------
  |  |  265|  1.35k|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1681:3): [True: 945, False: 93.6M]
  ------------------
 1682|  1.39k|		case FILE_MEDATE:
  ------------------
  |  |  274|  1.39k|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1682:3): [True: 40, False: 93.6M]
  ------------------
 1683|  1.39k|		case FILE_LDATE:
  ------------------
  |  |  267|  1.39k|#define				FILE_LDATE		14
  ------------------
  |  Branch (1683:3): [True: 0, False: 93.6M]
  ------------------
 1684|  1.69k|		case FILE_BELDATE:
  ------------------
  |  |  268|  1.69k|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1684:3): [True: 299, False: 93.6M]
  ------------------
 1685|  1.72k|		case FILE_LELDATE:
  ------------------
  |  |  269|  1.72k|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1685:3): [True: 34, False: 93.6M]
  ------------------
 1686|  1.72k|		case FILE_MELDATE:
  ------------------
  |  |  275|  1.72k|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1686:3): [True: 0, False: 93.6M]
  ------------------
 1687|  1.54M|		case FILE_LONG:
  ------------------
  |  |  257|  1.54M|#define				FILE_LONG		4
  ------------------
  |  Branch (1687:3): [True: 1.54M, False: 92.1M]
  ------------------
 1688|  13.8M|		case FILE_BELONG:
  ------------------
  |  |  261|  13.8M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1688:3): [True: 12.2M, False: 81.4M]
  ------------------
 1689|  18.4M|		case FILE_LELONG:
  ------------------
  |  |  264|  18.4M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1689:3): [True: 4.68M, False: 89.0M]
  ------------------
 1690|  18.4M|		case FILE_MELONG:
  ------------------
  |  |  276|  18.4M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1690:3): [True: 68, False: 93.6M]
  ------------------
 1691|  18.4M|		case FILE_FLOAT:
  ------------------
  |  |  286|  18.4M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1691:3): [True: 0, False: 93.6M]
  ------------------
 1692|  18.4M|		case FILE_BEFLOAT:
  ------------------
  |  |  287|  18.4M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1692:3): [True: 0, False: 93.6M]
  ------------------
 1693|  18.4M|		case FILE_LEFLOAT:
  ------------------
  |  |  288|  18.4M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1693:3): [True: 0, False: 93.6M]
  ------------------
 1694|  18.4M|		case FILE_MSDOSDATE:
  ------------------
  |  |  308|  18.4M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1694:3): [True: 0, False: 93.6M]
  ------------------
 1695|  18.4M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|  18.4M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1695:3): [True: 0, False: 93.6M]
  ------------------
 1696|  18.4M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|  18.4M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1696:3): [True: 212, False: 93.6M]
  ------------------
 1697|  18.4M|		case FILE_MSDOSTIME:
  ------------------
  |  |  311|  18.4M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1697:3): [True: 0, False: 93.6M]
  ------------------
 1698|  18.4M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|  18.4M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1698:3): [True: 0, False: 93.6M]
  ------------------
 1699|  18.4M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|  18.4M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1699:3): [True: 212, False: 93.6M]
  ------------------
 1700|  18.4M|			v = CAST(int32_t, v);
  ------------------
  |  |  460|  18.4M|#define CAST(T, b)	((T)(b))
  ------------------
 1701|  18.4M|			break;
 1702|  69.9k|		case FILE_QUAD:
  ------------------
  |  |  277|  69.9k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1702:3): [True: 69.9k, False: 93.6M]
  ------------------
 1703|   836k|		case FILE_BEQUAD:
  ------------------
  |  |  279|   836k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1703:3): [True: 766k, False: 92.9M]
  ------------------
 1704|  1.26M|		case FILE_LEQUAD:
  ------------------
  |  |  278|  1.26M|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1704:3): [True: 428k, False: 93.2M]
  ------------------
 1705|  1.26M|		case FILE_QDATE:
  ------------------
  |  |  280|  1.26M|#define				FILE_QDATE		27
  ------------------
  |  Branch (1705:3): [True: 0, False: 93.6M]
  ------------------
 1706|  1.26M|		case FILE_QLDATE:
  ------------------
  |  |  283|  1.26M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1706:3): [True: 0, False: 93.6M]
  ------------------
 1707|  1.26M|		case FILE_QWDATE:
  ------------------
  |  |  295|  1.26M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1707:3): [True: 376, False: 93.6M]
  ------------------
 1708|  1.26M|		case FILE_BEQDATE:
  ------------------
  |  |  282|  1.26M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1708:3): [True: 384, False: 93.6M]
  ------------------
 1709|  1.26M|		case FILE_BEQLDATE:
  ------------------
  |  |  285|  1.26M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1709:3): [True: 184, False: 93.6M]
  ------------------
 1710|  1.26M|		case FILE_BEQWDATE:
  ------------------
  |  |  297|  1.26M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1710:3): [True: 0, False: 93.6M]
  ------------------
 1711|  1.26M|		case FILE_LEQDATE:
  ------------------
  |  |  281|  1.26M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1711:3): [True: 0, False: 93.6M]
  ------------------
 1712|  1.26M|		case FILE_LEQLDATE:
  ------------------
  |  |  284|  1.26M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1712:3): [True: 10, False: 93.6M]
  ------------------
 1713|  1.26M|		case FILE_LEQWDATE:
  ------------------
  |  |  296|  1.26M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1713:3): [True: 1.23k, False: 93.6M]
  ------------------
 1714|  1.26M|		case FILE_DOUBLE:
  ------------------
  |  |  289|  1.26M|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1714:3): [True: 0, False: 93.6M]
  ------------------
 1715|  1.26M|		case FILE_BEDOUBLE:
  ------------------
  |  |  290|  1.26M|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1715:3): [True: 0, False: 93.6M]
  ------------------
 1716|  1.26M|		case FILE_LEDOUBLE:
  ------------------
  |  |  291|  1.26M|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1716:3): [True: 0, False: 93.6M]
  ------------------
 1717|  1.27M|		case FILE_OFFSET:
  ------------------
  |  |  305|  1.27M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1717:3): [True: 7.39k, False: 93.6M]
  ------------------
 1718|  1.27M|		case FILE_BEVARINT:
  ------------------
  |  |  306|  1.27M|#define				FILE_BEVARINT		53
  ------------------
  |  Branch (1718:3): [True: 0, False: 93.6M]
  ------------------
 1719|  1.27M|		case FILE_LEVARINT:
  ------------------
  |  |  307|  1.27M|#define				FILE_LEVARINT		54
  ------------------
  |  Branch (1719:3): [True: 0, False: 93.6M]
  ------------------
 1720|  1.27M|			v = CAST(int64_t, v);
  ------------------
  |  |  460|  1.27M|#define CAST(T, b)	((T)(b))
  ------------------
 1721|  1.27M|			break;
 1722|  62.0M|		case FILE_STRING:
  ------------------
  |  |  258|  62.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (1722:3): [True: 62.0M, False: 31.6M]
  ------------------
 1723|  62.0M|		case FILE_PSTRING:
  ------------------
  |  |  266|  62.0M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1723:3): [True: 26.1k, False: 93.6M]
  ------------------
 1724|  62.0M|		case FILE_BESTRING16:
  ------------------
  |  |  271|  62.0M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1724:3): [True: 147, False: 93.6M]
  ------------------
 1725|  62.1M|		case FILE_LESTRING16:
  ------------------
  |  |  272|  62.1M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1725:3): [True: 67.5k, False: 93.6M]
  ------------------
 1726|  62.6M|		case FILE_REGEX:
  ------------------
  |  |  270|  62.6M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1726:3): [True: 496k, False: 93.1M]
  ------------------
 1727|  63.3M|		case FILE_SEARCH:
  ------------------
  |  |  273|  63.3M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1727:3): [True: 703k, False: 92.9M]
  ------------------
 1728|  63.3M|		case FILE_DEFAULT:
  ------------------
  |  |  256|  63.3M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1728:3): [True: 13.1k, False: 93.6M]
  ------------------
 1729|  63.3M|		case FILE_INDIRECT:
  ------------------
  |  |  294|  63.3M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1729:3): [True: 0, False: 93.6M]
  ------------------
 1730|  63.3M|		case FILE_NAME:
  ------------------
  |  |  298|  63.3M|#define				FILE_NAME		45
  ------------------
  |  Branch (1730:3): [True: 0, False: 93.6M]
  ------------------
 1731|  63.3M|		case FILE_USE:
  ------------------
  |  |  299|  63.3M|#define				FILE_USE		46
  ------------------
  |  Branch (1731:3): [True: 0, False: 93.6M]
  ------------------
 1732|  63.3M|		case FILE_CLEAR:
  ------------------
  |  |  300|  63.3M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1732:3): [True: 3.25k, False: 93.6M]
  ------------------
 1733|  63.3M|		case FILE_DER:
  ------------------
  |  |  301|  63.3M|#define				FILE_DER		48
  ------------------
  |  Branch (1733:3): [True: 0, False: 93.6M]
  ------------------
 1734|  63.5M|		case FILE_GUID:
  ------------------
  |  |  302|  63.5M|#define				FILE_GUID		49
  ------------------
  |  Branch (1734:3): [True: 189k, False: 93.5M]
  ------------------
 1735|  63.5M|		case FILE_LEGUID:
  ------------------
  |  |  303|  63.5M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1735:3): [True: 0, False: 93.6M]
  ------------------
 1736|  63.5M|		case FILE_BEGUID:
  ------------------
  |  |  304|  63.5M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1736:3): [True: 84, False: 93.6M]
  ------------------
 1737|  63.5M|		case FILE_OCTAL:
  ------------------
  |  |  314|  63.5M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1737:3): [True: 0, False: 93.6M]
  ------------------
 1738|  63.5M|			break;
 1739|      0|		default:
  ------------------
  |  Branch (1739:3): [True: 0, False: 93.6M]
  ------------------
 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|  93.6M|		}
 1745|  93.6M|	}
 1746|  99.8M|	return v;
 1747|  99.8M|}
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.24k]
  ------------------
 3643|  24.8k|		return 1;
 3644|    384|	case PSTRING_2_LE:
  ------------------
  |  |  414|    384|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  403|    384|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3644:2): [True: 384, False: 30.6k]
  ------------------
 3645|  5.59k|	case PSTRING_2_BE:
  ------------------
  |  |  413|  5.59k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  403|  5.59k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3645:2): [True: 5.20k, False: 25.8k]
  ------------------
 3646|  5.59k|		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|    651|	case PSTRING_4_BE:
  ------------------
  |  |  415|    651|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  403|    651|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3648:2): [True: 516, False: 30.5k]
  ------------------
 3649|    651|		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.75k]
  ------------------
 3668|  24.5k|		len = *s;
 3669|  24.5k|		break;
 3670|    128|	case PSTRING_2_LE:
  ------------------
  |  |  414|    128|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  403|    128|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3670:2): [True: 128, False: 26.1k]
  ------------------
 3671|    128|		s0 = s[0];
 3672|    128|		s1 = s[1];
 3673|    128|		len = (s1 << 8) | s0;
 3674|    128|		break;
 3675|  1.40k|	case PSTRING_2_BE:
  ------------------
  |  |  413|  1.40k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  403|  1.40k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3675:2): [True: 1.40k, False: 24.8k]
  ------------------
 3676|  1.40k|		s0 = s[0];
 3677|  1.40k|		s1 = s[1];
 3678|  1.40k|		len = (s0 << 8) | s1;
 3679|  1.40k|		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|    172|	case PSTRING_4_BE:
  ------------------
  |  |  415|    172|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  403|    172|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3687:2): [True: 172, False: 26.0k]
  ------------------
 3688|    172|		s0 = s[0];
 3689|    172|		s1 = s[1];
 3690|    172|		s2 = s[2];
 3691|    172|		s3 = s[3];
 3692|    172|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3693|    172|		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.15k, False: 25.1k]
  ------------------
 3702|  1.15k|		size_t l = file_pstring_length_size(ms, m);
 3703|  1.15k|		if (l == FILE_BADSIZE)
  ------------------
  |  |  183|  1.15k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  1.15k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3703:7): [True: 0, False: 1.15k]
  ------------------
 3704|      0|			return l;
 3705|  1.15k|		len -= l;
 3706|  1.15k|	}
 3707|       |
 3708|  26.2k|	return len;
 3709|  26.2k|}
file_magicfind:
 3713|  66.2k|{
 3714|  66.2k|	uint32_t i, j;
 3715|  66.2k|	struct mlist *mlist, *ml;
 3716|       |
 3717|  66.2k|	mlist = ms->mlist[1];
 3718|       |
 3719|  66.2k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3719:25): [True: 66.2k, False: 0]
  ------------------
 3720|  66.2k|		struct magic *ma = ml->magic;
 3721|   271M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3721:15): [True: 271M, False: 0]
  ------------------
 3722|   271M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  298|   271M|#define				FILE_NAME		45
  ------------------
  |  Branch (3722:8): [True: 258M, False: 12.9M]
  ------------------
 3723|   258M|				continue;
 3724|  12.9M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3724:8): [True: 66.2k, False: 12.8M]
  ------------------
 3725|  66.2k|				v->magic = &ma[i];
 3726|  66.2k|				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.1k, False: 2.67M]
  ------------------
 3729|  66.1k|					    break;
 3730|  66.2k|				v->nmagic = j - i;
 3731|  66.2k|				return 0;
 3732|  66.2k|			}
 3733|  12.9M|		}
 3734|  66.2k|	}
 3735|      0|	return -1;
 3736|  66.2k|}
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.90k, False: 8.44k]
  |  Branch (88:23): [True: 1.88k, False: 5.01k]
  ------------------
   89|  1.88k|		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.7k, False: 2.57k]
  ------------------
   93|  15.3k|	    &type) == 0)
   94|  12.7k|		rv = 0;
   95|  2.57k|        else
   96|  2.57k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  2.57k|		    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.57k|{
  109|  2.57k|	struct buffer bb;
  110|  2.57k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  2.57k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  2.57k|	size_t nbytes = b->flen;
  112|  2.57k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  2.57k|	size_t mlen, i, len;
  114|  2.57k|	int rv = -1;
  115|  2.57k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  2.57k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.57k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.57k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  2.57k|	int need_separator = 0;
  117|       |
  118|  2.57k|	const char *subtype = NULL;
  119|       |
  120|  2.57k|	int has_escapes = 0;
  121|  2.57k|	int has_backspace = 0;
  122|  2.57k|	int seen_cr = 0;
  123|       |
  124|  2.57k|	size_t n_crlf = 0;
  125|  2.57k|	size_t n_lf = 0;
  126|  2.57k|	size_t n_cr = 0;
  127|  2.57k|	size_t n_nel = 0;
  128|  2.57k|	int executable = 0;
  129|       |
  130|  2.57k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  460|  2.57k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  2.57k|	size_t has_long_lines = 0;
  132|       |
  133|  2.57k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  2.57k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 23, False: 2.55k]
  ------------------
  137|     23|		rv = 0;
  138|     23|		goto done;
  139|     23|	}
  140|       |
  141|  2.55k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  2.46k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 2.46k, False: 87]
  |  Branch (141:18): [True: 2.46k, 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.46k|		if (ulen > SIZE_MAX / 6) {
  ------------------
  |  Branch (145:7): [True: 0, False: 2.46k]
  ------------------
  146|      0|			goto done;
  147|      0|		}
  148|  2.46k|		mlen = ulen * 6;
  149|  2.46k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  460|  2.46k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (149:7): [True: 0, False: 2.46k]
  ------------------
  150|      0|			file_oomem(ms, mlen);
  151|      0|			goto done;
  152|      0|		}
  153|  2.46k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (153:7): [True: 39, False: 2.42k]
  ------------------
  154|  2.46k|		    == NULL) {
  155|     39|			rv = 0;
  156|     39|			goto done;
  157|     39|		}
  158|  2.42k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  159|  2.42k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  460|  2.42k|#define CAST(T, b)	((T)(b))
  ------------------
  160|       |
  161|  2.42k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (161:7): [True: 2.30k, False: 121]
  ------------------
  162|  2.42k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  241|  2.42k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  163|  2.30k|			rv = -1;
  164|    121|		else
  165|    121|			need_separator = 1;
  166|  2.42k|		buffer_fini(&bb);
  167|  2.42k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.42k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.42k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (167:7): [True: 0, False: 2.42k]
  ------------------
  168|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (168:9): [True: 0, False: 0]
  ------------------
  169|      0|			goto done;
  170|      0|		}
  171|  2.42k|	}
  172|       |
  173|  2.51k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.51k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.51k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (173:6): [True: 0, False: 2.51k]
  ------------------
  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.51k]
  ------------------
  180|  15.7M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (180:7): [True: 1.47M, False: 14.2M]
  ------------------
  181|  1.47M|			if (seen_cr)
  ------------------
  |  Branch (181:8): [True: 65.8k, False: 1.40M]
  ------------------
  182|  65.8k|				n_crlf++;
  183|  1.40M|			else
  184|  1.40M|				n_lf++;
  185|  1.47M|			last_line_end = i;
  186|  14.2M|		} else if (seen_cr)
  ------------------
  |  Branch (186:14): [True: 1.49M, False: 12.7M]
  ------------------
  187|  1.49M|			n_cr++;
  188|       |
  189|  15.7M|		seen_cr = (ubuf[i] == '\r');
  190|  15.7M|		if (seen_cr)
  ------------------
  |  Branch (190:7): [True: 1.55M, False: 14.1M]
  ------------------
  191|  1.55M|			last_line_end = i;
  192|       |
  193|  15.7M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (193:7): [True: 611k, False: 15.1M]
  ------------------
  194|   611k|			n_nel++;
  195|   611k|			last_line_end = i;
  196|   611k|		}
  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.7M, False: 3.97M]
  ------------------
  200|  11.7M|			size_t ll = i - last_line_end;
  201|  11.7M|			if (ll > has_long_lines)
  ------------------
  |  Branch (201:8): [True: 11.7M, False: 37.7k]
  ------------------
  202|  11.7M|				has_long_lines = ll;
  203|  11.7M|		}
  204|       |
  205|  15.7M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (205:7): [True: 89.9k, False: 15.6M]
  ------------------
  206|  89.9k|			has_escapes = 1;
  207|  15.7M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (207:7): [True: 67.6k, False: 15.6M]
  ------------------
  208|  67.6k|			has_backspace = 1;
  209|  15.7M|	}
  210|       |
  211|  2.51k|	if (seen_cr && n_cr == 0 && n_crlf == 0)
  ------------------
  |  Branch (211:6): [True: 74, False: 2.44k]
  |  Branch (211:17): [True: 22, False: 52]
  |  Branch (211:30): [True: 18, False: 4]
  ------------------
  212|     18|		n_cr++;
  213|       |
  214|  2.51k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (214:6): [True: 0, False: 2.51k]
  ------------------
  215|      0|		rv = 0;
  216|      0|		goto done;
  217|      0|	}
  218|  2.51k|	len = file_printedlen(ms);
  219|  2.51k|	if (mime) {
  ------------------
  |  Branch (219:6): [True: 0, False: 2.51k]
  ------------------
  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.51k|	} else {
  237|  2.51k|		if (len) {
  ------------------
  |  Branch (237:7): [True: 846, False: 1.66k]
  ------------------
  238|    846|			switch (file_replace(ms, " text$", ", ")) {
  239|    811|			case 0:
  ------------------
  |  Branch (239:4): [True: 811, False: 35]
  ------------------
  240|    811|				switch (file_replace(ms, " text executable$",
  241|    811|				    ", ")) {
  242|    739|				case 0:
  ------------------
  |  Branch (242:5): [True: 739, False: 72]
  ------------------
  243|    739|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (243:10): [True: 0, False: 739]
  ------------------
  244|      0|						goto done;
  245|    739|					break;
  246|    739|				case -1:
  ------------------
  |  Branch (246:5): [True: 0, False: 811]
  ------------------
  247|      0|					goto done;
  248|     72|				default:
  ------------------
  |  Branch (248:5): [True: 72, False: 739]
  ------------------
  249|     72|					executable = 1;
  250|     72|					break;
  251|    811|				}
  252|    811|				break;
  253|    811|			case -1:
  ------------------
  |  Branch (253:4): [True: 0, False: 846]
  ------------------
  254|      0|				goto done;
  255|     35|			default:
  ------------------
  |  Branch (255:4): [True: 35, False: 811]
  ------------------
  256|     35|				break;
  257|    846|			}
  258|    846|		}
  259|       |
  260|  2.51k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (260:7): [True: 0, False: 2.51k]
  ------------------
  261|      0|			goto done;
  262|       |
  263|  2.51k|		if (subtype) {
  ------------------
  |  Branch (263:7): [True: 0, False: 2.51k]
  ------------------
  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.51k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (268:7): [True: 0, False: 2.51k]
  ------------------
  269|      0|			goto done;
  270|       |
  271|  2.51k|		if (executable)
  ------------------
  |  Branch (271:7): [True: 72, False: 2.44k]
  ------------------
  272|     72|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (272:8): [True: 0, False: 72]
  ------------------
  273|      0|				goto done;
  274|       |
  275|  2.51k|		if (has_long_lines)
  ------------------
  |  Branch (275:7): [True: 292, False: 2.22k]
  ------------------
  276|    292|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (276:8): [True: 0, False: 292]
  ------------------
  277|    292|			    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.51k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (284:8): [True: 2.46k, False: 46]
  |  Branch (284:23): [True: 2.36k, False: 103]
  |  Branch (284:36): [True: 2.33k, False: 34]
  |  Branch (284:50): [True: 2.18k, False: 152]
  ------------------
  285|  2.36k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (285:8): [True: 46, False: 289]
  |  Branch (285:23): [True: 103, False: 186]
  |  Branch (285:36): [True: 34, False: 152]
  ------------------
  286|  2.36k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (286:8): [True: 0, False: 2.36k]
  ------------------
  287|      0|				goto done;
  288|       |
  289|  2.36k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (289:8): [True: 2.31k, False: 46]
  |  Branch (289:23): [True: 2.21k, False: 103]
  ------------------
  290|  2.21k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (290:8): [True: 2.18k, False: 34]
  |  Branch (290:22): [True: 2.18k, False: 0]
  ------------------
  291|  2.18k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (291:9): [True: 0, False: 2.18k]
  ------------------
  292|      0|					goto done;
  293|  2.18k|			} else {
  294|    183|				if (n_crlf) {
  ------------------
  |  Branch (294:9): [True: 46, False: 137]
  ------------------
  295|     46|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (295:10): [True: 0, False: 46]
  ------------------
  296|      0|						goto done;
  297|     46|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (297:10): [True: 24, False: 22]
  |  Branch (297:18): [True: 5, False: 17]
  |  Branch (297:26): [True: 3, False: 14]
  ------------------
  298|     32|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (298:11): [True: 0, False: 32]
  ------------------
  299|      0|							goto done;
  300|     46|				}
  301|    183|				if (n_cr) {
  ------------------
  |  Branch (301:9): [True: 127, False: 56]
  ------------------
  302|    127|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (302:10): [True: 0, False: 127]
  ------------------
  303|      0|						goto done;
  304|    127|					if (n_lf || n_nel)
  ------------------
  |  Branch (304:10): [True: 27, False: 100]
  |  Branch (304:18): [True: 5, False: 95]
  ------------------
  305|     32|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (305:11): [True: 0, False: 32]
  ------------------
  306|      0|							goto done;
  307|    127|				}
  308|    183|				if (n_lf) {
  ------------------
  |  Branch (308:9): [True: 37, False: 146]
  ------------------
  309|     37|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (309:10): [True: 0, False: 37]
  ------------------
  310|      0|						goto done;
  311|     37|					if (n_nel)
  ------------------
  |  Branch (311:10): [True: 5, False: 32]
  ------------------
  312|      5|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (312:11): [True: 0, False: 5]
  ------------------
  313|      0|							goto done;
  314|     37|				}
  315|    183|				if (n_nel)
  ------------------
  |  Branch (315:9): [True: 42, False: 141]
  ------------------
  316|     42|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (316:10): [True: 0, False: 42]
  ------------------
  317|      0|						goto done;
  318|    183|			}
  319|       |
  320|  2.36k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (320:8): [True: 0, False: 2.36k]
  ------------------
  321|      0|				goto done;
  322|  2.36k|		}
  323|       |
  324|  2.51k|		if (has_escapes)
  ------------------
  |  Branch (324:7): [True: 38, False: 2.47k]
  ------------------
  325|     38|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (325:8): [True: 0, False: 38]
  ------------------
  326|      0|				goto done;
  327|  2.51k|		if (has_backspace)
  ------------------
  |  Branch (327:7): [True: 46, False: 2.46k]
  ------------------
  328|     46|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (328:8): [True: 0, False: 46]
  ------------------
  329|      0|				goto done;
  330|  2.51k|	}
  331|  2.51k|	rv = 1;
  332|  2.57k|done:
  333|  2.57k|	free(utf8_buf);
  334|       |
  335|  2.57k|	return rv;
  336|  2.51k|}
ascmagic.c:trim_nuls:
   63|  17.9k|{
   64|   232M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 232M, False: 263]
  |  Branch (64:23): [True: 232M, False: 17.6k]
  ------------------
   65|   232M|		nbytes--;
   66|       |
   67|  17.9k|	return nbytes;
   68|  17.9k|}
ascmagic.c:encode_utf8:
  344|  2.46k|{
  345|  2.46k|	size_t i;
  346|  2.46k|	unsigned char *end = buf + len;
  347|       |
  348|  15.7M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (348:14): [True: 15.7M, False: 2.42k]
  ------------------
  349|  15.7M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (349:7): [True: 9.32M, False: 6.41M]
  ------------------
  350|  9.32M|			if (end - buf < 1)
  ------------------
  |  Branch (350:8): [True: 0, False: 9.32M]
  ------------------
  351|      0|				return NULL;
  352|  9.32M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  460|  9.32M|#define CAST(T, b)	((T)(b))
  ------------------
  353|  9.32M|			continue;
  354|  9.32M|		} 
  355|  6.41M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (355:7): [True: 6.12M, False: 293k]
  ------------------
  356|  6.12M|			if (end - buf < 2)
  ------------------
  |  Branch (356:8): [True: 0, False: 6.12M]
  ------------------
  357|      0|				return NULL;
  358|  6.12M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  460|  6.12M|#define CAST(T, b)	((T)(b))
  ------------------
  359|  6.12M|			goto out1;
  360|  6.12M|		}
  361|   293k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (361:7): [True: 165k, False: 127k]
  ------------------
  362|   165k|			if (end - buf < 3)
  ------------------
  |  Branch (362:8): [True: 0, False: 165k]
  ------------------
  363|      0|				return NULL;
  364|   165k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  460|   165k|#define CAST(T, b)	((T)(b))
  ------------------
  365|   165k|			goto out2;
  366|   165k|		}
  367|   127k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (367:7): [True: 11.2k, False: 116k]
  ------------------
  368|  11.2k|			if (end - buf < 4)
  ------------------
  |  Branch (368:8): [True: 0, False: 11.2k]
  ------------------
  369|      0|				return NULL;
  370|  11.2k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  460|  11.2k|#define CAST(T, b)	((T)(b))
  ------------------
  371|  11.2k|			goto out3;
  372|  11.2k|		}
  373|   116k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (373:7): [True: 55.4k, False: 60.9k]
  ------------------
  374|  55.4k|			if (end - buf < 5)
  ------------------
  |  Branch (374:8): [True: 0, False: 55.4k]
  ------------------
  375|      0|				return NULL;
  376|  55.4k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  460|  55.4k|#define CAST(T, b)	((T)(b))
  ------------------
  377|  55.4k|			goto out4;
  378|  55.4k|		} 
  379|  60.9k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (379:7): [True: 60.9k, False: 39]
  ------------------
  380|  60.9k|			if (end - buf < 6)
  ------------------
  |  Branch (380:8): [True: 0, False: 60.9k]
  ------------------
  381|      0|				return NULL;
  382|  60.9k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  460|  60.9k|#define CAST(T, b)	((T)(b))
  ------------------
  383|  60.9k|			goto out5;
  384|  60.9k|		} 
  385|       |		/* Invalid character */
  386|     39|		return NULL;
  387|  60.9k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  460|  60.9k|#define CAST(T, b)	((T)(b))
  ------------------
  388|   116k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  460|   116k|#define CAST(T, b)	((T)(b))
  ------------------
  389|   127k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  460|   127k|#define CAST(T, b)	((T)(b))
  ------------------
  390|   293k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  460|   293k|#define CAST(T, b)	((T)(b))
  ------------------
  391|  6.41M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  460|  6.41M|#define CAST(T, b)	((T)(b))
  ------------------
  392|  6.41M|	}
  393|       |
  394|  2.42k|	return buf;
  395|  2.46k|}

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

cdf_swap_header:
  230|  3.25k|{
  231|  3.25k|	size_t i;
  232|       |
  233|  3.25k|	h->h_magic = CDF_TOLE8(h->h_magic);
  ------------------
  |  |   82|  3.25k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  3.25k|	h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
  ------------------
  |  |   82|  3.25k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  3.25k|	h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
  ------------------
  |  |   82|  3.25k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  3.25k|	h->h_revision = CDF_TOLE2(h->h_revision);
  ------------------
  |  |   86|  3.25k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  3.25k|	h->h_version = CDF_TOLE2(h->h_version);
  ------------------
  |  |   86|  3.25k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  3.25k|	h->h_byte_order = CDF_TOLE2(h->h_byte_order);
  ------------------
  |  |   86|  3.25k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  3.25k|	h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
  ------------------
  |  |   86|  3.25k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  3.25k|	h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
  ------------------
  |  |   86|  3.25k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  3.25k|	h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|  3.25k|	h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|  3.25k|	h->h_min_size_standard_stream =
  244|  3.25k|	    CDF_TOLE4(h->h_min_size_standard_stream);
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  245|  3.25k|	h->h_secid_first_sector_in_short_sat =
  246|  3.25k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_short_sat));
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|  3.25k|	h->h_num_sectors_in_short_sat =
  248|  3.25k|	    CDF_TOLE4(h->h_num_sectors_in_short_sat);
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  3.25k|	h->h_secid_first_sector_in_master_sat =
  250|  3.25k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_master_sat));
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|  3.25k|	h->h_num_sectors_in_master_sat =
  252|  3.25k|	    CDF_TOLE4(h->h_num_sectors_in_master_sat);
  ------------------
  |  |   84|  3.25k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  6.50k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  253|   357k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  138|   357k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (253:14): [True: 354k, False: 3.25k]
  ------------------
  254|   354k|		h->h_master_sat[i] =
  255|   354k|		    CDF_TOLE4(CAST(uint32_t, h->h_master_sat[i]));
  ------------------
  |  |   84|   354k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|   708k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 354k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|   354k|	}
  257|  3.25k|}
cdf_unpack_header:
  261|  3.25k|{
  262|  3.25k|	size_t i;
  263|  3.25k|	size_t len = 0;
  264|       |
  265|  3.25k|	CDF_UNPACK(h->h_magic);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  266|  3.25k|	CDF_UNPACKA(h->h_uuid);
  ------------------
  |  |  208|  3.25k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  267|  3.25k|	CDF_UNPACK(h->h_revision);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  268|  3.25k|	CDF_UNPACK(h->h_version);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  269|  3.25k|	CDF_UNPACK(h->h_byte_order);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  270|  3.25k|	CDF_UNPACK(h->h_sec_size_p2);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  271|  3.25k|	CDF_UNPACK(h->h_short_sec_size_p2);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  272|  3.25k|	CDF_UNPACKA(h->h_unused0);
  ------------------
  |  |  208|  3.25k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  273|  3.25k|	CDF_UNPACK(h->h_num_sectors_in_sat);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  274|  3.25k|	CDF_UNPACK(h->h_secid_first_directory);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  275|  3.25k|	CDF_UNPACKA(h->h_unused1);
  ------------------
  |  |  208|  3.25k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  276|  3.25k|	CDF_UNPACK(h->h_min_size_standard_stream);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  277|  3.25k|	CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  278|  3.25k|	CDF_UNPACK(h->h_num_sectors_in_short_sat);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  279|  3.25k|	CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  280|  3.25k|	CDF_UNPACK(h->h_num_sectors_in_master_sat);
  ------------------
  |  |  206|  3.25k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  281|   357k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  138|   357k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (281:14): [True: 354k, False: 3.25k]
  ------------------
  282|   354k|		CDF_UNPACK(h->h_master_sat[i]);
  ------------------
  |  |  206|   354k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  283|  3.25k|}
cdf_swap_class:
  304|     95|{
  305|     95|	d->cl_dword = CDF_TOLE4(d->cl_dword);
  ------------------
  |  |   84|     95|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|     95|	d->cl_word[0] = CDF_TOLE2(d->cl_word[0]);
  ------------------
  |  |   86|     95|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|     95|	d->cl_word[1] = CDF_TOLE2(d->cl_word[1]);
  ------------------
  |  |   86|     95|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  308|     95|}
cdf_unpack_dir:
  312|  9.12k|{
  313|  9.12k|	size_t len = 0;
  314|       |
  315|  9.12k|	CDF_UNPACKA(d->d_name);
  ------------------
  |  |  208|  9.12k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  316|  9.12k|	CDF_UNPACK(d->d_namelen);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  317|  9.12k|	CDF_UNPACK(d->d_type);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  318|  9.12k|	CDF_UNPACK(d->d_color);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  319|  9.12k|	CDF_UNPACK(d->d_left_child);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  320|  9.12k|	CDF_UNPACK(d->d_right_child);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  321|  9.12k|	CDF_UNPACK(d->d_storage);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  322|  9.12k|	CDF_UNPACKA(d->d_storage_uuid);
  ------------------
  |  |  208|  9.12k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  323|  9.12k|	CDF_UNPACK(d->d_flags);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  324|  9.12k|	CDF_UNPACK(d->d_created);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  325|  9.12k|	CDF_UNPACK(d->d_modified);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  326|  9.12k|	CDF_UNPACK(d->d_stream_first_sector);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  327|  9.12k|	CDF_UNPACK(d->d_size);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  328|  9.12k|	CDF_UNPACK(d->d_unused0);
  ------------------
  |  |  206|  9.12k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  329|  9.12k|}
cdf_zero_stream:
  333|  1.57k|{
  334|  1.57k|	scn->sst_len = 0;
  335|  1.57k|	scn->sst_dirlen = 0;
  336|  1.57k|	scn->sst_ss = 0;
  337|  1.57k|	free(scn->sst_tab);
  338|       |	scn->sst_tab = NULL;
  339|  1.57k|	return -1;
  340|  1.57k|}
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.1k, False: 3.25k]
  ------------------
  401|  12.1k|		return -1;
  402|  3.25k|	cdf_unpack_header(h, buf);
  403|  3.25k|	cdf_swap_header(h);
  404|  3.25k|	if (h->h_magic != CDF_MAGIC) {
  ------------------
  |  |   62|  3.25k|#define CDF_MAGIC	0xE11AB1A1E011CFD0LL
  ------------------
  |  Branch (404:6): [True: 2.15k, False: 1.09k]
  ------------------
  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.09k|	if (h->h_sec_size_p2 > 20) {
  ------------------
  |  Branch (411:6): [True: 13, False: 1.08k]
  ------------------
  412|     13|		DPRINTF(("Bad sector size %hu\n", h->h_sec_size_p2));
  413|     13|		goto out;
  414|     13|	}
  415|  1.08k|	if (h->h_short_sec_size_p2 > 20) {
  ------------------
  |  Branch (415:6): [True: 5, False: 1.07k]
  ------------------
  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.07k|	return 0;
  421|  2.17k|out:
  422|  2.17k|	errno = EFTYPE;
  ------------------
  |  |   59|  2.17k|#define EFTYPE EINVAL
  ------------------
  423|  2.17k|	return -1;
  424|  1.08k|}
cdf_read_sector:
  430|   278k|{
  431|   278k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   81|   278k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|   278k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  432|   278k|	size_t pos;
  433|       |
  434|   278k|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|   278k|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  460|   278k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  460|   278k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (434:6): [True: 0, False: 278k]
  ------------------
  435|      0|		return -1;
  436|       |
  437|   278k|	pos = CDF_SEC_POS(h, id);
  ------------------
  |  |   82|   278k|#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   81|   278k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   278k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   81|   278k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   278k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|   278k|	assert(ss == len);
  ------------------
  |  Branch (438:2): [True: 0, False: 278k]
  |  Branch (438:2): [True: 278k, False: 0]
  ------------------
  439|   278k|	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  460|   278k|#define CAST(T, b)	((T)(b))
  ------------------
              	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  461|   278k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  440|   278k|}
cdf_read_short_sector:
  445|    184|{
  446|    184|	size_t ss = CDF_SHORT_SEC_SIZE(h);
  ------------------
  |  |   83|    184|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  447|    184|	size_t pos;
  448|       |
  449|    184|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|    184|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  460|    184|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (449:6): [True: 0, False: 184]
  ------------------
  450|      0|		return -1;
  451|       |
  452|    184|	pos = CDF_SHORT_SEC_POS(h, id);
  ------------------
  |  |   84|    184|#define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   83|    184|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  453|    184|	assert(ss == len);
  ------------------
  |  Branch (453:2): [True: 0, False: 184]
  |  Branch (453:2): [True: 184, False: 0]
  ------------------
  454|    184|	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
  ------------------
  |  |   81|    184|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (454:6): [True: 10, False: 174]
  ------------------
  455|     10|		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
  456|     10|		    SIZE_T_FORMAT "u\n",
  457|     10|		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
  458|     10|		goto out;
  459|     10|	}
  460|    174|	(void)memcpy(RCAST(char *, buf) + offs,
  ------------------
  |  |  461|    174|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  461|    174|	    RCAST(const char *, sst->sst_tab) + pos, len);
  ------------------
  |  |  461|    174|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  462|    174|	return len;
  463|     10|out:
  464|     10|	errno = EFTYPE;
  ------------------
  |  |   59|     10|#define EFTYPE EINVAL
  ------------------
  465|     10|	return -1;
  466|    184|}
cdf_read_sat:
  473|  1.07k|{
  474|  1.07k|	size_t i, j, k;
  475|  1.07k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   81|  1.07k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|  1.07k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  476|  1.07k|	cdf_secid_t *msa, mid, sec;
  477|  1.07k|	size_t nsatpersec = (ss / sizeof(mid)) - 1;
  478|       |
  479|  90.8k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  138|  90.8k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (479:14): [True: 90.1k, False: 756]
  ------------------
  480|  90.1k|		if (h->h_master_sat[i] == CDF_SECID_FREE)
  ------------------
  |  |   55|  90.1k|#define CDF_SECID_FREE					-1
  ------------------
  |  Branch (480:7): [True: 319, False: 89.8k]
  ------------------
  481|    319|			break;
  482|       |
  483|  1.07k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  484|  1.07k|	if ((nsatpersec > 0 &&
  ------------------
  |  Branch (484:7): [True: 925, False: 150]
  ------------------
  485|    925|	    h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
  ------------------
  |  |  483|    925|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (485:6): [True: 16, False: 909]
  ------------------
  486|  1.05k|	    i > CDF_SEC_LIMIT) {
  ------------------
  |  |  483|  1.05k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (486:6): [True: 1, False: 1.05k]
  ------------------
  487|     17|		DPRINTF(("Number of sectors in master SAT too big %u %"
  488|     17|		    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));
  489|     17|		errno = EFTYPE;
  ------------------
  |  |   59|     17|#define EFTYPE EINVAL
  ------------------
  490|     17|		return -1;
  491|     17|	}
  492|       |
  493|  1.05k|	sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
  494|  1.05k|#define CDF_SAT_LIMIT	(16 * 1024 * 1024)
  495|  1.05k|	if (ss != 0 && sat->sat_len > CDF_SAT_LIMIT / ss) {
  ------------------
  |  |  494|  1.05k|#define CDF_SAT_LIMIT	(16 * 1024 * 1024)
  ------------------
  |  Branch (495:6): [True: 1.05k, False: 0]
  |  Branch (495:17): [True: 23, False: 1.03k]
  ------------------
  496|     23|		errno = EFTYPE;
  ------------------
  |  |   59|     23|#define EFTYPE EINVAL
  ------------------
  497|     23|		return -1;
  498|     23|	}
  499|  1.03k|	DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
  500|  1.03k|	    sat->sat_len, ss));
  501|  1.03k|	if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
  ------------------
  |  |  460|  1.03k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (501:6): [True: 0, False: 1.03k]
  ------------------
  502|  1.03k|	    == NULL)
  503|      0|		return -1;
  504|       |
  505|  45.7k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  138|  45.7k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (505:14): [True: 45.3k, False: 393]
  ------------------
  506|  45.3k|		if (h->h_master_sat[i] < 0)
  ------------------
  |  Branch (506:7): [True: 614, False: 44.7k]
  ------------------
  507|    614|			break;
  508|  44.7k|		if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (508:7): [True: 28, False: 44.7k]
  ------------------
  509|  44.7k|		    h->h_master_sat[i]) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  44.7k|#define CAST(T, b)	((T)(b))
  ------------------
  510|     28|			DPRINTF(("Reading sector %d", h->h_master_sat[i]));
  511|     28|			goto out1;
  512|     28|		}
  513|  44.7k|	}
  514|       |
  515|  1.00k|	if ((msa = CAST(cdf_secid_t *, CDF_CALLOC(1, ss))) == NULL)
  ------------------
  |  |  460|  1.00k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (515:6): [True: 0, False: 1.00k]
  ------------------
  516|      0|		goto out1;
  517|       |
  518|  1.00k|	mid = h->h_secid_first_sector_in_master_sat;
  519|  36.7k|	for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
  ------------------
  |  Branch (519:14): [True: 36.3k, False: 454]
  ------------------
  520|  36.3k|		if (mid < 0)
  ------------------
  |  Branch (520:7): [True: 108, False: 36.2k]
  ------------------
  521|    108|			goto out;
  522|  36.2k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  36.2k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (522:7): [True: 3, False: 36.2k]
  ------------------
  523|      3|			DPRINTF(("Reading master sector loop limit"));
  524|      3|			goto out3;
  525|      3|		}
  526|  36.2k|		if (cdf_read_sector(info, msa, 0, ss, h, mid) !=
  ------------------
  |  Branch (526:7): [True: 62, False: 36.1k]
  ------------------
  527|  36.2k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  36.2k|#define CAST(T, b)	((T)(b))
  ------------------
  528|     62|			DPRINTF(("Reading master sector %d", mid));
  529|     62|			goto out2;
  530|     62|		}
  531|   228k|		for (k = 0; k < nsatpersec; k++, i++) {
  ------------------
  |  Branch (531:15): [True: 193k, False: 35.7k]
  ------------------
  532|   193k|			sec = CDF_TOLE4(CAST(uint32_t, msa[k]));
  ------------------
  |  |   84|   193k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|   386k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 193k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  533|   193k|			if (sec < 0)
  ------------------
  |  Branch (533:8): [True: 339, False: 192k]
  ------------------
  534|    339|				goto out;
  535|   192k|			if (i >= sat->sat_len) {
  ------------------
  |  Branch (535:8): [True: 0, False: 192k]
  ------------------
  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|   192k|			if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (541:8): [True: 41, False: 192k]
  ------------------
  542|   192k|			    sec) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|   192k|#define CAST(T, b)	((T)(b))
  ------------------
  543|     41|				DPRINTF(("Reading sector %d",
  544|     41|				    CDF_TOLE4(msa[k])));
  545|     41|				goto out2;
  546|     41|			}
  547|   192k|		}
  548|  35.7k|		mid = CDF_TOLE4(CAST(uint32_t, msa[nsatpersec]));
  ------------------
  |  |   84|  35.7k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  71.5k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 35.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  549|  35.7k|	}
  550|    901|out:
  551|    901|	sat->sat_len = i;
  552|    901|	free(msa);
  553|    901|	return 0;
  554|      3|out3:
  555|      3|	errno = EFTYPE;
  ------------------
  |  |   59|      3|#define EFTYPE EINVAL
  ------------------
  556|    106|out2:
  557|    106|	free(msa);
  558|    134|out1:
  559|    134|	free(sat->sat_tab);
  560|    134|	return -1;
  561|    106|}
cdf_count_chain:
  565|  2.13k|{
  566|  2.13k|	size_t i, j;
  567|  2.13k|	cdf_secid_t maxsector;
  568|       |
  569|  2.13k|	if (size == 0 || sat->sat_len > SIZE_MAX / size)
  ------------------
  |  Branch (569:6): [True: 0, False: 2.13k]
  |  Branch (569:19): [True: 0, False: 2.13k]
  ------------------
  570|      0|		goto out;
  571|  2.13k|	maxsector = CAST(cdf_secid_t, (sat->sat_len * size) /
  ------------------
  |  |  460|  2.13k|#define CAST(T, b)	((T)(b))
  ------------------
  572|  2.13k|	    sizeof(maxsector));
  573|       |
  574|  2.13k|	DPRINTF(("Chain:"));
  575|  2.13k|	if (sid == CDF_SECID_END_OF_CHAIN) {
  ------------------
  |  |   56|  2.13k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (575:6): [True: 25, False: 2.10k]
  ------------------
  576|       |		/* 0-length chain. */
  577|     25|		DPRINTF((" empty\n"));
  578|     25|		return 0;
  579|     25|	}
  580|       |
  581|   282k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (581:18): [True: 280k, False: 1.73k]
  ------------------
  582|   280k|		DPRINTF((" %d", sid));
  583|   280k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   280k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (583:7): [True: 26, False: 280k]
  ------------------
  584|     26|			DPRINTF(("Counting chain loop limit"));
  585|     26|			goto out;
  586|     26|		}
  587|   280k|		if (i >= CDF_MEMORY_LIMIT / size) {
  ------------------
  |  |   52|   280k|#define CDF_MEMORY_LIMIT				(16 * 1024 * 1024)
  ------------------
  |  Branch (587:7): [True: 4, False: 280k]
  ------------------
  588|      4|			DPRINTF(("Counting chain size limit"));
  589|      4|			goto out;
  590|      4|		}
  591|   280k|		if (sid >= maxsector) {
  ------------------
  |  Branch (591:7): [True: 342, False: 280k]
  ------------------
  592|    342|			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
  593|    342|			goto out;
  594|    342|		}
  595|   280k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|   280k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|   560k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 280k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  596|   280k|	}
  597|  1.73k|	if (i == 0) {
  ------------------
  |  Branch (597:6): [True: 196, False: 1.53k]
  ------------------
  598|    196|		DPRINTF((" none, sid: %d\n", sid));
  599|    196|		goto out;
  600|       |
  601|    196|	}
  602|  1.53k|	DPRINTF(("\n"));
  603|  1.53k|	return i;
  604|    568|out:
  605|    568|	errno = EFTYPE;
  ------------------
  |  |   59|    568|#define EFTYPE EINVAL
  ------------------
  606|    568|	return CAST(size_t, -1);
  ------------------
  |  |  460|    568|#define CAST(T, b)	((T)(b))
  ------------------
  607|  1.73k|}
cdf_read_long_sector_chain:
  612|    441|{
  613|    441|	size_t ss = CDF_SEC_SIZE(h), i, j;
  ------------------
  |  |   81|    441|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    441|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  614|    441|	ssize_t nr;
  615|    441|	scn->sst_tab = NULL;
  616|    441|	scn->sst_len = cdf_count_chain(sat, sid, ss);
  617|    441|	scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
  ------------------
  |  Branch (617:20): [True: 297, False: 144]
  ------------------
  618|    441|	scn->sst_ss = ss;
  619|       |
  620|    441|	if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
  ------------------
  |  |   56|    882|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (620:6): [True: 3, False: 438]
  |  Branch (620:39): [True: 87, False: 351]
  ------------------
  621|     90|		return cdf_zero_stream(scn);
  622|       |
  623|    351|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  460|    351|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (623:6): [True: 71, False: 280]
  ------------------
  624|     71|		goto out;
  625|       |
  626|    280|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|    280|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  627|    280|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (627:6): [True: 0, False: 280]
  ------------------
  628|      0|		return cdf_zero_stream(scn);
  629|       |
  630|  1.43k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (630:18): [True: 1.17k, False: 261]
  ------------------
  631|  1.17k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.17k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (631:7): [True: 0, False: 1.17k]
  ------------------
  632|      0|			DPRINTF(("Read long sector chain loop limit"));
  633|      0|			goto out;
  634|      0|		}
  635|  1.17k|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (635:7): [True: 0, False: 1.17k]
  ------------------
  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.17k|		if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (641:7): [True: 19, False: 1.15k]
  ------------------
  642|  1.17k|		    sid)) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  1.17k|#define CAST(T, b)	((T)(b))
  ------------------
  643|     19|			if (i == scn->sst_len - 1 && nr > 0) {
  ------------------
  |  Branch (643:8): [True: 6, False: 13]
  |  Branch (643:33): [True: 0, False: 6]
  ------------------
  644|       |				/* Last sector might be truncated */
  645|      0|				return 0;
  646|      0|			}
  647|     19|			DPRINTF(("Reading long sector chain %d", sid));
  648|     19|			goto out;
  649|     19|		}
  650|  1.15k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.15k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  2.30k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 1.15k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  651|  1.15k|	}
  652|    261|	return 0;
  653|     90|out:
  654|     90|	errno = EFTYPE;
  ------------------
  |  |   59|     90|#define EFTYPE EINVAL
  ------------------
  655|     90|	return cdf_zero_stream(scn);
  656|    280|}
cdf_read_short_sector_chain:
  662|    164|{
  663|    164|	size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
  ------------------
  |  |   83|    164|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    164|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  664|    164|	scn->sst_tab = NULL;
  665|    164|	scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
  ------------------
  |  |   81|    164|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    164|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  666|    164|	scn->sst_dirlen = len;
  667|    164|	scn->sst_ss = ss;
  668|       |
  669|    164|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  460|    164|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (669:6): [True: 104, False: 60]
  ------------------
  670|    104|		goto out;
  671|       |
  672|     60|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|     60|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  673|     60|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (673:6): [True: 0, False: 60]
  ------------------
  674|      0|		return cdf_zero_stream(scn);
  675|       |
  676|    234|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (676:18): [True: 184, False: 50]
  ------------------
  677|    184|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    184|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (677:7): [True: 0, False: 184]
  ------------------
  678|      0|			DPRINTF(("Read short sector chain loop limit"));
  679|      0|			goto out;
  680|      0|		}
  681|    184|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (681:7): [True: 0, False: 184]
  ------------------
  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|    184|		if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (687:7): [True: 10, False: 174]
  ------------------
  688|    184|		    sid) != CAST(ssize_t, ss)) {
  ------------------
  |  |  460|    184|#define CAST(T, b)	((T)(b))
  ------------------
  689|     10|			DPRINTF(("Reading short sector chain %d", sid));
  690|     10|			goto out;
  691|     10|		}
  692|    174|		sid = CDF_TOLE4(CAST(uint32_t, ssat->sat_tab[sid]));
  ------------------
  |  |   84|    174|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    348|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 174]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  693|    174|	}
  694|     50|	return 0;
  695|    114|out:
  696|    114|	errno = EFTYPE;
  ------------------
  |  |   59|    114|#define EFTYPE EINVAL
  ------------------
  697|    114|	return cdf_zero_stream(scn);
  698|     60|}
cdf_read_sector_chain:
  704|    339|{
  705|       |
  706|    339|	if (len < h->h_min_size_standard_stream && sst->sst_tab != NULL)
  ------------------
  |  Branch (706:6): [True: 242, False: 97]
  |  Branch (706:45): [True: 164, False: 78]
  ------------------
  707|    164|		return cdf_read_short_sector_chain(h, ssat, sst, sid, len,
  708|    164|		    scn);
  709|    175|	else
  710|    175|		return cdf_read_long_sector_chain(info, h, sat, sid, len, scn);
  711|    339|}
cdf_read_dir:
  716|    624|{
  717|    624|	size_t i, j;
  718|    624|	size_t ss = CDF_SEC_SIZE(h), ns, nd;
  ------------------
  |  |   81|    624|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    624|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  719|    624|	char *buf;
  720|    624|	cdf_secid_t sid = h->h_secid_first_directory;
  721|       |
  722|    624|	ns = cdf_count_chain(sat, sid, ss);
  723|    624|	if (ns == CAST(size_t, -1))
  ------------------
  |  |  460|    624|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (723:6): [True: 81, False: 543]
  ------------------
  724|     81|		return -1;
  725|       |
  726|    543|	nd = ss / CDF_DIRECTORY_SIZE;
  ------------------
  |  |  118|    543|#define CDF_DIRECTORY_SIZE	128
  ------------------
  727|    543|	if (nd != 0 && ns > CDF_MEMORY_LIMIT / nd / sizeof(dir->dir_tab[0])) {
  ------------------
  |  |   52|    505|#define CDF_MEMORY_LIMIT				(16 * 1024 * 1024)
  ------------------
  |  Branch (727:6): [True: 505, False: 38]
  |  Branch (727:17): [True: 0, False: 505]
  ------------------
  728|      0|		DPRINTF(("Directory size limit"));
  729|      0|		errno = EFTYPE;
  ------------------
  |  |   59|      0|#define EFTYPE EINVAL
  ------------------
  730|      0|		return -1;
  731|      0|	}
  732|       |
  733|    543|	dir->dir_len = ns * nd;
  734|    543|	dir->dir_tab = CAST(cdf_directory_t *,
  ------------------
  |  |  460|    543|#define CAST(T, b)	((T)(b))
  ------------------
  735|    543|	    CDF_CALLOC(dir->dir_len, sizeof(dir->dir_tab[0])));
  736|    543|	if (dir->dir_tab == NULL)
  ------------------
  |  Branch (736:6): [True: 0, False: 543]
  ------------------
  737|      0|		return -1;
  738|       |
  739|    543|	if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
  ------------------
  |  |  460|    543|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (739:6): [True: 0, False: 543]
  ------------------
  740|      0|		free(dir->dir_tab);
  741|      0|		return -1;
  742|      0|	}
  743|       |
  744|  2.48k|	for (j = i = 0; i < ns; i++, j++) {
  ------------------
  |  Branch (744:18): [True: 1.95k, False: 536]
  ------------------
  745|  1.95k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.95k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (745:7): [True: 0, False: 1.95k]
  ------------------
  746|      0|			DPRINTF(("Read dir loop limit"));
  747|      0|			goto out;
  748|      0|		}
  749|  1.95k|		if (cdf_read_sector(info, buf, 0, ss, h, sid) !=
  ------------------
  |  Branch (749:7): [True: 7, False: 1.94k]
  ------------------
  750|  1.95k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  1.95k|#define CAST(T, b)	((T)(b))
  ------------------
  751|      7|			DPRINTF(("Reading directory sector %d", sid));
  752|      7|			goto out;
  753|      7|		}
  754|  11.0k|		for (j = 0; j < nd; j++) {
  ------------------
  |  Branch (754:15): [True: 9.12k, False: 1.94k]
  ------------------
  755|  9.12k|			cdf_unpack_dir(&dir->dir_tab[i * nd + j],
  756|  9.12k|			    &buf[j * CDF_DIRECTORY_SIZE]);
  ------------------
  |  |  118|  9.12k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  757|  9.12k|		}
  758|  1.94k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.94k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  3.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 1.94k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  759|  1.94k|	}
  760|    536|	if (NEED_SWAP)
  ------------------
  |  |   79|    536|#define NEED_SWAP	(cdf_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  460|    536|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (79:19): [True: 0, False: 536]
  |  |  ------------------
  ------------------
  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|    536|	free(buf);
  764|    536|	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|    543|}
cdf_read_ssat:
  776|    901|{
  777|    901|	size_t i, j;
  778|    901|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   81|    901|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    901|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  779|    901|	cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
  780|       |
  781|    901|	ssat->sat_tab = NULL;
  782|    901|	ssat->sat_len = cdf_count_chain(sat, sid, ss);
  783|    901|	if (ssat->sat_len == CAST(size_t, -1))
  ------------------
  |  |  460|    901|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (783:6): [True: 252, False: 649]
  ------------------
  784|    252|		goto out;
  785|       |
  786|    649|	ssat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(ssat->sat_len, ss));
  ------------------
  |  |  460|    649|#define CAST(T, b)	((T)(b))
  ------------------
  787|    649|	if (ssat->sat_tab == NULL)
  ------------------
  |  Branch (787:6): [True: 0, False: 649]
  ------------------
  788|      0|		goto out1;
  789|       |
  790|  2.11k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (790:18): [True: 1.49k, False: 624]
  ------------------
  791|  1.49k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  1.49k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (791:7): [True: 0, False: 1.49k]
  ------------------
  792|      0|			DPRINTF(("Read short sat sector loop limit"));
  793|      0|			goto out;
  794|      0|		}
  795|  1.49k|		if (i >= ssat->sat_len) {
  ------------------
  |  Branch (795:7): [True: 0, False: 1.49k]
  ------------------
  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.49k|		if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
  ------------------
  |  Branch (801:7): [True: 25, False: 1.46k]
  ------------------
  802|  1.49k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  460|  1.49k|#define CAST(T, b)	((T)(b))
  ------------------
  803|     25|			DPRINTF(("Reading short sat sector %d", sid));
  804|     25|			goto out1;
  805|     25|		}
  806|  1.46k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  1.46k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|  2.93k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 1.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  807|  1.46k|	}
  808|    624|	return 0;
  809|    252|out:
  810|    252|	errno = EFTYPE;
  ------------------
  |  |   59|    252|#define EFTYPE EINVAL
  ------------------
  811|    277|out1:
  812|    277|	free(ssat->sat_tab);
  813|    277|	return -1;
  814|    252|}
cdf_read_short_stream:
  820|    536|{
  821|    536|	size_t i;
  822|    536|	const cdf_directory_t *d;
  823|       |
  824|    536|	*root = NULL;
  825|  5.14k|	for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (825:14): [True: 4.92k, False: 225]
  ------------------
  826|  4.92k|		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
  ------------------
  |  |  102|  4.92k|#define CDF_DIR_TYPE_ROOT_STORAGE	5
  ------------------
  |  Branch (826:7): [True: 311, False: 4.61k]
  ------------------
  827|    311|			break;
  828|       |
  829|       |	/* If the it is not there, just fake it; some docs don't have it */
  830|    536|	if (i == dir->dir_len) {
  ------------------
  |  Branch (830:6): [True: 225, False: 311]
  ------------------
  831|    225|		DPRINTF(("Cannot find root storage dir\n"));
  832|    225|		goto out;
  833|    225|	}
  834|    311|	d = &dir->dir_tab[i];
  835|    311|	*root = d;
  836|       |
  837|       |	/* If the it is not there, just fake it; some docs don't have it */
  838|    311|	if (d->d_stream_first_sector < 0) {
  ------------------
  |  Branch (838:6): [True: 45, False: 266]
  ------------------
  839|     45|		DPRINTF(("No first secror in dir\n"));
  840|     45|		goto out;
  841|     45|	}
  842|       |
  843|    266|	return cdf_read_long_sector_chain(info, h, sat,
  844|    266|	    d->d_stream_first_sector, d->d_size, scn);
  845|    270|out:
  846|       |	scn->sst_tab = NULL;
  847|    270|	(void)cdf_zero_stream(scn);
  848|    270|	return 0;
  849|    311|}
cdf_namecmp:
  853|  7.13k|{
  854|  14.5k|	for (; l--; d++, s++)
  ------------------
  |  Branch (854:9): [True: 14.1k, False: 343]
  ------------------
  855|  14.1k|		if (*d != CDF_TOLE2(*s))
  ------------------
  |  |   86|  14.1k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  28.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 14.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (855:7): [True: 6.78k, False: 7.38k]
  ------------------
  856|  6.78k|			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |  460|  6.78k|#define CAST(T, b)	((T)(b))
  ------------------
              			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |   86|  6.78k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|  13.5k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 6.78k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  857|    343|	return 0;
  858|  7.13k|}
cdf_read_doc_summary_info:
  864|    447|{
  865|    447|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  866|    447|	    "\05DocumentSummaryInformation", scn);
  867|    447|}
cdf_read_summary_info:
  873|    447|{
  874|    447|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  875|    447|	    "\05SummaryInformation", scn);
  876|    447|}
cdf_read_user_stream:
  882|  1.34k|{
  883|  1.34k|	const cdf_directory_t *d;
  884|  1.34k|	int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
  ------------------
  |  |   99|  1.34k|#define CDF_DIR_TYPE_USER_STREAM	2
  ------------------
  885|       |
  886|  1.34k|	if (i <= 0) {
  ------------------
  |  Branch (886:6): [True: 1.00k, False: 339]
  ------------------
  887|  1.00k|		memset(scn, 0, sizeof(*scn));
  888|  1.00k|		return -1;
  889|  1.00k|	}
  890|       |
  891|    339|	d = &dir->dir_tab[i - 1];
  892|    339|	return cdf_read_sector_chain(info, h, sat, ssat, sst,
  893|    339|	    d->d_stream_first_sector, d->d_size, scn);
  894|  1.34k|}
cdf_find_stream:
  898|  1.34k|{
  899|  1.34k|	size_t i, name_len = strlen(name) + 1;
  900|       |
  901|  19.8k|	for (i = 1; i <= dir->dir_len; i++)
  ------------------
  |  Branch (901:14): [True: 18.8k, False: 1.00k]
  ------------------
  902|  18.8k|		if (dir->dir_tab[i-1].d_type == type &&
  ------------------
  |  Branch (902:7): [True: 1.83k, False: 16.9k]
  ------------------
  903|  1.83k|		    cdf_namecmp(name, dir->dir_tab[i-1].d_name, name_len)
  ------------------
  |  Branch (903:7): [True: 339, False: 1.49k]
  ------------------
  904|  1.83k|		    == 0)
  905|    339|			break;
  906|  1.34k|	if (i <= dir->dir_len)
  ------------------
  |  Branch (906:6): [True: 339, False: 1.00k]
  ------------------
  907|    339|		return CAST(int, i);
  ------------------
  |  |  460|    339|#define CAST(T, b)	((T)(b))
  ------------------
  908|       |
  909|  1.00k|	DPRINTF(("Cannot find type %d `%s'\n", type, name));
  910|  1.00k|	errno = ESRCH;
  911|  1.00k|	return 0;
  912|  1.34k|}
cdf_read_property_info:
 1011|     95|{
 1012|     95|	const cdf_section_header_t *shp;
 1013|     95|	cdf_section_header_t sh;
 1014|     95|	const uint8_t *p, *q, *e;
 1015|     95|	size_t i, o4, nelements, j, slen, left;
 1016|     95|	cdf_property_info_t *inp;
 1017|       |
 1018|     95|	if (offs > UINT32_MAX / 4) {
  ------------------
  |  Branch (1018:6): [True: 11, False: 84]
  ------------------
 1019|     11|		errno = EFTYPE;
  ------------------
  |  |   59|     11|#define EFTYPE EINVAL
  ------------------
 1020|     11|		goto out;
 1021|     11|	}
 1022|     84|	shp = CAST(const cdf_section_header_t *,
  ------------------
  |  |  460|     84|#define CAST(T, b)	((T)(b))
  ------------------
 1023|     84|	    cdf_offset(sst->sst_tab, offs));
 1024|     84|	if (cdf_check_stream_offset(sst, h, &sh, sizeof(sh), __LINE__) == -1)
  ------------------
  |  Branch (1024:6): [True: 84, False: 0]
  ------------------
 1025|     84|		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|     95|out:
 1158|     95|	free(*info);
 1159|     95|	*info = NULL;
 1160|     95|	*count = 0;
 1161|     95|	*maxcount = 0;
 1162|     95|	errno = EFTYPE;
  ------------------
  |  |   59|     95|#define EFTYPE EINVAL
  ------------------
 1163|     95|	return -1;
 1164|      0|}
cdf_unpack_summary_info:
 1169|    121|{
 1170|    121|	size_t maxcount;
 1171|    121|	const cdf_summary_info_header_t *si =
 1172|    121|	    CAST(const cdf_summary_info_header_t *, sst->sst_tab);
  ------------------
  |  |  460|    121|#define CAST(T, b)	((T)(b))
  ------------------
 1173|    121|	const cdf_section_declaration_t *sd =
 1174|    121|	    CAST(const cdf_section_declaration_t *, RCAST(const void *,
  ------------------
  |  |  460|    121|#define CAST(T, b)	((T)(b))
  ------------------
 1175|    121|	    RCAST(const char *, sst->sst_tab)
 1176|    121|	    + CDF_SECTION_DECLARATION_OFFSET));
 1177|       |
 1178|    121|	if (cdf_check_stream_offset(sst, h, si, sizeof(*si), __LINE__) == -1 ||
  ------------------
  |  Branch (1178:6): [True: 21, False: 100]
  ------------------
 1179|    100|	    cdf_check_stream_offset(sst, h, sd, sizeof(*sd), __LINE__) == -1)
  ------------------
  |  Branch (1179:6): [True: 5, False: 95]
  ------------------
 1180|     26|		return -1;
 1181|     95|	ssi->si_byte_order = CDF_TOLE2(si->si_byte_order);
  ------------------
  |  |   86|     95|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1182|     95|	ssi->si_os_version = CDF_TOLE2(si->si_os_version);
  ------------------
  |  |   86|     95|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1183|     95|	ssi->si_os = CDF_TOLE2(si->si_os);
  ------------------
  |  |   86|     95|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1184|     95|	ssi->si_class = si->si_class;
 1185|     95|	cdf_swap_class(&ssi->si_class);
 1186|     95|	ssi->si_count = CDF_TOLE4(si->si_count);
  ------------------
  |  |   84|     95|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1187|     95|	*count = 0;
 1188|     95|	maxcount = 0;
 1189|     95|	*info = NULL;
 1190|     95|	if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
  ------------------
  |  |   84|     95|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  460|    190|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1190:6): [True: 95, False: 0]
  ------------------
 1191|     95|	    count, &maxcount) == -1)
 1192|     95|		return -1;
 1193|      0|	return 0;
 1194|     95|}
cdf.c:cdf_read:
  371|   293k|{
  372|   293k|	size_t siz = CAST(size_t, off + len);
  ------------------
  |  |  460|   293k|#define CAST(T, b)	((T)(b))
  ------------------
  373|       |
  374|   293k|	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  460|   293k|#define CAST(T, b)	((T)(b))
  ------------------
              	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  460|   293k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (374:6): [True: 0, False: 293k]
  ------------------
  375|      0|		goto out;
  376|       |
  377|   293k|	if (info->i_buf != NULL && info->i_len >= siz) {
  ------------------
  |  Branch (377:6): [True: 293k, False: 0]
  |  Branch (377:29): [True: 281k, False: 12.3k]
  ------------------
  378|   281k|		(void)memcpy(buf, &info->i_buf[off], len);
  379|   281k|		return CAST(ssize_t, len);
  ------------------
  |  |  460|   281k|#define CAST(T, b)	((T)(b))
  ------------------
  380|   281k|	}
  381|       |
  382|  12.3k|	if (info->i_fd == -1)
  ------------------
  |  Branch (382:6): [True: 3.94k, False: 8.37k]
  ------------------
  383|  3.94k|		goto out;
  384|       |
  385|  8.37k|	if (pread(info->i_fd, buf, len, off) != CAST(ssize_t, len))
  ------------------
  |  |  460|  8.37k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (385:6): [True: 8.37k, False: 0]
  ------------------
  386|  8.37k|		return -1;
  387|       |
  388|      0|	return CAST(ssize_t, len);
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  389|  3.94k|out:
  390|  3.94k|	errno = EINVAL;
  391|  3.94k|	return -1;
  392|  8.37k|}
cdf.c:cdf_calloc:
  125|  3.57k|{
  126|  3.57k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u %"
  127|  3.57k|	    SIZE_T_FORMAT "u\n", file, line, __func__, n, u));
  128|  3.57k|	if (n == 0)
  ------------------
  |  Branch (128:6): [True: 61, False: 3.51k]
  ------------------
  129|     61|	    n++;
  130|  3.57k|	return calloc(n, u);
  131|  3.57k|}
cdf.c:cdf_malloc:
  103|    543|{
  104|    543|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  105|    543|	    file, line, __func__, n));
  106|    543|	if (n == 0)
  ------------------
  |  Branch (106:6): [True: 0, False: 543]
  ------------------
  107|      0|	    n++;
  108|    543|	return malloc(n);
  109|    543|}
cdf.c:cdf_offset:
  919|     84|{
  920|     84|	return CAST(const void *, CAST(const uint8_t *, p) + l);
  ------------------
  |  |  460|     84|#define CAST(T, b)	((T)(b))
  ------------------
  921|     84|}
cdf.c:cdf_check_stream_offset:
  354|    305|{
  355|    305|	const char *b = RCAST(const char *, sst->sst_tab);
  ------------------
  |  |  461|    305|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  356|    305|	const char *e = RCAST(const char *, p) + tail;
  ------------------
  |  |  461|    305|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  357|    305|	size_t ss = cdf_check_stream(sst, h);
  358|    305|	/*LINTED*/(void)&line;
  359|    305|	if (e >= b && CAST(size_t, e - b) <= ss * sst->sst_len)
  ------------------
  |  |  460|    305|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (359:6): [True: 305, False: 0]
  |  Branch (359:16): [True: 195, False: 110]
  ------------------
  360|    195|		return 0;
  361|    110|	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
  362|    110|	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
  363|    110|	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
  364|    110|	    ss * sst->sst_len, ss, sst->sst_len));
  365|    110|	errno = EFTYPE;
  ------------------
  |  |   59|    110|#define EFTYPE EINVAL
  ------------------
  366|    110|	return -1;
  367|    305|}
cdf.c:cdf_check_stream:
  344|    305|{
  345|    305|	size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
  ------------------
  |  Branch (345:14): [True: 82, False: 223]
  ------------------
  346|    305|	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   83|     82|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|     82|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   81|    223|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  460|    223|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  347|    305|	assert(ss == sst->sst_ss);
  ------------------
  |  Branch (347:2): [True: 0, False: 305]
  |  Branch (347:2): [True: 305, False: 0]
  ------------------
  348|    305|	return sst->sst_ss;
  349|    305|}

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

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.27k, False: 12.0k]
  ------------------
  322|  6.27k|		return 0;
  323|       |
  324|   192k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (324:14): [True: 180k, False: 12.0k]
  ------------------
  325|   180k|		int zm;
  326|   180k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  460|   180k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (326:7): [True: 8.28k, False: 172k]
  ------------------
  327|  8.28k|			continue;
  328|   172k|		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|   172k|		if (!zm)
  ------------------
  |  Branch (335:7): [True: 169k, False: 3.34k]
  ------------------
  336|   169k|			continue;
  337|       |
  338|  3.34k|#ifdef HAVE_SIGACTION
  339|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  340|  3.34k|		if (!sa_saved) {
  ------------------
  |  Branch (340:7): [True: 2.94k, False: 394]
  ------------------
  341|       |			//We can use sig_act for both new and old, but
  342|  2.94k|			struct sigaction new_act;
  343|  2.94k|			memset(&new_act, 0, sizeof(new_act));
  344|  2.94k|			new_act.sa_handler = SIG_IGN;
  345|  2.94k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  346|  2.94k|		}
  347|  3.34k|#endif
  348|       |
  349|  3.34k|		nsz = nbytes;
  350|  3.34k|		free(newbuf);
  351|  3.34k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  352|  3.34k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  3.34k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  353|  3.34k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  354|  3.34k|		    (char *)newbuf, nsz);
  355|  3.34k|		switch (urv) {
  356|  3.09k|		case OKDATA:
  ------------------
  |  |  242|  3.09k|#define OKDATA 	0
  ------------------
  |  Branch (356:3): [True: 3.09k, False: 251]
  ------------------
  357|  3.34k|		case ERRDATA:
  ------------------
  |  |  244|  3.34k|#define ERRDATA	2
  ------------------
  |  Branch (357:3): [True: 251, False: 3.09k]
  ------------------
  358|  3.34k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  3.34k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  359|  3.34k|			if (urv == ERRDATA)
  ------------------
  |  |  244|  3.34k|#define ERRDATA	2
  ------------------
  |  Branch (359:8): [True: 251, False: 3.09k]
  ------------------
  360|    251|				prv = format_decompression_error(ms, i, newbuf);
  361|  3.09k|			else
  362|  3.09k|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  363|  3.09k|				    nsz);
  364|  3.34k|			if (prv == -1)
  ------------------
  |  Branch (364:8): [True: 0, False: 3.34k]
  ------------------
  365|      0|				goto error;
  366|  3.34k|			rv = 1;
  367|  3.34k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  3.34k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (367:8): [True: 0, False: 3.34k]
  ------------------
  368|      0|				goto out;
  369|  3.34k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  6.68k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  3.34k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  3.34k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (369:8): [True: 3.34k, False: 0]
  |  Branch (369:30): [True: 0, False: 3.34k]
  ------------------
  370|      0|				goto out;
  371|  3.34k|			if ((file_printf(ms,
  ------------------
  |  Branch (371:8): [True: 0, False: 3.34k]
  ------------------
  372|  3.34k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (372:8): [True: 0, False: 3.34k]
  ------------------
  373|      0|				goto error;
  374|  3.34k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (374:8): [True: 127, False: 3.21k]
  ------------------
  375|    127|				goto error;
  376|       |			/*
  377|       |			 * XXX: If file_buffer fails here, we overwrite
  378|       |			 * the compressed text. FIXME.
  379|       |			 */
  380|  3.21k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (380:8): [True: 0, False: 3.21k]
  ------------------
  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.21k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (386:8): [True: 3.21k, False: 0]
  ------------------
  387|  3.21k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (387:9): [True: 6, False: 3.21k]
  ------------------
  388|      6|					free(rbuf);
  389|      6|					goto error;
  390|      6|				}
  391|  3.21k|				free(rbuf);
  392|  3.21k|			}
  393|  3.21k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (393:8): [True: 3.21k, False: 0]
  |  Branch (393:17): [True: 0, False: 3.21k]
  ------------------
  394|      0|				goto error;
  395|       |			/*FALLTHROUGH*/
  396|  3.21k|		case NODATA:
  ------------------
  |  |  243|  3.21k|#define NODATA	1
  ------------------
  |  Branch (396:3): [True: 0, False: 3.34k]
  ------------------
  397|  3.21k|			break;
  398|      0|		default:
  ------------------
  |  Branch (398:3): [True: 0, False: 3.34k]
  ------------------
  399|      0|			abort();
  400|       |			/*NOTREACHED*/
  401|    133|		error:
  402|    133|			rv = -1;
  403|    133|			break;
  404|  3.34k|		}
  405|  3.34k|	}
  406|  12.0k|out:
  407|  12.0k|	DPRINTF("rv = %d\n", rv);
  408|       |
  409|  12.0k|#ifdef HAVE_SIGACTION
  410|  12.0k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (410:6): [True: 2.94k, False: 9.10k]
  |  Branch (410:18): [True: 2.94k, False: 0]
  ------------------
  411|  2.94k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  412|  12.0k|#endif
  413|       |
  414|  12.0k|	free(newbuf);
  415|  12.0k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  12.0k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  416|  12.0k|	DPRINTF("Zmagic returns %d\n", rv);
  417|  12.0k|	return rv;
  418|  12.0k|}
sread:
  450|  6.39k|{
  451|  6.39k|	ssize_t rv;
  452|  6.39k|#if defined(FIONREAD) && defined(HAVE_IOCTL) && !defined(__MINGW32__)
  453|  6.39k|	int t = 0;
  454|  6.39k|#endif
  455|  6.39k|	size_t rn = n;
  456|       |
  457|  6.39k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (457:6): [True: 0, False: 6.39k]
  ------------------
  458|      0|		goto nocheck;
  459|       |
  460|  6.39k|#if defined(FIONREAD) && defined(HAVE_IOCTL) && !defined(__MINGW32__)
  461|  6.39k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (461:6): [True: 0, False: 6.39k]
  |  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.39k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (489:6): [True: 0, False: 6.39k]
  |  Branch (489:15): [True: 0, False: 0]
  ------------------
  490|      0|		n = t;
  491|      0|		rn = n;
  492|      0|	}
  493|  6.39k|#endif
  494|       |
  495|  6.39k|nocheck:
  496|  6.39k|	do
  497|   239k|		switch ((rv = read(fd, buf, n))) {
  498|      0|		case -1:
  ------------------
  |  Branch (498:3): [True: 0, False: 239k]
  ------------------
  499|      0|			if (errno == EINTR)
  ------------------
  |  Branch (499:8): [True: 0, False: 0]
  ------------------
  500|      0|				continue;
  501|      0|			return -1;
  502|  6.25k|		case 0:
  ------------------
  |  Branch (502:3): [True: 6.25k, False: 233k]
  ------------------
  503|  6.25k|			return rn - n;
  504|   233k|		default:
  ------------------
  |  Branch (504:3): [True: 233k, False: 6.25k]
  ------------------
  505|   233k|			n -= rv;
  506|   233k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  460|   233k|#define CAST(T, b)	((T)(b))
  ------------------
  507|   233k|			break;
  508|   239k|		}
  509|   233k|	while (n > 0);
  ------------------
  |  Branch (509:9): [True: 233k, False: 137]
  ------------------
  510|    137|	return rn;
  511|  6.39k|}
compress.c:lzmacmp:
  162|  8.70k|{
  163|  8.70k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (163:6): [True: 8.69k, False: 12]
  |  Branch (163:24): [True: 2, False: 10]
  |  Branch (163:34): [True: 1, False: 9]
  ------------------
  164|  8.70k|		return 0;
  165|      9|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (165:6): [True: 8, False: 1]
  |  Branch (165:17): [True: 7, False: 1]
  ------------------
  166|      7|		return 0;
  167|      2|	return 1;
  168|      9|}
compress.c:zlibcmp:
  145|  12.0k|{
  146|  12.0k|	unsigned short x;
  147|       |
  148|  12.0k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (148:6): [True: 11.9k, False: 122]
  |  Branch (148:29): [True: 26, False: 96]
  ------------------
  149|  11.9k|		return 0;
  150|     96|	if (file_bigendian())	/* endianness test */
  ------------------
  |  Branch (150:6): [True: 0, False: 96]
  ------------------
  151|      0|		x = buf[0] | (buf[1] << 8);
  152|     96|	else
  153|     96|		x = buf[1] | (buf[0] << 8);
  154|     96|	if (x % 31)
  ------------------
  |  Branch (154:6): [True: 70, False: 26]
  ------------------
  155|     70|		return 0;
  156|     26|	return 1;
  157|     96|}
compress.c:format_decompression_error:
  289|    251|{
  290|    251|	unsigned char *p;
  291|    251|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    251|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    251|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    251|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  292|       |
  293|    251|	if (!mime)
  ------------------
  |  Branch (293:6): [True: 251, False: 0]
  ------------------
  294|    251|		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|    251|}
compress.c:methodname:
 1115|    251|{
 1116|    251|	switch (method) {
 1117|      0|#ifdef BUILTIN_DECOMPRESS
 1118|     31|	case METH_FROZEN:
  ------------------
  |  |  210|     31|#define METH_FROZEN	2
  ------------------
  |  Branch (1118:2): [True: 31, False: 220]
  ------------------
 1119|     57|	case METH_ZLIB:
  ------------------
  |  |  218|     57|#define METH_ZLIB	14
  ------------------
  |  Branch (1119:2): [True: 26, False: 225]
  ------------------
 1120|     57|		return "zlib";
 1121|      0|#endif
 1122|      0|#ifdef BUILTIN_BZLIB
 1123|      7|	case METH_BZIP:
  ------------------
  |  |  211|      7|#define METH_BZIP	7
  ------------------
  |  Branch (1123:2): [True: 7, False: 244]
  ------------------
 1124|      7|		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: 250]
  ------------------
 1128|      3|	case METH_LZMA:
  ------------------
  |  |  217|      3|#define METH_LZMA	13
  ------------------
  |  Branch (1128:2): [True: 2, False: 249]
  ------------------
 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: 249]
  ------------------
 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|    182|	default:
  ------------------
  |  Branch (1143:2): [True: 182, False: 69]
  ------------------
 1144|    182|		return compr[method].argv[0];
 1145|    251|	}
 1146|    251|}
compress.c:uncompressbuf:
 1192|  3.34k|{
 1193|  3.34k|	int fdp[3][2];
 1194|  3.34k|	int status, rv, w;
 1195|  3.34k|	pid_t pid;
 1196|  3.34k|	pid_t writepid = -1;
 1197|  3.34k|	size_t i;
 1198|  3.34k|	ssize_t r, re;
 1199|  3.34k|	char *const *args;
 1200|  3.34k|#ifdef HAVE_POSIX_SPAWNP
 1201|  3.34k|	posix_spawn_file_actions_t fa;
 1202|  3.34k|#endif
 1203|  3.34k|	int (*decompress)(const unsigned char *, unsigned char **,
 1204|  3.34k|	    size_t, size_t *, int) = getdecompressor(method);
 1205|       |
 1206|  3.34k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  460|  3.34k|#define CAST(T, b)	((T)(b))
  ------------------
 1207|  3.34k|	if (*newch == NULL)
  ------------------
  |  Branch (1207:6): [True: 0, False: 3.34k]
  ------------------
 1208|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1209|       |
 1210|  3.34k|	if (decompress) {
  ------------------
  |  Branch (1210:6): [True: 70, False: 3.27k]
  ------------------
 1211|     70|		if (nofork) {
  ------------------
  |  Branch (1211:7): [True: 70, False: 0]
  ------------------
 1212|     70|			return makeerror(newch, n,
 1213|     70|			    "Fork is required to uncompress, but disabled");
 1214|     70|		}
 1215|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1216|     70|	}
 1217|       |
 1218|  3.27k|	(void)fflush(stdout);
 1219|  3.27k|	(void)fflush(stderr);
 1220|       |
 1221|  13.0k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  138|  13.0k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1221:14): [True: 9.81k, False: 3.27k]
  ------------------
 1222|  9.81k|		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.27k|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1238:7): [True: 0, False: 3.27k]
  |  Branch (1238:19): [True: 0, False: 0]
  ------------------
 1239|  3.27k|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1239:6): [True: 0, False: 3.27k]
  ------------------
 1240|  3.27k|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1240:6): [True: 0, False: 3.27k]
  ------------------
 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.27k|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  461|  3.27k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1248|  3.27k|#ifdef HAVE_POSIX_SPAWNP
 1249|  3.27k|	posix_spawn_file_actions_init(&fa);
 1250|       |
 1251|  3.27k|	handledesc(&fa, fd, fdp);
 1252|       |
 1253|  3.27k|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1254|  3.27k|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1255|  3.27k|	    args, NULL);
 1256|       |
 1257|  3.27k|	posix_spawn_file_actions_destroy(&fa);
 1258|       |
 1259|  3.27k|	if (status != 0) {
  ------------------
  |  Branch (1259:6): [True: 8, False: 3.26k]
  ------------------
 1260|      8|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1261|      8|		    compr[method].argv[0], strerror(status));
 1262|      8|	}
 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.79k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  138|  9.79k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1289:14): [True: 6.53k, False: 3.26k]
  ------------------
 1290|  6.53k|		closefd(fdp[i], 1);
 1291|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1292|  3.26k|	if (fd == -1) {
  ------------------
  |  Branch (1292:6): [True: 0, False: 3.26k]
  ------------------
 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.26k|	rv = OKDATA;
  ------------------
  |  |  242|  3.26k|#define OKDATA 	0
  ------------------
 1305|  3.26k|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1306|  3.26k|	DPRINTF("read got %zd\n", r);
 1307|  3.26k|	if (r < 0) {
  ------------------
  |  Branch (1307:6): [True: 0, False: 3.26k]
  ------------------
 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.26k|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  460|  3.26k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1313:6): [True: 137, False: 3.12k]
  ------------------
 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|    137|		DPRINTF("Closing stdout for bytes_max\n");
 1320|    137|		closefd(fdp[STDOUT_FILENO], 0);
 1321|    137|		goto ok;
 1322|    137|	}
 1323|  3.12k|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1323:6): [True: 173, False: 2.95k]
  ------------------
 1324|    173|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1325|    173|		rv = ERRDATA;
  ------------------
  |  |  244|    173|#define ERRDATA	2
  ------------------
 1326|    173|		r = filter_error(*newch, r);
 1327|    173|		goto ok;
 1328|    173|	}
 1329|  2.95k|	if  (re == 0)
  ------------------
  |  Branch (1329:7): [True: 2.95k, False: 0]
  ------------------
 1330|  2.95k|		goto ok;
 1331|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1332|      0|	    strerror(errno));
 1333|      0|	goto err;
 1334|  3.26k|ok:
 1335|  3.26k|	*n = r;
 1336|       |	/* NUL terminate, as every buffer is handled here. */
 1337|  3.26k|	(*newch)[*n] = '\0';
 1338|  3.26k|err:
 1339|  3.26k|	closefd(fdp[STDIN_FILENO], 1);
 1340|  3.26k|	closefd(fdp[STDOUT_FILENO], 0);
 1341|  3.26k|	closefd(fdp[STDERR_FILENO], 0);
 1342|       |
 1343|  3.26k|	w = waitpid(pid, &status, 0);
 1344|  3.26k|wait_err:
 1345|  3.26k|	if (w == -1) {
  ------------------
  |  Branch (1345:6): [True: 0, False: 3.26k]
  ------------------
 1346|      0|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1347|      0|		DPRINTF("Child wait return %#x\n", status);
 1348|  3.26k|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1348:13): [True: 0, False: 3.26k]
  ------------------
 1349|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1350|  3.26k|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1350:13): [True: 310, False: 2.95k]
  ------------------
 1351|    310|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1352|    310|	}
 1353|  3.26k|	if (writepid > 0) {
  ------------------
  |  Branch (1353:6): [True: 0, False: 3.26k]
  ------------------
 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.26k|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1364|  3.26k|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1365|       |
 1366|  3.26k|	return rv;
 1367|  3.26k|}
compress.c:getdecompressor:
 1151|  3.34k|{
 1152|  3.34k|	switch (method) {
 1153|      0|#ifdef BUILTIN_DECOMPRESS
 1154|     31|	case METH_FROZEN:
  ------------------
  |  |  210|     31|#define METH_FROZEN	2
  ------------------
  |  Branch (1154:2): [True: 31, False: 3.31k]
  ------------------
 1155|     31|		return uncompressgzipped;
 1156|     26|	case METH_ZLIB:
  ------------------
  |  |  218|     26|#define METH_ZLIB	14
  ------------------
  |  Branch (1156:2): [True: 26, False: 3.31k]
  ------------------
 1157|     26|		return uncompresszlib;
 1158|      0|#endif
 1159|      0|#ifdef BUILTIN_BZLIB
 1160|      7|	case METH_BZIP:
  ------------------
  |  |  211|      7|#define METH_BZIP	7
  ------------------
  |  Branch (1160:2): [True: 7, False: 3.33k]
  ------------------
 1161|      7|		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.34k]
  ------------------
 1165|      3|	case METH_LZMA:
  ------------------
  |  |  217|      3|#define METH_LZMA	13
  ------------------
  |  Branch (1165:2): [True: 2, False: 3.34k]
  ------------------
 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.34k]
  ------------------
 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.34k]
  ------------------
 1182|      1|		return uncompresslz4;
 1183|      0|#endif
 1184|  3.27k|	default:
  ------------------
  |  Branch (1184:2): [True: 3.27k, False: 70]
  ------------------
 1185|       |		return NULL;
 1186|  3.34k|	}
 1187|  3.34k|}
compress.c:makeerror:
  964|     78|{
  965|     78|	char *msg;
  966|     78|	va_list ap;
  967|     78|	int rv;
  968|       |
  969|     78|	DPRINTF("Makeerror %s\n", fmt);
  970|     78|	free(*buf);
  971|     78|	va_start(ap, fmt);
  972|     78|	rv = vasprintf(&msg, fmt, ap);
  973|     78|	va_end(ap);
  974|     78|	if (rv < 0) {
  ------------------
  |  Branch (974:6): [True: 0, False: 78]
  ------------------
  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|     78|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  461|     78|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  981|     78|	*len = strlen(msg);
  982|     78|	return ERRDATA;
  ------------------
  |  |  244|     78|#define ERRDATA	2
  ------------------
  983|     78|}
compress.c:handledesc:
 1033|  3.27k|{
 1034|  3.27k|	if (fd != -1) {
  ------------------
  |  Branch (1034:6): [True: 3.27k, False: 0]
  ------------------
 1035|  3.27k|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  460|  3.27k|#define CAST(T, b)	((T)(b))
  ------------------
 1036|  3.27k|		movedesc(v, STDIN_FILENO, fd);
 1037|  3.27k|	} 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.27k|	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.27k|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
 1047|  3.27k|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (1047:6): [True: 3.27k, False: 0]
  ------------------
 1048|  3.27k|		closedesc(v, fdp[STDOUT_FILENO][0]);
 1049|       |
 1050|  3.27k|	file_clear_closexec(STDOUT_FILENO);
 1051|       |
 1052|  3.27k|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
 1053|  3.27k|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (1053:6): [True: 3.27k, False: 0]
  ------------------
 1054|  3.27k|		closedesc(v, fdp[STDERR_FILENO][0]);
 1055|       |
 1056|       |	file_clear_closexec(STDERR_FILENO);
 1057|  3.27k|}
compress.c:movedesc:
 1004|  9.81k|{
 1005|  9.81k|	if (fd == i)
  ------------------
  |  Branch (1005:6): [True: 0, False: 9.81k]
  ------------------
 1006|      0|		return; /* "no dup was necessary" */
 1007|  9.81k|#ifdef HAVE_POSIX_SPAWNP
 1008|  9.81k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  461|  9.81k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1009|  9.81k|	posix_spawn_file_actions_adddup2(fa, fd, i);
 1010|  9.81k|	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.81k|}
compress.c:closedesc:
 1022|  6.54k|{
 1023|  6.54k|#ifdef HAVE_POSIX_SPAWNP
 1024|  6.54k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  461|  6.54k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1025|  6.54k|	posix_spawn_file_actions_addclose(fa, fd);
 1026|       |#else
 1027|       |	close(v ? fd : fd);
 1028|       |#endif
 1029|  6.54k|}
compress.c:closefd:
  987|  19.7k|{
  988|  19.7k|	if (fd[i] == -1)
  ------------------
  |  Branch (988:6): [True: 6.66k, False: 13.0k]
  ------------------
  989|  6.66k|		return;
  990|  13.0k|	(void) close(fd[i]);
  991|  13.0k|	fd[i] = -1;
  992|  13.0k|}
compress.c:filter_error:
 1087|    173|{
 1088|    173|	char *p;
 1089|    173|	char *buf;
 1090|       |
 1091|    173|	ubuf[n] = '\0';
 1092|    173|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  461|    173|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1093|    173|	while (isspace(CAST(unsigned char, *buf)))
  ------------------
  |  Branch (1093:9): [True: 37, False: 173]
  ------------------
 1094|     37|		buf++;
 1095|    173|	DPRINTF("Filter error[[[%s]]]\n", buf);
 1096|    173|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  460|    173|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1096:6): [True: 8, False: 165]
  ------------------
 1097|      8|		*p = '\0';
 1098|    173|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  460|    173|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1098:6): [True: 0, False: 173]
  ------------------
 1099|      0|		*p = '\0';
 1100|    173|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  460|    173|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1100:6): [True: 13, False: 160]
  ------------------
 1101|     13|		++p;
 1102|     13|		while (isspace(CAST(unsigned char, *p)))
  ------------------
  |  Branch (1102:10): [True: 13, False: 13]
  ------------------
 1103|     13|			p++;
 1104|     13|		n = strlen(p);
 1105|     13|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  460|     13|#define CAST(T, b)	((T)(b))
  ------------------
 1106|     13|	}
 1107|    173|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
 1108|    173|	if (islower(*ubuf))
  ------------------
  |  Branch (1108:6): [True: 11, False: 162]
  ------------------
 1109|     11|		*ubuf = toupper(*ubuf);
  ------------------
  |  Branch (1109:11): [True: 0, False: 0]
  |  Branch (1109:11): [True: 0, False: 0]
  |  Branch (1109:11): [Folded, False: 11]
  ------------------
 1110|    173|	return n;
 1111|    173|}

der_offs:
  265|  27.1k|{
  266|  27.1k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  461|  27.1k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  27.1k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 27.1k, False: 0]
  ------------------
  268|       |
  269|  27.1k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  27.1k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  27.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 27.1k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  27.1k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  27.1k|	    offs, m->offset));
  275|       |
  276|  27.1k|	uint32_t tlen = getlength(b, &offs, len);
  277|  27.1k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  27.1k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  27.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 27.1k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  27.1k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  27.1k|	    offs, tlen));
  283|       |
  284|  27.1k|	offs += ms->offset + m->offset;
  285|  27.1k|	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.1k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 3.30k, False: 23.8k]
  ------------------
  293|  3.30k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 3.30k]
  ------------------
  294|      0|			return -1;
  295|  3.30k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  460|  3.30k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  3.30k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  3.30k|		    ms->c.li[m->cont_level - 1].off));
  298|  3.30k|	}
  299|  27.1k|	return CAST(int32_t, offs);
  ------------------
  |  |  460|  27.1k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  27.1k|}
der_cmp:
  304|   412k|{
  305|   412k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  461|   412k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   412k|	const char *s = m->value.s;
  307|   412k|	size_t offs = 0, len = ms->search.s_len;
  308|   412k|	uint32_t tag, tlen;
  309|   412k|	char buf[128];
  310|       |
  311|   412k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   412k|	tag = gettag(b, &offs, len);
  314|   412k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   412k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|   412k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 9.47k, False: 403k]
  ------------------
  315|  9.47k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  9.47k|		return -1;
  317|  9.47k|	}
  318|       |
  319|   403k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   403k|	    offs, m->offset));
  321|       |
  322|   403k|	tlen = getlength(b, &offs, len);
  323|   403k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   403k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|   403k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 135k, False: 267k]
  ------------------
  324|   135k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   135k|		return -1;
  326|   135k|	}
  327|       |
  328|   267k|	der_tag(buf, sizeof(buf), tag);
  329|   267k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   267k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 267k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   267k|	size_t slen = strlen(buf);
  333|       |
  334|   267k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 236k, False: 31.3k]
  ------------------
  335|   236k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   236k|		return 0;
  337|   236k|	}
  338|       |
  339|  31.3k|	s += slen;
  340|       |
  341|  32.7k|again:
  342|  32.7k|	switch (*s) {
  343|  26.5k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 26.5k, False: 6.14k]
  ------------------
  344|  26.5k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  26.5k|		return 1;
  346|  1.52k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.52k, False: 31.1k]
  ------------------
  347|  1.52k|		s++;
  348|  1.52k|		goto val;
  349|  4.62k|	default:
  ------------------
  |  Branch (349:2): [True: 4.62k, False: 28.0k]
  ------------------
  350|  4.62k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 4.62k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  4.62k|		slen = 0;
  356|  4.62k|		do
  357|  7.27k|			slen = slen * 10 + *s - '0';
  358|  4.62k|		while (isdigit(CAST(unsigned char, *++s)));
  ------------------
  |  Branch (358:10): [True: 2.65k, False: 4.62k]
  ------------------
  359|  4.62k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  4.62k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 4.62k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  4.62k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 3.25k, False: 1.36k]
  ------------------
  363|  3.25k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  3.25k|			return 0;
  365|  3.25k|		}
  366|  1.36k|		goto again;
  367|  32.7k|	}
  368|  1.52k|val:
  369|  1.52k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.52k|	    tlen));
  371|  1.52k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.52k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.52k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.52k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.52k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 1.17k, False: 346]
  |  Branch (374:29): [True: 948, False: 228]
  ------------------
  375|    948|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    948|		return 0;
  377|    948|	}
  378|    574|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    574|	DPRINTF(("%s: complete match\n", __func__));
  380|    574|	return 1;
  381|  1.52k|}
der.c:gettag:
  150|   439k|{
  151|   439k|	uint32_t tag;
  152|       |
  153|   439k|	if (c == NULL || *p >= l)
  ------------------
  |  Branch (153:6): [True: 0, False: 439k]
  |  Branch (153:19): [True: 2.93k, False: 436k]
  ------------------
  154|  2.93k|		return DER_BAD;
  ------------------
  |  |   62|  2.93k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  2.93k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   436k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   436k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 261k, False: 175k]
  ------------------
  159|   261k|		return tag;
  160|       |
  161|   175k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 1.10k, False: 174k]
  ------------------
  162|  1.10k|		return DER_BAD;
  ------------------
  |  |   62|  1.10k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  1.10k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  2.16G|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 2.16G, False: 171k]
  ------------------
  165|  2.16G|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  2.16G|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 3.48k, False: 2.16G]
  ------------------
  167|  3.48k|			return DER_BAD;
  ------------------
  |  |   62|  3.48k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  3.48k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  2.16G|	}
  169|   171k|	return tag;
  170|   174k|}
der.c:getlength:
  183|   430k|{
  184|   430k|	uint8_t digits, i;
  185|   430k|	size_t len;
  186|   430k|	int is_onebyte_result;
  187|       |
  188|   430k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 4.10k, False: 426k]
  ------------------
  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|   426k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   426k|	digits = c[(*p)++] & 0x7f;
  200|   426k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 119k, False: 306k]
  ------------------
  201|   119k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|   119k|		return DER_BAD;
  ------------------
  |  |   62|   119k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|   119k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|   119k|	}
  204|       |
  205|   306k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 259k, False: 47.3k]
  ------------------
  206|   259k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  47.3k|	len = 0;
  213|  3.12M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 3.07M, False: 47.3k]
  ------------------
  214|  3.07M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  47.3k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 9.90k, False: 37.3k]
  |  Branch (216:31): [True: 1.85k, False: 35.5k]
  ------------------
  217|  11.7k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  11.7k|		    __func__, *p, len, l));
  219|  11.7k|		return DER_BAD;
  ------------------
  |  |   62|  11.7k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  460|  11.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  11.7k|	}
  221|  35.5k|	return CAST(uint32_t, len);
  ------------------
  |  |  460|  35.5k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  47.3k|}
der.c:der_tag:
  226|   267k|{
  227|   267k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   267k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 180k, False: 87.5k]
  ------------------
  228|   180k|		strlcpy(buf, der__tag[tag], len);
  229|  87.5k|	else
  230|  87.5k|		snprintf(buf, len, "%#x", tag);
  231|   267k|	return buf;
  232|   267k|}
der.c:der_data:
  237|  1.52k|{
  238|  1.52k|	uint32_t i;
  239|  1.52k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  460|  1.52k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.52k|	switch (tag) {
  241|     70|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     70|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 70, False: 1.45k]
  ------------------
  242|    153|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    153|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 83, False: 1.43k]
  ------------------
  243|    153|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    153|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 0, False: 1.52k]
  ------------------
  244|    153|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  461|    153|#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.52k]
  ------------------
  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.36k|	default:
  ------------------
  |  Branch (251:2): [True: 1.36k, False: 153]
  ------------------
  252|  1.36k|		break;
  253|  1.52k|	}
  254|       |
  255|  7.08k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 5.71k, False: 1.36k]
  ------------------
  256|  5.71k|		uint32_t z = i << 1;
  257|  5.71k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 4.69k, False: 1.02k]
  ------------------
  258|  4.69k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  5.71k|	}
  260|  1.36k|	return len * 2;
  261|  1.52k|}

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.22k, False: 32.4k]
  ------------------
   99|  1.22k|		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: 7, False: 31.5k]
  ------------------
  118|      7|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  119|      7|		*code = "Unicode text, UTF-8 (with BOM)";
  120|      7|		*code_mime = "utf-8";
  121|  31.5k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (121:13): [True: 184, False: 31.3k]
  ------------------
  122|    184|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  123|    184|		*code = "Unicode text, UTF-8";
  124|    184|		*code_mime = "utf-8";
  125|  31.3k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (125:13): [True: 412, False: 30.9k]
  ------------------
  126|    412|		if (ucs_type == 1) {
  ------------------
  |  Branch (126:7): [True: 156, False: 256]
  ------------------
  127|    156|			*code = "Unicode text, UTF-32, little-endian";
  128|    156|			*code_mime = "utf-32le";
  129|    256|		} else {
  130|    256|			*code = "Unicode text, UTF-32, big-endian";
  131|    256|			*code_mime = "utf-32be";
  132|    256|		}
  133|    412|		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: 432, False: 30.5k]
  ------------------
  135|    432|		if (ucs_type == 1) {
  ------------------
  |  Branch (135:7): [True: 224, False: 208]
  ------------------
  136|    224|			*code = "Unicode text, UTF-16, little-endian";
  137|    224|			*code_mime = "utf-16le";
  138|    224|		} else {
  139|    208|			*code = "Unicode text, UTF-16, big-endian";
  140|    208|			*code_mime = "utf-16be";
  141|    208|		}
  142|    432|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  143|  30.5k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (143:13): [True: 1.01k, False: 29.5k]
  ------------------
  144|  1.01k|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  145|  1.01k|		*code = "ISO-8859";
  146|  1.01k|		*code_mime = "iso-8859-1";
  147|  29.5k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (147:13): [True: 516, False: 28.9k]
  ------------------
  148|    516|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  149|    516|		*code = "Non-ISO extended-ASCII";
  150|    516|		*code_mime = "unknown-8bit";
  151|  28.9k|	} else {
  152|  28.9k|		unsigned char *nbuf;
  153|       |
  154|  28.9k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  155|  28.9k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  460|  28.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (155:7): [True: 0, False: 28.9k]
  ------------------
  156|      0|			file_oomem(ms, mlen);
  157|      0|			goto done;
  158|      0|		}
  159|  28.9k|		from_ebcdic(buf, nbytes, nbuf);
  160|       |
  161|  28.9k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (161:7): [True: 111, False: 28.8k]
  ------------------
  162|    111|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  163|    111|			*code = "EBCDIC";
  164|    111|			*code_mime = "ebcdic";
  165|  28.8k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (165:14): [True: 114, False: 28.7k]
  ------------------
  166|    114|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  167|    114|			    *ulen));
  168|    114|			*code = "International EBCDIC";
  169|    114|			*code_mime = "ebcdic";
  170|  28.7k|		} else { /* Doesn't look like text at all */
  171|  28.7k|			DPRINTF(("binary\n"));
  172|  28.7k|			rv = 0;
  173|  28.7k|			*type = "binary";
  174|  28.7k|		}
  175|  28.9k|		free(nbuf);
  176|  28.9k|	}
  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.6k|{
  359|  31.6k|	size_t i;
  360|  31.6k|	int n;
  361|  31.6k|	file_unichar_t c;
  362|  31.6k|	int gotone = 0, ctrl = 0;
  363|       |
  364|  31.6k|	if (ubuf)
  ------------------
  |  Branch (364:6): [True: 31.6k, False: 0]
  ------------------
  365|  31.6k|		*ulen = 0;
  366|       |
  367|  27.2M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (367:14): [True: 27.2M, False: 2.01k]
  ------------------
  368|  27.2M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (368:7): [True: 27.1M, False: 71.5k]
  ------------------
  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.1M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  238|  27.1M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (374:8): [True: 23.0M, False: 4.11M]
  ------------------
  375|  23.0M|				ctrl = 1;
  376|       |
  377|  27.1M|			if (ubuf)
  ------------------
  |  Branch (377:8): [True: 27.1M, False: 0]
  ------------------
  378|  27.1M|				ubuf[(*ulen)++] = buf[i];
  379|  27.1M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (379:14): [True: 13.3k, False: 58.2k]
  ------------------
  380|  13.3k|			return -1;
  381|  58.2k|		} else {			   /* 11xxxxxx begins UTF-8 */
  382|  58.2k|			int following;
  383|  58.2k|			uint8_t x = first[buf[i]];
  384|  58.2k|			const struct accept_range *ar =
  385|  58.2k|			    &accept_ranges[(unsigned int)x >> 4];
  386|  58.2k|			if (x == XX)
  ------------------
  |  |  306|  58.2k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (386:8): [True: 6.75k, False: 51.4k]
  ------------------
  387|  6.75k|				return -1;
  388|       |
  389|  51.4k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (389:8): [True: 14.7k, False: 36.7k]
  ------------------
  390|  14.7k|				c = buf[i] & 0x1f;
  391|  14.7k|				following = 1;
  392|  36.7k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (392:15): [True: 30.9k, False: 5.81k]
  ------------------
  393|  30.9k|				c = buf[i] & 0x0f;
  394|  30.9k|				following = 2;
  395|  30.9k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (395:15): [True: 5.81k, False: 0]
  ------------------
  396|  5.81k|				c = buf[i] & 0x07;
  397|  5.81k|				following = 3;
  398|  5.81k|			} 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|   129k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (407:16): [True: 88.0k, False: 41.9k]
  ------------------
  408|  88.0k|				i++;
  409|  88.0k|				if (i >= nbytes)
  ------------------
  |  Branch (409:9): [True: 212, False: 87.8k]
  ------------------
  410|    212|					goto done;
  411|       |
  412|  87.8k|				if (n == 0 &&
  ------------------
  |  Branch (412:9): [True: 51.3k, False: 36.5k]
  ------------------
  413|  51.3k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (413:11): [True: 5.07k, False: 46.2k]
  |  Branch (413:30): [True: 3.83k, False: 42.3k]
  ------------------
  414|  8.91k|					return -1;
  415|       |
  416|  78.9k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (416:9): [True: 167, False: 78.7k]
  |  Branch (416:33): [True: 265, False: 78.5k]
  ------------------
  417|    432|					return -1;
  418|       |
  419|  78.5k|				c = (c << 6) + (buf[i] & 0x3f);
  420|  78.5k|			}
  421|       |
  422|  41.9k|			if (ubuf)
  ------------------
  |  Branch (422:8): [True: 41.9k, False: 0]
  ------------------
  423|  41.9k|				ubuf[(*ulen)++] = c;
  424|  41.9k|			gotone = 1;
  425|  41.9k|		}
  426|  27.2M|	}
  427|  2.22k|done:
  428|  2.22k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (428:9): [True: 1.91k, False: 312]
  |  Branch (428:21): [True: 184, False: 128]
  ------------------
  429|  31.6k|}
encoding.c:looks_ascii:
  271|  62.6k|    size_t *ulen) \
  272|  62.6k|{ \
  273|  62.6k|	size_t i; \
  274|  62.6k|\
  275|  62.6k|	*ulen = 0; \
  276|  62.6k|\
  277|  18.9M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 18.9M, False: 2.22k]
  ------------------
  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.6k|	return 1; \
  286|  62.6k|}
encoding.c:looks_latin1:
  271|  59.4k|    size_t *ulen) \
  272|  59.4k|{ \
  273|  59.4k|	size_t i; \
  274|  59.4k|\
  275|  59.4k|	*ulen = 0; \
  276|  59.4k|\
  277|  10.5M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 10.5M, False: 1.13k]
  ------------------
  278|  10.5M|		int t = text_chars[buf[i]]; \
  279|  10.5M|\
  280|  30.3M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 9.30M, False: 1.22M]
  |  Branch (280:7): [True: 58.2k, False: 9.24M]
  ------------------
  281|  10.5M|			return 0; \
  282|  10.5M|\
  283|  10.5M|		ubuf[(*ulen)++] = buf[i]; \
  284|  10.4M|	} \
  285|  59.4k|	return 1; \
  286|  59.4k|}
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.81M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (277:14): [True: 2.81M, False: 516]
  ------------------
  278|  2.81M|		int t = text_chars[buf[i]]; \
  279|  2.81M|\
  280|  12.2M|		if (COND) \
  ------------------
  |  Branch (280:7): [True: 2.05M, False: 759k]
  |  Branch (280:7): [True: 1.76M, False: 287k]
  |  Branch (280:7): [True: 28.9k, False: 1.73M]
  ------------------
  281|  2.81M|			return 0; \
  282|  2.81M|\
  283|  2.81M|		ubuf[(*ulen)++] = buf[i]; \
  284|  2.78M|	} \
  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.50k]
  |  Branch (440:20): [True: 119, False: 29.9k]
  |  Branch (440:38): [True: 102, False: 17]
  |  Branch (440:56): [True: 61, False: 41]
  ------------------
  441|     61|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  442|  31.5k|	else
  443|  31.5k|		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.25k, False: 858]
  |  Branch (450:20): [True: 45, False: 1.21k]
  |  Branch (450:37): [True: 36, False: 9]
  |  Branch (450:54): [True: 17, False: 19]
  ------------------
  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.09k|	else
  463|  2.09k|		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: 84, False: 30.8k]
  ------------------
  481|     84|		return 0;
  482|       |
  483|  30.8k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (483:6): [True: 2.20k, False: 28.6k]
  |  Branch (483:23): [True: 306, False: 1.90k]
  ------------------
  484|    306|		bigend = 0;
  485|  30.5k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (485:11): [True: 284, False: 30.2k]
  |  Branch (485:28): [True: 240, False: 44]
  ------------------
  486|    240|		bigend = 1;
  487|  30.3k|	else
  488|  30.3k|		return 0;
  489|       |
  490|    546|	*ulen = 0;
  491|    546|	hi = 0;
  492|       |
  493|   753k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (493:14): [True: 753k, False: 432]
  ------------------
  494|   753k|		uint32_t uc;
  495|       |
  496|   753k|		if (bigend)
  ------------------
  |  Branch (496:7): [True: 288k, False: 464k]
  ------------------
  497|   288k|			uc = CAST(uint32_t,
  ------------------
  |  |  460|   288k|#define CAST(T, b)	((T)(b))
  ------------------
  498|   753k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  499|   464k|		else
  500|   464k|			uc = CAST(uint32_t,
  ------------------
  |  |  460|   464k|#define CAST(T, b)	((T)(b))
  ------------------
  501|   753k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  502|       |
  503|   753k|		uc &= 0xffff;
  504|       |
  505|   753k|		switch (uc) {
  506|      8|		case 0xfffe:
  ------------------
  |  Branch (506:3): [True: 8, False: 753k]
  ------------------
  507|     22|		case 0xffff:
  ------------------
  |  Branch (507:3): [True: 14, False: 753k]
  ------------------
  508|     22|			return 0;
  509|   753k|		default:
  ------------------
  |  Branch (509:3): [True: 753k, False: 22]
  ------------------
  510|   753k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  466|   753k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (466:26): [True: 130k, False: 622k]
  |  |  |  Branch (466:43): [True: 17, False: 130k]
  |  |  ------------------
  ------------------
  511|     17|				return 0;
  512|   753k|			break;
  513|   753k|		}
  514|   753k|		if (hi) {
  ------------------
  |  Branch (514:7): [True: 17.7k, False: 735k]
  ------------------
  515|  17.7k|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  468|  17.7k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (468:26): [True: 17.7k, False: 20]
  |  |  |  Branch (468:43): [True: 17.7k, False: 13]
  |  |  ------------------
  ------------------
  516|     33|				return 0;
  517|  17.7k|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  518|  17.7k|			hi = 0;
  519|  17.7k|		}
  520|   753k|		if (NOTTEXT(uc))
  ------------------
  |  |  470|   753k|    ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  460|   375k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |                   ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  238|  1.12M|#define T 1   /* character appears in plain ASCII text */
  |  |  ------------------
  |  |  |  Branch (470:6): [True: 375k, False: 377k]
  |  |  |  Branch (470:19): [True: 351k, False: 23.4k]
  |  |  |  Branch (470:57): [True: 27, False: 351k]
  |  |  ------------------
  ------------------
  521|     27|			return 0;
  522|   753k|		ubf[(*ulen)++] = uc;
  523|   753k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  467|   753k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (467:26): [True: 197k, False: 555k]
  |  |  |  Branch (467:43): [True: 17.8k, False: 179k]
  |  |  ------------------
  ------------------
  524|  17.8k|			hi = uc - 0xd800 + 1;
  525|   753k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  468|   753k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (468:26): [True: 179k, False: 573k]
  |  |  |  Branch (468:43): [True: 15, False: 179k]
  |  |  ------------------
  ------------------
  526|     15|			return 0;
  527|   753k|	}
  528|       |
  529|    432|	return 1 + bigend;
  530|    546|}
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.40k, False: 29.9k]
  ------------------
  542|  1.40k|		return 0;
  543|       |
  544|  29.9k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (544:6): [True: 2.27k, False: 27.7k]
  |  Branch (544:23): [True: 434, False: 1.83k]
  |  Branch (544:40): [True: 239, False: 195]
  |  Branch (544:54): [True: 177, False: 62]
  ------------------
  545|    177|		bigend = 0;
  546|  29.7k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (546:11): [True: 1.49k, False: 28.2k]
  |  Branch (546:25): [True: 719, False: 777]
  |  Branch (546:39): [True: 307, False: 412]
  |  Branch (546:56): [True: 262, False: 45]
  ------------------
  547|    262|		bigend = 1;
  548|  29.5k|	else
  549|  29.5k|		return 0;
  550|       |
  551|    439|	*ulen = 0;
  552|       |
  553|   652k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (553:14): [True: 651k, False: 412]
  ------------------
  554|       |		/* XXX fix to properly handle chars > 65536 */
  555|       |
  556|   651k|		if (bigend)
  ------------------
  |  Branch (556:7): [True: 408k, False: 243k]
  ------------------
  557|   408k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  460|   408k|#define CAST(T, b)	((T)(b))
  ------------------
  558|   408k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  460|   408k|#define CAST(T, b)	((T)(b))
  ------------------
  559|   408k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  460|   408k|#define CAST(T, b)	((T)(b))
  ------------------
  560|   408k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  460|   408k|#define CAST(T, b)	((T)(b))
  ------------------
  561|   243k|		else
  562|   243k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  460|   243k|#define CAST(T, b)	((T)(b))
  ------------------
  563|   243k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  460|   243k|#define CAST(T, b)	((T)(b))
  ------------------
  564|   243k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  460|   243k|#define CAST(T, b)	((T)(b))
  ------------------
  565|   243k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  460|   243k|#define CAST(T, b)	((T)(b))
  ------------------
  566|       |
  567|   651k|		uc = ubf[*ulen - 1];
  568|   651k|		if (uc == 0xfffe || NOTTEXT(uc))
  ------------------
  |  |  470|   651k|    ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  460|  63.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |                   ((C) < 128 && text_chars[CAST(size_t, (C))] != T && (C) != '\0')
  |  |  ------------------
  |  |  |  |  238|   715k|#define T 1   /* character appears in plain ASCII text */
  |  |  ------------------
  |  |  |  Branch (470:6): [True: 63.8k, False: 588k]
  |  |  |  Branch (470:19): [True: 63.7k, False: 49]
  |  |  |  Branch (470:57): [True: 18, False: 63.7k]
  |  |  ------------------
  ------------------
  |  Branch (568:7): [True: 9, False: 651k]
  ------------------
  569|     27|			return 0;
  570|   651k|	}
  571|       |
  572|    412|	return 1 + bigend;
  573|    439|}
encoding.c:from_ebcdic:
  660|  28.9k|{
  661|  28.9k|	size_t i;
  662|       |
  663|   110M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (663:14): [True: 110M, False: 28.9k]
  ------------------
  664|   110M|		out[i] = ebcdic_to_ascii[buf[i]];
  665|   110M|	}
  666|  28.9k|}

file_fsmagic:
  178|  12.0k|{
  179|  12.0k|	int ret, didv = 0, *did;
  180|  12.0k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  181|  12.0k|	int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION);
  ------------------
  |  |   45|  12.0k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	int silent = ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION);
  ------------------
  |  |   46|  12.0k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  182|  12.0k|#if defined(S_IFLNK) && defined(HAVE_READLINK)
  183|  12.0k|	char buf[BUFSIZ+4];
  184|  12.0k|	ssize_t nch;
  185|  12.0k|	struct stat tstatbuf;
  186|  12.0k|#endif
  187|  12.0k|	did = &didv;
  188|       |
  189|  12.0k|	if (fn == NULL)
  ------------------
  |  Branch (189:6): [True: 12.0k, False: 0]
  ------------------
  190|  12.0k|		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|     96|{
   58|     96|	union {
   59|     96|		unsigned short x;
   60|     96|		unsigned char s[sizeof(unsigned short)];
   61|     96|	} u;
   62|       |
   63|     96|	u.x = 1;
   64|     96|	return u.s[0] != 1;
   65|     96|}
file_copystr:
   69|  1.24k|{
   70|  1.24k|	if (blen == 0)
  ------------------
  |  Branch (70:6): [True: 0, False: 1.24k]
  ------------------
   71|      0|		return buf;
   72|  1.24k|	if (width >= blen)
  ------------------
  |  Branch (72:6): [True: 1, False: 1.24k]
  ------------------
   73|      1|		width = blen - 1;
   74|  1.24k|	memcpy(buf, str, width);
   75|  1.24k|	buf[width] = '\0';
   76|  1.24k|	return buf;
   77|  1.24k|}
file_checkfmt:
  111|   424k|{
  112|   424k|	const char *p;
  113|  3.08M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (113:16): [True: 2.65M, False: 424k]
  ------------------
  114|  2.65M|		if (*p != '%')
  ------------------
  |  Branch (114:7): [True: 2.47M, False: 183k]
  ------------------
  115|  2.47M|			continue;
  116|   183k|		if (*++p == '%')
  ------------------
  |  Branch (116:7): [True: 0, False: 183k]
  ------------------
  117|      0|			continue;
  118|   183k|		if (*p == '\0') {
  ------------------
  |  Branch (118:7): [True: 0, False: 183k]
  ------------------
  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|   200k|		while (*p != '\0' && strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (124:10): [True: 200k, False: 0]
  |  Branch (124:24): [True: 16.2k, False: 183k]
  ------------------
  125|  16.2k|			p++;
  126|   183k|		if (*p == '*') {
  ------------------
  |  Branch (126:7): [True: 0, False: 183k]
  ------------------
  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|   183k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (132:7): [True: 0, False: 183k]
  ------------------
  133|      0|			return -1;
  134|       |
  135|   183k|		if (*p == '.') {
  ------------------
  |  Branch (135:7): [True: 5.90k, False: 177k]
  ------------------
  136|  5.90k|			p++;
  137|  5.90k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (137:8): [True: 0, False: 5.90k]
  ------------------
  138|      0|				return -1;
  139|  5.90k|		}
  140|       |
  141|   183k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (141:7): [True: 0, False: 183k]
  ------------------
  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|   183k|	}
  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.55k, False: 424k]
  ------------------
  161|  2.55k|		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: 180, False: 423k]
  |  Branch (170:39): [True: 0, False: 423k]
  ------------------
  171|    180|		size_t blen = ms->o.blen;
  172|    180|		free(buf);
  173|    180|		file_clearbuf(ms);
  174|    180|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  175|    180|		    SIZE_T_FORMAT "u", len, blen);
  176|    180|		return -1;
  177|    180|	}
  178|       |
  179|   423k|	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|   423k|	ms->o.buf = buf;
  188|   423k|	ms->o.blen = len;
  189|   423k|	return 0;
  190|      0|out:
  191|      0|	file_clearbuf(ms);
  192|       |	file_error(ms, errno, "vasprintf failed");
  193|      0|	return -1;
  194|   423k|}
file_printf:
  198|   408k|{
  199|   408k|	int rv;
  200|   408k|	va_list ap;
  201|       |
  202|   408k|	va_start(ap, fmt);
  203|   408k|	rv = file_vprintf(ms, fmt, ap);
  204|       |	va_end(ap);
  205|   408k|	return rv;
  206|   408k|}
file_error:
  236|    394|{
  237|    394|	va_list va;
  238|    394|	va_start(va, f);
  239|    394|	file_error_core(ms, error, f, va, 0);
  240|       |	va_end(va);
  241|    394|}
file_magerror:
  249|     58|{
  250|     58|	va_list va;
  251|     58|	va_start(va, f);
  252|     58|	file_error_core(ms, 0, f, va, ms->line);
  253|       |	va_end(va);
  254|     58|}
file_badseek:
  265|      3|{
  266|       |	file_error(ms, errno, "error seeking");
  267|      3|}
file_badread:
  271|    105|{
  272|       |	file_error(ms, errno, "error reading");
  273|    105|}
file_separator:
  280|  55.0k|{
  281|  55.0k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  276|  55.0k|#define FILE_SEPARATOR "\n- "
  ------------------
  282|  55.0k|}
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: 23, False: 18.3k]
  ------------------
  361|     23|		def = "empty";
  362|     23|		goto simple;
  363|  18.3k|	} else if (nb == 1) {
  ------------------
  |  Branch (363:13): [True: 10, False: 18.3k]
  ------------------
  364|     10|		def = "very short file (no magic)";
  365|     10|		goto simple;
  366|     10|	}
  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.94k, False: 15.3k]
  ------------------
  395|  2.94k|			goto done_encoding;
  396|  2.94k|		}
  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: 32, False: 15.3k]
  ------------------
  416|     32|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 32]
  ------------------
  417|      0|				goto done;
  418|     32|		}
  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: 37, False: 15.3k]
  ------------------
  438|     37|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (438:8): [True: 0, False: 37]
  ------------------
  439|      0|				goto done;
  440|     37|		}
  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.07k, False: 14.3k]
  ------------------
  449|  1.07k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (449:8): [True: 0, False: 1.07k]
  ------------------
  450|      0|				goto done;
  451|  1.07k|		}
  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.5k, False: 1.79k]
  |  Branch (454:57): [True: 7.89k, False: 5.69k]
  ------------------
  455|  7.89k|		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.89k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (466:7): [True: 0, False: 7.89k]
  ------------------
  467|      0|			return -1;
  468|       |
  469|  7.89k|		rv = file_tryelf(ms, &b);
  470|  7.89k|		rbuf = file_pop_buffer(ms, pb);
  471|  7.89k|		if (rv == -1) {
  ------------------
  |  Branch (471:7): [True: 147, False: 7.75k]
  ------------------
  472|    147|			free(rbuf);
  473|    147|			rbuf = NULL;
  474|    147|		}
  475|  7.89k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  7.89k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (475:7): [True: 0, False: 7.89k]
  ------------------
  476|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  477|  7.89k|	}
  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.41k]
  |  Branch (485:17): [True: 4.47k, False: 7.49k]
  ------------------
  486|  4.47k|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (486:8): [True: 40, False: 4.43k]
  ------------------
  487|     40|				goto done;
  488|  4.47k|		}
  489|  15.3k|		if (m) {
  ------------------
  |  Branch (489:7): [True: 12.1k, False: 3.22k]
  ------------------
  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.51k, False: 12.8k]
  ------------------
  502|  2.51k|			goto done;
  503|  2.51k|		}
  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.4k| done:
  516|  15.4k|	trim_separator(ms);
  517|  15.4k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  15.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (517:6): [True: 0, False: 15.4k]
  ------------------
  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.4k|#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: 40, False: 18.3k]
  ------------------
  530|     40|		return rv;
  531|       |
  532|  18.3k|	return m;
  533|  18.3k|}
file_reset:
  538|  12.0k|{
  539|  12.0k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (539:6): [True: 12.0k, False: 2]
  |  Branch (539:21): [True: 0, False: 12.0k]
  ------------------
  540|      0|		file_error(ms, 0, "no magic files loaded");
  541|      0|		return -1;
  542|      0|	}
  543|  12.0k|	file_clearbuf(ms);
  544|  12.0k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (544:6): [True: 11.6k, False: 451]
  ------------------
  545|  11.6k|		free(ms->o.pbuf);
  546|  11.6k|		ms->o.pbuf = NULL;
  547|  11.6k|	}
  548|  12.0k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  495|  12.0k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  549|  12.0k|	ms->error = -1;
  550|  12.0k|	return 0;
  551|  12.0k|}
file_getbuffer:
  563|  11.9k|{
  564|  11.9k|	char *pbuf, *op, *np;
  565|  11.9k|	size_t psize, len;
  566|       |
  567|  11.9k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  495|  11.9k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (567:6): [True: 319, False: 11.6k]
  ------------------
  568|    319|		return NULL;
  569|       |
  570|  11.6k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  11.6k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (570:6): [True: 0, False: 11.6k]
  ------------------
  571|      0|		return ms->o.buf;
  572|       |
  573|  11.6k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (573:6): [True: 0, False: 11.6k]
  ------------------
  574|      0|		return NULL;
  575|       |
  576|       |	/* * 4 is for octal representation, + 1 is for NUL */
  577|  11.6k|	len = strlen(ms->o.buf);
  578|  11.6k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (578:6): [True: 0, False: 11.6k]
  ------------------
  579|      0|		file_oomem(ms, len);
  580|      0|		return NULL;
  581|      0|	}
  582|  11.6k|	psize = len * 4 + 1;
  583|  11.6k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  460|  11.6k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (583:6): [True: 0, False: 11.6k]
  ------------------
  584|      0|		file_oomem(ms, psize);
  585|      0|		return NULL;
  586|      0|	}
  587|  11.6k|	ms->o.pbuf = pbuf;
  588|       |
  589|  11.6k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  590|  11.6k|	{
  591|  11.6k|		mbstate_t state;
  592|  11.6k|		wchar_t nextchar;
  593|  11.6k|		int mb_conv = 1;
  594|  11.6k|		size_t bytesconsumed;
  595|  11.6k|		char *eop;
  596|  11.6k|		(void)memset(&state, 0, sizeof(mbstate_t));
  597|       |
  598|  11.6k|		np = ms->o.pbuf;
  599|  11.6k|		op = ms->o.buf;
  600|  11.6k|		eop = op + len;
  601|       |
  602|  2.74M|		while (op < eop) {
  ------------------
  |  Branch (602:10): [True: 2.73M, False: 11.5k]
  ------------------
  603|  2.73M|			bytesconsumed = mbrtowc(&nextchar, op,
  604|  2.73M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  460|  2.73M|#define CAST(T, b)	((T)(b))
  ------------------
  605|  2.73M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  460|  5.47M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (605:8): [True: 63, False: 2.73M]
  ------------------
  606|  2.73M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  460|  2.73M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (606:8): [True: 0, False: 2.73M]
  ------------------
  607|     63|				mb_conv = 0;
  608|     63|				break;
  609|     63|			}
  610|       |
  611|  2.73M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (611:8): [True: 2.69M, False: 43.3k]
  ------------------
  612|  2.69M|				(void)memcpy(np, op, bytesconsumed);
  613|  2.69M|				op += bytesconsumed;
  614|  2.69M|				np += bytesconsumed;
  615|  2.69M|			} else {
  616|  86.6k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (616:12): [True: 43.3k, False: 43.3k]
  ------------------
  617|  43.3k|					OCTALIFY(np, op);
  ------------------
  |  |  555|  43.3k|	(void)(*(n)++ = '\\', \
  |  |  556|  43.3k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  460|  43.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  557|  43.3k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  460|  43.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  558|  43.3k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  460|  43.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  559|  43.3k|	(o)++)
  ------------------
  618|  43.3k|			}
  619|  2.73M|		}
  620|  11.6k|		*np = '\0';
  621|       |
  622|       |		/* Parsing succeeded as a multi-byte sequence */
  623|  11.6k|		if (mb_conv != 0)
  ------------------
  |  Branch (623:7): [True: 11.5k, False: 63]
  ------------------
  624|  11.5k|			return ms->o.pbuf;
  625|  11.6k|	}
  626|     63|#endif
  627|       |
  628|  19.6k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (628:40): [True: 19.5k, False: 63]
  ------------------
  629|  19.5k|		if (isprint(CAST(unsigned char, *op))) {
  ------------------
  |  Branch (629:7): [True: 18.4k, False: 1.09k]
  ------------------
  630|  18.4k|			*np++ = *op++;
  631|  18.4k|		} else {
  632|  1.09k|			OCTALIFY(np, op);
  ------------------
  |  |  555|  1.09k|	(void)(*(n)++ = '\\', \
  |  |  556|  1.09k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  460|  1.09k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  557|  1.09k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  460|  1.09k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  558|  1.09k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  460|  1.09k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  559|  1.09k|	(o)++)
  ------------------
  633|  1.09k|		}
  634|  19.5k|	}
  635|     63|	*np = '\0';
  636|     63|	return ms->o.pbuf;
  637|  11.6k|}
file_check_mem:
  641|   956k|{
  642|   956k|	size_t len;
  643|       |
  644|   956k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (644:6): [True: 1, False: 956k]
  ------------------
  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|   956k|	ms->c.li[level].got_match = 0;
  655|   956k|#ifdef ENABLE_CONDITIONALS
  656|   956k|	ms->c.li[level].last_match = 0;
  657|   956k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  368|   956k|#define				COND_NONE	0
  ------------------
  658|   956k|#endif /* ENABLE_CONDITIONALS */
  659|   956k|	return 0;
  660|   956k|}
file_printedlen:
  664|  2.51k|{
  665|  2.51k|	return ms->o.blen;
  666|  2.51k|}
file_replace:
  670|  1.65k|{
  671|  1.65k|	file_regex_t rx;
  672|  1.65k|	int nm;
  673|  1.65k|	regmatch_t rm;
  674|       |
  675|  1.65k|	nm = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  676|  1.65k|	if (nm != 0)
  ------------------
  |  Branch (676:6): [True: 0, False: 1.65k]
  ------------------
  677|      0|		return -1;
  678|       |
  679|  1.76k|	while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (679:9): [True: 107, False: 1.65k]
  ------------------
  680|    107|		ms->o.buf[rm.rm_so] = '\0';
  681|    107|		if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (681:7): [True: 0, False: 107]
  ------------------
  682|    107|		    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (682:7): [True: 107, False: 0]
  ------------------
  683|      0|			goto out;
  684|    107|		nm++;
  685|    107|	}
  686|  1.65k|out:
  687|  1.65k|	file_regfree(&rx);
  688|  1.65k|	return nm;
  689|  1.65k|}
file_regcomp:
  748|  42.5k|{
  749|  42.5k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (749:6): [True: 0, False: 42.5k]
  ------------------
  750|      0|		return -1;
  751|       |
  752|  42.5k|#ifdef USE_C_LOCALE
  753|  42.5k|	locale_t old = uselocale(ms->c_lc_ctype);
  754|  42.5k|	assert(old != NULL);
  ------------------
  |  Branch (754:2): [True: 0, False: 42.5k]
  |  Branch (754:2): [True: 42.5k, 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|  42.5k|	int rc;
  761|  42.5k|	rc = regcomp(rx, pat, flags);
  762|       |
  763|  42.5k|#ifdef USE_C_LOCALE
  764|  42.5k|	uselocale(old);
  765|       |#else
  766|       |	(void)setlocale(LC_CTYPE, old);
  767|       |#endif
  768|  42.5k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (768:6): [True: 0, False: 42.5k]
  |  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|  42.5k|	return rc;
  777|  42.5k|}
file_regexec:
  783|   538k|{
  784|   538k|#ifdef USE_C_LOCALE
  785|   538k|	locale_t old = uselocale(ms->c_lc_ctype);
  786|   538k|	assert(old != NULL);
  ------------------
  |  Branch (786:2): [True: 0, False: 538k]
  |  Branch (786:2): [True: 538k, 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|   538k|	int rc;
  793|       |	/* XXX: force initialization because glibc does not always do this */
  794|   538k|	if (nmatch != 0)
  ------------------
  |  Branch (794:6): [True: 498k, False: 40.7k]
  ------------------
  795|   498k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  796|   538k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  797|   538k|#ifdef USE_C_LOCALE
  798|   538k|	uselocale(old);
  799|       |#else
  800|       |	(void)setlocale(LC_CTYPE, old);
  801|       |#endif
  802|   538k|	return rc;
  803|   538k|}
file_regfree:
  807|  42.3k|{
  808|  42.3k|	regfree(rx);
  809|  42.3k|}
file_push_buffer:
  813|  29.4k|{
  814|  29.4k|	file_pushbuf_t *pb;
  815|       |
  816|  29.4k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  495|  29.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (816:6): [True: 127, False: 29.3k]
  ------------------
  817|    127|		return NULL;
  818|       |
  819|  29.3k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  460|  29.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (819:6): [True: 0, False: 29.3k]
  ------------------
  820|      0|		return NULL;
  821|       |
  822|  29.3k|	pb->buf = ms->o.buf;
  823|  29.3k|	pb->blen = ms->o.blen;
  824|  29.3k|	pb->offset = ms->offset;
  825|       |
  826|  29.3k|	ms->o.buf = NULL;
  827|  29.3k|	ms->o.blen = 0;
  828|  29.3k|	ms->offset = 0;
  829|       |
  830|  29.3k|	return pb;
  831|  29.3k|}
file_pop_buffer:
  835|  29.3k|{
  836|  29.3k|	char *rbuf;
  837|       |
  838|  29.3k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  495|  29.3k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (838:6): [True: 2.01k, False: 27.3k]
  ------------------
  839|  2.01k|		free(pb->buf);
  840|  2.01k|		free(pb);
  841|  2.01k|		return NULL;
  842|  2.01k|	}
  843|       |
  844|  27.3k|	rbuf = ms->o.buf;
  845|       |
  846|  27.3k|	ms->o.buf = pb->buf;
  847|  27.3k|	ms->o.blen = pb->blen;
  848|  27.3k|	ms->offset = pb->offset;
  849|       |
  850|  27.3k|	free(pb);
  851|  27.3k|	return rbuf;
  852|  29.3k|}
file_printable:
  860|  48.2k|{
  861|  48.2k|	char *ptr, *eptr = buf + bufsiz - 1;
  862|  48.2k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  461|  48.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  863|  48.2k|	const unsigned char *es = s + slen;
  864|       |
  865|   402k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (865:19): [True: 402k, False: 74]
  |  Branch (865:33): [True: 401k, False: 524]
  |  Branch (865:43): [True: 354k, False: 47.5k]
  ------------------
  866|   354k|		if ((ms->flags & MAGIC_RAW) != 0 || isprint(*s)) {
  ------------------
  |  |   41|   354k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (866:7): [True: 0, False: 354k]
  |  Branch (866:39): [True: 138k, False: 215k]
  ------------------
  867|   138k|			*ptr++ = *s;
  868|   138k|			continue;
  869|   138k|		}
  870|   215k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (870:7): [True: 71, False: 215k]
  ------------------
  871|     71|			break;
  872|   215k|		*ptr++ = '\\';
  873|   215k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  460|   215k|#define CAST(T, b)	((T)(b))
  ------------------
  874|   215k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  460|   215k|#define CAST(T, b)	((T)(b))
  ------------------
  875|   215k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  460|   215k|#define CAST(T, b)	((T)(b))
  ------------------
  876|   215k|	}
  877|  48.2k|	*ptr = '\0';
  878|  48.2k|	return buf;
  879|  48.2k|}
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.54k|{
 1000|       |#ifdef __MINGW32__
 1001|       |	return 0;
 1002|       |#elif defined(HAVE_PIPE2)
 1003|  6.54k|	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.54k|}
file_clear_closexec:
 1024|  9.81k|file_clear_closexec(int fd) {
 1025|  9.81k|#ifdef F_SETFD
 1026|  9.81k|	return fcntl(fd, F_SETFD, 0);
 1027|       |#else
 1028|       |	return 0;
 1029|       |#endif
 1030|  9.81k|}
file_strtrim:
 1034|    399|{
 1035|    399|	char *last;
 1036|       |
 1037|    399|	while (isspace(CAST(unsigned char, *str)))
  ------------------
  |  Branch (1037:9): [True: 322, False: 399]
  ------------------
 1038|    322|		str++;
 1039|    399|	last = str;
 1040|  2.92k|	while (*last)
  ------------------
  |  Branch (1040:9): [True: 2.53k, False: 399]
  ------------------
 1041|  2.53k|		last++;
 1042|    399|	if (last == str)
  ------------------
  |  Branch (1042:6): [True: 93, False: 306]
  ------------------
 1043|     93|		return str;
 1044|    306|	--last;
 1045|    306|	while (isspace(CAST(unsigned char, *last)))
  ------------------
  |  Branch (1045:9): [True: 299, False: 306]
  ------------------
 1046|    299|		last--;
 1047|    306|	*++last = '\0';
 1048|    306|	return str;
 1049|    399|}
funcs.c:file_checkfield:
   89|   189k|{
   90|   189k|	const char *p = *pp;
   91|   189k|	int fw = 0;
   92|       |
   93|   204k|	while (*p && isdigit((unsigned char)*p)) {
  ------------------
  |  Branch (93:9): [True: 204k, False: 0]
  |  Branch (93:15): [True: 14.7k, False: 189k]
  ------------------
   94|  14.7k|		fw = fw * 10 + (*p++ - '0');
   95|  14.7k|		if (fw > 1024)
  ------------------
  |  Branch (95:7): [True: 0, False: 14.7k]
  ------------------
   96|      0|			break;
   97|  14.7k|	}
   98|       |
   99|   189k|	*pp = p;
  100|       |
  101|   189k|	if (fw < 1024)
  ------------------
  |  Branch (101:6): [True: 189k, False: 0]
  ------------------
  102|   189k|		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|   189k|}
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|    452|{
  217|       |	/* Only the first error is ok */
  218|    452|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  495|    452|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (218:6): [True: 3, False: 449]
  ------------------
  219|      3|		return;
  220|    449|	if (lineno != 0) {
  ------------------
  |  Branch (220:6): [True: 55, False: 394]
  ------------------
  221|     55|		file_clearbuf(ms);
  222|     55|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  223|     55|	}
  224|    449|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (224:6): [True: 203, False: 246]
  |  Branch (224:19): [True: 203, False: 0]
  ------------------
  225|    203|		(void)file_printf(ms, " ");
  226|    449|	(void)file_vprintf(ms, f, va);
  227|    449|	if (error > 0)
  ------------------
  |  Branch (227:6): [True: 145, False: 304]
  ------------------
  228|    145|		(void)file_printf(ms, " (%s)", strerror(error));
  229|    449|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  495|    449|#define 		EVENT_HAD_ERR		0x01
  ------------------
  230|    449|	ms->error = error;
  231|    449|}
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.4k|{
  287|  15.4k|	size_t l;
  288|       |
  289|  15.4k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (289:6): [True: 0, False: 15.4k]
  ------------------
  290|      0|		return;
  291|       |
  292|  15.4k|	l = strlen(ms->o.buf);
  293|  15.4k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  276|  15.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (293:6): [True: 0, False: 15.4k]
  ------------------
  294|      0|		return;
  295|       |
  296|  15.4k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  276|  15.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  297|  15.4k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  276|  15.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (297:6): [True: 15.4k, False: 0]
  ------------------
  298|  15.4k|		return;
  299|       |
  300|      0|	ms->o.buf[l] = '\0';
  301|      0|}
funcs.c:check_regex:
  693|  42.5k|{
  694|  42.5k|	char sbuf[512];
  695|  42.5k|	unsigned char oc = '\0';
  696|  42.5k|	const char *p;
  697|  42.5k|	unsigned long l;
  698|  42.5k|	static const char wild[] = "?*+{";
  699|       |
  700|   514k|	for (p = pat; *p; p++) {
  ------------------
  |  Branch (700:16): [True: 471k, False: 42.5k]
  ------------------
  701|   471k|		unsigned char c = *p;
  702|       |		// Avoid repetition of wild characters
  703|   471k|		if (strchr(wild, oc) != NULL && strchr(wild, c) != NULL) {
  ------------------
  |  Branch (703:7): [True: 83.5k, False: 388k]
  |  Branch (703:35): [True: 0, False: 83.5k]
  ------------------
  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|   471k|		if (c == '{') {
  ------------------
  |  Branch (711:7): [True: 96, False: 471k]
  ------------------
  712|     96|			char *ep, *eep;
  713|       |
  714|     96|			if (oc == '}') {
  ------------------
  |  Branch (714:8): [True: 0, False: 96]
  ------------------
  715|      0|				file_magwarn(ms, "cascading repetition "
  716|      0|				    "operators in regex `%s'", pat);
  717|      0|				return -1;
  718|      0|			}
  719|     96|			errno = 0;
  720|     96|			l = strtoul(p + 1, &ep, 10);
  721|     96|			if (ep != p + 1 && l > 1000)
  ------------------
  |  Branch (721:8): [True: 72, False: 24]
  |  Branch (721:23): [True: 0, False: 72]
  ------------------
  722|      0|				goto bounds;
  723|     96|			if (*ep == ',') {
  ------------------
  |  Branch (723:8): [True: 29, False: 67]
  ------------------
  724|     29|				l = strtoul(ep + 1, &eep, 10);
  725|     29|				if (eep != ep + 1 && l > 1000)
  ------------------
  |  Branch (725:9): [True: 29, False: 0]
  |  Branch (725:26): [True: 0, False: 29]
  ------------------
  726|      0|					goto bounds;
  727|     29|			}
  728|     96|		}
  729|   471k|		oc = c;
  730|   471k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (730:7): [True: 471k, False: 185]
  |  Branch (730:21): [True: 181, 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|   471k|			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|   471k|	}
  739|  42.5k|	return 0;
  740|      0|bounds:
  741|      0|	file_magwarn(ms, "bounds too large %ld in regex `%s'", l, pat);
  742|      0|	return -1;
  743|  42.5k|}
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.0k, False: 2.29k]
  ------------------
  143|  13.0k|		return 0;
  144|       |
  145|  2.29k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  2.29k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  2.29k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (145:6): [True: 0, False: 2.29k]
  ------------------
  146|      0|		return 0;
  147|       |
  148|  2.29k|	if (!csv_parse(uc, ue))
  ------------------
  |  Branch (148:6): [True: 2.28k, False: 10]
  ------------------
  149|  2.28k|		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.29k|{
   95|  2.29k|	size_t nf = 0, tf = 0, nl = 0;
   96|       |
   97|   388M|	while (uc < ue) {
  ------------------
  |  Branch (97:9): [True: 388M, False: 2.09k]
  ------------------
   98|   388M|		switch (*uc++) {
   99|  2.05M|		case '"':
  ------------------
  |  Branch (99:3): [True: 2.05M, False: 386M]
  ------------------
  100|       |			// Eat until the matching quote
  101|  2.05M|			uc = eatquote(uc, ue);
  102|  2.05M|			break;
  103|  2.38M|		case ',':
  ------------------
  |  Branch (103:3): [True: 2.38M, False: 385M]
  ------------------
  104|  2.38M|			nf++;
  105|  2.38M|			break;
  106|    488|		case '\n':
  ------------------
  |  Branch (106:3): [True: 488, False: 388M]
  ------------------
  107|    488|			DPRINTF("nl=%zu nf=%zu tf=%zu\n", nl, nf, tf);
  108|    488|			nl++;
  109|    488|#if CSV_LINES
  110|    488|			if (nl == CSV_LINES)
  ------------------
  |  |   62|    488|#define CSV_LINES 10
  ------------------
  |  Branch (110:8): [True: 22, False: 466]
  ------------------
  111|     22|				return tf > 1 && tf == nf;
  ------------------
  |  Branch (111:12): [True: 19, False: 3]
  |  Branch (111:22): [True: 2, False: 17]
  ------------------
  112|    466|#endif
  113|    466|			if (tf == 0) {
  ------------------
  |  Branch (113:8): [True: 222, False: 244]
  ------------------
  114|       |				// First time and no fields, give up
  115|    222|				if (nf == 0) 
  ------------------
  |  Branch (115:9): [True: 139, False: 83]
  ------------------
  116|    139|					return 0;
  117|       |				// First time, set the number of fields
  118|     83|				tf = nf;
  119|    244|			} else if (tf != nf) {
  ------------------
  |  Branch (119:15): [True: 34, False: 210]
  ------------------
  120|       |				// Field number mismatch, we are done.
  121|     34|				return 0;
  122|     34|			}
  123|    293|			nf = 0;
  124|    293|			break;
  125|   383M|		default:
  ------------------
  |  Branch (125:3): [True: 383M, False: 4.44M]
  ------------------
  126|   383M|			break;
  127|   388M|		}
  128|   388M|	}
  129|  2.09k|	DPRINTF("tf=%zu>1 nl=%zu>=2\n", tf, nl);
  130|  2.09k|	return tf >= 1 && nl >= 2;
  ------------------
  |  Branch (130:9): [True: 27, False: 2.07k]
  |  Branch (130:20): [True: 8, False: 19]
  ------------------
  131|  2.29k|}
is_csv.c:eatquote:
   69|  2.05M|{
   70|  2.05M|	int quote = 0;
   71|       |
   72|  16.4M|	while (uc < ue) {
  ------------------
  |  Branch (72:9): [True: 16.4M, False: 207]
  ------------------
   73|  16.4M|		unsigned char c = *uc++;
   74|  16.4M|		if (c != '"') {
  ------------------
  |  Branch (74:7): [True: 14.3M, False: 2.14M]
  ------------------
   75|       |			// We already got one, done.
   76|  14.3M|			if (quote) {
  ------------------
  |  Branch (76:8): [True: 2.05M, False: 12.2M]
  ------------------
   77|  2.05M|				return --uc;
   78|  2.05M|			}
   79|  12.2M|			continue;
   80|  14.3M|		}
   81|  2.14M|		if (quote) {
  ------------------
  |  Branch (81:7): [True: 45.3k, False: 2.09M]
  ------------------
   82|       |			// quote-quote escapes
   83|  45.3k|			quote = 0;
   84|  45.3k|			continue;
   85|  45.3k|		}
   86|       |		// first quote
   87|  2.09M|		quote = 1;
   88|  2.09M|	}
   89|    207|	return ue;
   90|  2.05M|}

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: 32]
  ------------------
  437|  15.3k|		return 0;
  438|       |
  439|     32|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     32|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 32]
  ------------------
  440|      0|		return 1;
  441|     32|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 32]
  ------------------
  442|      0|		if (file_printf(ms, "application/%s",
  ------------------
  |  Branch (442:7): [True: 0, False: 0]
  ------------------
  443|      0|		    jt == 1 ? "json" : "x-ndjson") == -1)
  ------------------
  |  Branch (443:7): [True: 0, False: 0]
  ------------------
  444|      0|			return -1;
  445|      0|		return 1;
  446|      0|	}
  447|     32|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 32]
  ------------------
  448|     32|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 17, 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|     32|	return 1;
  462|     32|}
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: 117, False: 23.8k]
  ------------------
  355|    117|		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|    558|	case '"':
  ------------------
  |  Branch (370:2): [True: 558, False: 23.3k]
  ------------------
  371|    558|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    558|		t = JSON_STRING;
  ------------------
  |  |   60|    558|#define JSON_STRING	4
  ------------------
  373|    558|		break;
  374|  4.19k|	case '[':
  ------------------
  |  Branch (374:2): [True: 4.19k, False: 19.6k]
  ------------------
  375|  4.19k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  4.19k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  4.19k|#define JSON_ARRAY	0
  ------------------
  377|  4.19k|		break;
  378|    753|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 753, False: 23.1k]
  ------------------
  379|    753|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    753|		t = JSON_OBJECT;
  ------------------
  |  |   59|    753|#define JSON_OBJECT	3
  ------------------
  381|    753|		break;
  382|    357|	case 't':
  ------------------
  |  Branch (382:2): [True: 357, False: 23.5k]
  ------------------
  383|    357|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    357|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    357|#define JSON_CONSTANT	1
  ------------------
  385|    357|		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|  17.2k|	default:
  ------------------
  |  Branch (395:2): [True: 17.2k, False: 6.60k]
  ------------------
  396|  17.2k|		--uc;
  397|  17.2k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  17.2k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  17.2k|#define JSON_NUMBER	2
  ------------------
  399|  17.2k|		break;
  400|  23.8k|	}
  401|  23.8k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 5.50k, False: 18.3k]
  ------------------
  402|  5.50k|		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.62k]
  ------------------
  408|  15.3k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 14.9k, False: 408]
  ------------------
  409|  14.9k|			return 0;
  410|    408|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 112, False: 296]
  ------------------
  411|    112|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|    112|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|    104|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 8, False: 104]
  |  Branch (411:31): [True: 9, False: 95]
  ------------------
  412|    296|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 57, False: 239]
  |  Branch (412:22): [True: 48, False: 9]
  ------------------
  413|     48|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     48|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     36|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 12, False: 36]
  |  Branch (413:31): [True: 3, False: 33]
  ------------------
  414|    248|		else
  415|    248|			return 0;
  416|    296|	}
  417|  8.62k|	return rv;
  418|  24.0k|}
is_json.c:json_skip_space:
  119|  57.8k|{
  120|  32.6M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 32.6M, False: 3.70k]
  |  Branch (120:20): [True: 32.5M, False: 54.1k]
  ------------------
  121|  32.5M|		uc++;
  122|  57.8k|	return uc;
  123|  57.8k|}
is_json.c:json_isspace:
   79|  32.6M|{
   80|  32.6M|	switch (uc) {
   81|  7.55M|	case ' ':
  ------------------
  |  Branch (81:2): [True: 7.55M, False: 25.0M]
  ------------------
   82|  23.4M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 15.9M, False: 16.7M]
  ------------------
   83|  32.5M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 9.10M, False: 23.5M]
  ------------------
   84|  32.5M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 147, False: 32.6M]
  ------------------
   85|  32.5M|		return 1;
   86|  54.1k|	default:
  ------------------
  |  Branch (86:2): [True: 54.1k, False: 32.5M]
  ------------------
   87|  54.1k|		return 0;
   88|  32.6M|	}
   89|  32.6M|}
is_json.c:json_parse_string:
  129|  1.34k|{
  130|  1.34k|	const unsigned char *uc = *ucp;
  131|  1.34k|	size_t i;
  132|       |
  133|  1.34k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  1.34k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.34k]
  |  |  ------------------
  ------------------
  134|  9.10M|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 9.10M, False: 114]
  ------------------
  135|  9.10M|		switch (*uc++) {
  136|      6|		case '\0':
  ------------------
  |  Branch (136:3): [True: 6, False: 9.10M]
  ------------------
  137|      6|			goto out;
  138|  8.69M|		case '\\':
  ------------------
  |  Branch (138:3): [True: 8.69M, False: 407k]
  ------------------
  139|  8.69M|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 16, False: 8.69M]
  ------------------
  140|     16|				goto out;
  141|  8.69M|			switch (*uc++) {
  142|      0|			case '\0':
  ------------------
  |  Branch (142:4): [True: 0, False: 8.69M]
  ------------------
  143|      0|				goto out;
  144|  3.78M|			case '"':
  ------------------
  |  Branch (144:4): [True: 3.78M, False: 4.91M]
  ------------------
  145|  8.69M|			case '\\':
  ------------------
  |  Branch (145:4): [True: 4.91M, False: 3.78M]
  ------------------
  146|  8.69M|			case '/':
  ------------------
  |  Branch (146:4): [True: 206, False: 8.69M]
  ------------------
  147|  8.69M|			case 'b':
  ------------------
  |  Branch (147:4): [True: 340, False: 8.69M]
  ------------------
  148|  8.69M|			case 'f':
  ------------------
  |  Branch (148:4): [True: 194, False: 8.69M]
  ------------------
  149|  8.69M|			case 'n':
  ------------------
  |  Branch (149:4): [True: 284, False: 8.69M]
  ------------------
  150|  8.69M|			case 'r':
  ------------------
  |  Branch (150:4): [True: 200, False: 8.69M]
  ------------------
  151|  8.69M|			case 't':
  ------------------
  |  Branch (151:4): [True: 196, False: 8.69M]
  ------------------
  152|  8.69M|				continue;
  153|    429|			case 'u':
  ------------------
  |  Branch (153:4): [True: 429, False: 8.69M]
  ------------------
  154|    429|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 5, False: 424]
  ------------------
  155|      5|					uc = ue;
  156|      5|					goto out;
  157|      5|				}
  158|  2.04k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 1.64k, False: 396]
  ------------------
  159|  1.64k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 28, False: 1.62k]
  ------------------
  160|     28|						goto out;
  161|    396|				continue;
  162|    396|			default:
  ------------------
  |  Branch (162:4): [True: 12, False: 8.69M]
  ------------------
  163|     12|				goto out;
  164|  8.69M|			}
  165|  1.16k|		case '"':
  ------------------
  |  Branch (165:3): [True: 1.16k, False: 9.10M]
  ------------------
  166|  1.16k|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|  1.16k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  167|  1.16k|			*ucp = uc;
  168|  1.16k|			return 1;
  169|   405k|		default:
  ------------------
  |  Branch (169:3): [True: 405k, False: 8.69M]
  ------------------
  170|   405k|			continue;
  171|  9.10M|		}
  172|  9.10M|	}
  173|    181|out:
  174|    181|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    181|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 181]
  |  |  ------------------
  ------------------
  175|    181|	*ucp = uc;
  176|    181|	return 0;
  177|  1.34k|}
is_json.c:json_isxdigit:
  105|  1.64k|{
  106|  1.64k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 219, False: 1.42k]
  ------------------
  107|    219|		return 1;
  108|  1.42k|	switch (uc) {
  109|    963|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 455, False: 974]
  |  Branch (109:12): [True: 174, False: 1.25k]
  |  Branch (109:22): [True: 171, False: 1.25k]
  |  Branch (109:32): [True: 43, False: 1.38k]
  |  Branch (109:42): [True: 30, False: 1.39k]
  |  Branch (109:52): [True: 90, False: 1.33k]
  ------------------
  110|  1.40k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 193, False: 1.23k]
  |  Branch (110:12): [True: 2, False: 1.42k]
  |  Branch (110:22): [True: 7, False: 1.42k]
  |  Branch (110:32): [True: 197, False: 1.23k]
  |  Branch (110:42): [True: 12, False: 1.41k]
  |  Branch (110:52): [True: 27, False: 1.40k]
  ------------------
  111|  1.40k|		return 1;
  112|     28|	default:
  ------------------
  |  Branch (112:2): [True: 28, False: 1.40k]
  ------------------
  113|     28|		return 0;
  114|  1.42k|	}
  115|  1.42k|}
is_json.c:json_isdigit:
   93|  65.0M|{
   94|  65.0M|	switch (uc) {
   95|  62.3M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 60.5M, False: 4.47M]
  |  Branch (95:12): [True: 1.74M, False: 63.2M]
  |  Branch (95:22): [True: 618, False: 65.0M]
  |  Branch (95:32): [True: 64.9k, False: 64.9M]
  |  Branch (95:42): [True: 125, False: 65.0M]
  ------------------
   96|  64.9M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 1.13M, False: 63.8M]
  |  Branch (96:12): [True: 1.45M, False: 63.5M]
  |  Branch (96:22): [True: 32.3k, False: 64.9M]
  |  Branch (96:32): [True: 156, False: 65.0M]
  |  Branch (96:42): [True: 207, False: 65.0M]
  ------------------
   97|  64.9M|		return 1;
   98|  37.0k|	default:
  ------------------
  |  Branch (98:2): [True: 37.0k, False: 64.9M]
  ------------------
   99|  37.0k|		return 0;
  100|  65.0M|	}
  101|  65.0M|}
is_json.c:json_parse_array:
  182|  4.19k|{
  183|  4.19k|	const unsigned char *uc = *ucp;
  184|       |
  185|  4.19k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  4.19k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 4.19k]
  |  |  ------------------
  ------------------
  186|  8.11k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 8.06k, False: 47]
  ------------------
  187|  8.06k|		uc = json_skip_space(uc, ue);
  188|  8.06k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 16, False: 8.05k]
  ------------------
  189|     16|			goto out;
  190|  8.05k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 237, False: 7.81k]
  ------------------
  191|    237|			goto done;
  192|  7.81k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 3.31k, False: 4.50k]
  ------------------
  193|  3.31k|			goto out;
  194|  4.50k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 63, False: 4.43k]
  ------------------
  195|     63|			goto out;
  196|  4.43k|		switch (*uc) {
  197|  3.91k|		case ',':
  ------------------
  |  Branch (197:3): [True: 3.91k, False: 522]
  ------------------
  198|  3.91k|			uc++;
  199|  3.91k|			continue;
  200|    510|		case ']':
  ------------------
  |  Branch (200:3): [True: 510, False: 3.92k]
  ------------------
  201|    747|		done:
  202|    747|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    747|#define JSON_ARRAYN	5
  ------------------
  203|    747|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    747|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 747]
  |  |  ------------------
  ------------------
  204|    747|			*ucp = uc + 1;
  205|    747|			return 1;
  206|     12|		default:
  ------------------
  |  Branch (206:3): [True: 12, False: 4.42k]
  ------------------
  207|     12|			goto out;
  208|  4.43k|		}
  209|  4.43k|	}
  210|  3.45k|out:
  211|  3.45k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  3.45k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 3.45k]
  |  |  ------------------
  ------------------
  212|  3.45k|	*ucp = uc;
  213|  3.45k|	return 0;
  214|  4.19k|}
is_json.c:json_parse_object:
  219|    753|{
  220|    753|	const unsigned char *uc = *ucp;
  221|    753|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    753|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 753]
  |  |  ------------------
  ------------------
  222|  1.10k|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 1.09k, False: 11]
  ------------------
  223|  1.09k|		uc = json_skip_space(uc, ue);
  224|  1.09k|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 12, False: 1.07k]
  ------------------
  225|     12|			goto out;
  226|  1.07k|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 255, False: 823]
  ------------------
  227|    255|			uc++;
  228|    255|			goto done;
  229|    255|		}
  230|    823|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 33, False: 790]
  ------------------
  231|     33|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     33|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 33]
  |  |  ------------------
  ------------------
  232|     33|			goto out;
  233|     33|		}
  234|    790|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    790|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 790]
  |  |  ------------------
  ------------------
  235|    790|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 7, False: 783]
  ------------------
  236|      7|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      7|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 7]
  |  |  ------------------
  ------------------
  237|      7|			goto out;
  238|      7|		}
  239|    783|		uc = json_skip_space(uc, ue);
  240|    783|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 11, False: 772]
  ------------------
  241|     11|			goto out;
  242|    772|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 20, False: 752]
  ------------------
  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|    752|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 202, False: 550]
  ------------------
  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|    550|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 2, False: 548]
  ------------------
  251|      2|			goto out;
  252|    548|		switch (*uc++) {
  253|    348|		case ',':
  ------------------
  |  Branch (253:3): [True: 348, False: 200]
  ------------------
  254|    348|			continue;
  255|    199|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 199, False: 349]
  ------------------
  256|    454|		done:
  257|    454|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    454|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 454]
  |  |  ------------------
  ------------------
  258|    454|			*ucp = uc;
  259|    454|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 547]
  ------------------
  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|    548|		}
  265|    548|	}
  266|    299|out:
  267|    299|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    299|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 299]
  |  |  ------------------
  ------------------
  268|    299|	*ucp = uc;
  269|    299|	return 0;
  270|    753|}
is_json.c:json_parse_const:
  328|  1.09k|{
  329|  1.09k|	const unsigned char *uc = *ucp;
  330|       |
  331|  1.09k|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|  1.09k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 1.09k]
  |  |  ------------------
  ------------------
  332|  1.09k|	*ucp += --len - 1;
  333|  1.09k|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 66, False: 1.03k]
  ------------------
  334|     66|		*ucp = ue;
  335|  4.44k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 4.38k, False: 60]
  |  Branch (335:20): [True: 3.41k, False: 971]
  ------------------
  336|  3.41k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 68, False: 3.34k]
  ------------------
  337|     68|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     68|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 68]
  |  |  ------------------
  ------------------
  338|     68|			return 0;
  339|     68|		}
  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.09k|}
is_json.c:json_parse_number:
  276|  17.2k|{
  277|  17.2k|	const unsigned char *uc = *ucp;
  278|  17.2k|	int got = 0;
  279|       |
  280|  17.2k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  17.2k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 17.2k]
  |  |  ------------------
  ------------------
  281|  17.2k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 17.2k]
  ------------------
  282|      0|		return 0;
  283|  17.2k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 296, False: 16.9k]
  ------------------
  284|    296|		uc++;
  285|       |
  286|  60.7M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 60.6M, False: 65]
  ------------------
  287|  60.6M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 17.2k, False: 60.6M]
  ------------------
  288|  17.2k|			break;
  289|  60.6M|		got = 1;
  290|  60.6M|	}
  291|  17.2k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 65, False: 17.2k]
  ------------------
  292|     65|		goto out;
  293|  17.2k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 258, False: 16.9k]
  ------------------
  294|    258|		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: 17.1k, False: 2.27M]
  ------------------
  297|  17.1k|			break;
  298|  2.27M|		got = 1;
  299|  2.27M|	}
  300|  17.2k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 23, False: 17.1k]
  ------------------
  301|     23|		goto out;
  302|  17.1k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 2.87k, False: 14.3k]
  |  Branch (302:14): [True: 831, False: 2.04k]
  |  Branch (302:28): [True: 455, False: 1.58k]
  ------------------
  303|  1.28k|		uc++;
  304|  1.28k|		got = 0;
  305|  1.28k|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 12, False: 1.27k]
  ------------------
  306|     12|			goto out;
  307|  1.27k|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 321, False: 953]
  |  Branch (307:21): [True: 342, False: 611]
  ------------------
  308|    663|			uc++;
  309|  2.02M|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 2.02M, False: 30]
  ------------------
  310|  2.02M|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 1.24k, False: 2.02M]
  ------------------
  311|  1.24k|				break;
  312|  2.02M|			got = 1;
  313|  2.02M|		}
  314|  1.27k|	}
  315|  17.2k|out:
  316|  17.2k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 14.3k, False: 2.89k]
  ------------------
  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.89k|	else
  319|  2.89k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  2.89k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded, False: 2.89k]
  |  |  ------------------
  ------------------
  320|  17.2k|	*ucp = uc;
  321|  17.2k|	return got;
  322|  17.1k|}

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: 37]
  ------------------
  167|  15.3k|		return 0;
  168|       |
  169|     37|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     37|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (169:6): [True: 0, False: 37]
  ------------------
  170|      0|		return 1;
  171|       |
  172|     37|	if (mime) {
  ------------------
  |  Branch (172:6): [True: 0, False: 37]
  ------------------
  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|     37|	if (file_printf(ms, "SIMH tape data") == -1)
  ------------------
  |  Branch (178:6): [True: 0, False: 37]
  ------------------
  179|      0|		return -1;
  180|       |
  181|     37|	return 1;
  182|     37|}
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|   547k|	while (ue - uc >= CAST(ptrdiff_t, sizeof(nbytes))) {
  ------------------
  |  |  460|   547k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (122:9): [True: 546k, False: 873]
  ------------------
  123|   546k|		nbytes = getlen(&uc, &err);
  124|   546k|		if (err)
  ------------------
  |  Branch (124:7): [True: 11.3k, False: 534k]
  ------------------
  125|  11.3k|			return 0;
  126|   534k|		if ((nt > 0 || nr > 0) && nbytes == 0xFFFFFFFF)
  ------------------
  |  Branch (126:8): [True: 5.06k, False: 529k]
  |  Branch (126:18): [True: 526k, False: 3.24k]
  |  Branch (126:29): [True: 3, False: 531k]
  ------------------
  127|       |			/* EOM after at least one record or tapemark */
  128|      3|			break;
  129|   534k|		if (nbytes == 0) {
  ------------------
  |  Branch (129:7): [True: 1.54k, False: 533k]
  ------------------
  130|  1.54k|			nt++;	/* count tapemarks */
  131|  1.54k|#if SIMH_TAPEMARKS
  132|  1.54k|			if (nt == SIMH_TAPEMARKS)
  ------------------
  |  |   65|  1.54k|#define SIMH_TAPEMARKS 10
  ------------------
  |  Branch (132:8): [True: 140, False: 1.40k]
  ------------------
  133|    140|				break;
  134|  1.40k|#endif
  135|  1.40k|			continue;
  136|  1.54k|		}
  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.83k, False: 530k]
  ------------------
  140|  2.83k|			break;
  141|   530k|		cbytes = getlen(&uc, &err);
  142|   530k|		if (err)
  ------------------
  |  Branch (142:7): [True: 76, False: 530k]
  ------------------
  143|     76|			return 0;
  144|   530k|		if (nbytes != cbytes)
  ------------------
  |  Branch (144:7): [True: 162, False: 530k]
  ------------------
  145|    162|			return 0;
  146|   530k|		nr++;
  147|   530k|	}
  148|  3.84k|	if (nt * sizeof(uint32_t) == CAST(size_t, uc - orig_uc))
  ------------------
  |  |  460|  3.84k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (148:6): [True: 1.00k, False: 2.84k]
  ------------------
  149|  1.00k|		return 0;	/* All examined data was tapemarks (0) */
  150|  2.84k|	if (nr == 0)		/* No records */
  ------------------
  |  Branch (150:6): [True: 2.80k, False: 37]
  ------------------
  151|  2.80k|		return 0;
  152|     37|	return 1;
  153|  2.84k|}
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: 32, False: 1.07M]
  ------------------
  103|     32|		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.9k]
  ------------------
  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.1k, False: 3.25k]
  ------------------
  111|  12.1k|		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.25k|	nulp = CAST(const char *,
  ------------------
  |  |  460|  3.25k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  3.25k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  3.25k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 2.87k, False: 380]
  |  Branch (118:22): [True: 1.66k, False: 1.20k]
  ------------------
  119|  1.66k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 22, False: 1.64k]
  ------------------
  120|  1.66k|	    sizeof(gpkg_match)) == 0)
  121|     22|	    return 0;
  122|       |
  123|  3.22k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  3.22k|	sum = 0;
  126|  3.22k|	p = header->charptr;
  127|  3.22k|	ep = header->charptr + sizeof(*header);
  128|  1.65M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.65M, False: 3.22k]
  ------------------
  129|  1.65M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  29.0k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 25.8k, False: 3.22k]
  ------------------
  133|  25.8k|		sum -= header->header.chksum[i];
  134|  3.22k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  3.22k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 3.20k, False: 25]
  ------------------
  137|  3.20k|		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.22k|{
  159|  3.22k|	int	value;
  160|       |
  161|  3.91k|	while (digs > 0 && isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  ------------------
  |  Branch (161:9): [True: 3.83k, False: 74]
  |  Branch (161:21): [True: 682, False: 3.15k]
  ------------------
  162|    682|		where++;
  163|    682|		digs--;
  164|    682|	}
  165|  3.22k|	if (digs == 0)
  ------------------
  |  Branch (165:6): [True: 74, False: 3.15k]
  ------------------
  166|     74|		return -1;		/* All blank field */
  167|  3.15k|	value = 0;
  168|  3.69k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  3.66k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 1.06k, False: 2.60k]
  |  |  |  Branch (51:39): [True: 545, False: 515]
  |  |  ------------------
  ------------------
  |  Branch (168:9): [True: 3.66k, False: 38]
  ------------------
  169|    545|		value = (value << 3) | (*where++ - '0');
  170|    545|		digs--;
  171|    545|	}
  172|       |
  173|  3.15k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (173:6): [True: 3.11k, False: 38]
  |  Branch (173:18): [True: 1.30k, False: 1.81k]
  |  Branch (173:28): [True: 1.29k, False: 5]
  ------------------
  174|  1.29k|		return -1;			/* Ended on non-(space/NUL) */
  175|       |
  176|  1.85k|	return value;
  177|  3.15k|}

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|  12.0k|{
  406|  12.0k|	if (ms == NULL)
  ------------------
  |  Branch (406:6): [True: 0, False: 12.0k]
  ------------------
  407|      0|		return NULL;
  408|  12.0k|	return file_or_fd(ms, NULL, fd);
  409|  12.0k|}
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|  12.0k|{
  425|  12.0k|	int	rv = -1;
  426|  12.0k|	unsigned char *buf;
  427|  12.0k|	struct stat	sb;
  428|  12.0k|	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
  429|  12.0k|	int	ispipe = 0;
  430|  12.0k|	int	okstat = 0;
  431|  12.0k|	off_t	pos = CAST(off_t, -1);
  ------------------
  |  |  460|  12.0k|#define CAST(T, b)	((T)(b))
  ------------------
  432|       |
  433|  12.0k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (433:6): [True: 0, False: 12.0k]
  ------------------
  434|      0|		goto out;
  435|       |
  436|       |	/*
  437|       |	 * one extra for terminating '\0', and
  438|       |	 * some overlapping space for matches near EOF
  439|       |	 */
  440|  12.0k|#define SLOP (1 + sizeof(union VALUETYPE))
  441|  12.0k|	if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
  ------------------
  |  |  460|  12.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (441:6): [True: 0, False: 12.0k]
  ------------------
  442|      0|		return NULL;
  443|       |
  444|  12.0k|	switch (file_fsmagic(ms, inname, &sb)) {
  445|      0|	case -1:		/* error */
  ------------------
  |  Branch (445:2): [True: 0, False: 12.0k]
  ------------------
  446|      0|		goto done;
  447|  12.0k|	case 0:			/* nothing found */
  ------------------
  |  Branch (447:2): [True: 12.0k, False: 0]
  ------------------
  448|  12.0k|		break;
  449|      0|	default:		/* matched it and printed type */
  ------------------
  |  Branch (449:2): [True: 0, False: 12.0k]
  ------------------
  450|      0|		rv = 0;
  451|      0|		goto done;
  452|  12.0k|	}
  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|  12.0k|	if (inname != NULL) {
  ------------------
  |  Branch (459:6): [True: 0, False: 12.0k]
  ------------------
  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|  12.0k|	if (fd != -1) {
  ------------------
  |  Branch (487:6): [True: 12.0k, False: 0]
  ------------------
  488|  12.0k|		okstat = fstat(fd, &sb) == 0;
  489|  12.0k|		if (okstat && S_ISFIFO(sb.st_mode))
  ------------------
  |  Branch (489:7): [True: 12.0k, False: 0]
  |  Branch (489:17): [True: 0, False: 12.0k]
  ------------------
  490|      0|			ispipe = 1;
  491|  12.0k|		if (inname == NULL)
  ------------------
  |  Branch (491:7): [True: 12.0k, False: 0]
  ------------------
  492|  12.0k|			pos = lseek(fd, CAST(off_t, 0), SEEK_CUR);
  ------------------
  |  |  460|  12.0k|#define CAST(T, b)	((T)(b))
  ------------------
  493|  12.0k|	}
  494|       |
  495|       |	/*
  496|       |	 * try looking at the first ms->bytes_max bytes
  497|       |	 */
  498|  12.0k|	if (ispipe) {
  ------------------
  |  Branch (498:6): [True: 0, False: 12.0k]
  ------------------
  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|  12.0k|	} else if (fd != -1) {
  ------------------
  |  Branch (517:13): [True: 12.0k, False: 0]
  ------------------
  518|       |		/* Windows refuses to read from a big console buffer. */
  519|  12.0k|		size_t howmany =
  520|       |#ifdef WIN32
  521|       |		    _isatty(fd) ? 8 * 1024 :
  522|       |#endif
  523|  12.0k|		    ms->bytes_max;
  524|  12.0k|		if ((nbytes = read(fd, RCAST(void *, buf), howmany)) == -1) {
  ------------------
  |  |  461|  12.0k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (524:7): [True: 0, False: 12.0k]
  ------------------
  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|  12.0k|	}
  533|       |
  534|  12.0k|	(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
  ------------------
  |  |  440|  12.0k|#define SLOP (1 + sizeof(union VALUETYPE))
  ------------------
  535|  12.0k|	if (file_buffer(ms, fd, okstat ? &sb : NULL, inname, buf,
  ------------------
  |  Branch (535:6): [True: 130, False: 11.9k]
  |  Branch (535:26): [True: 12.0k, False: 0]
  ------------------
  536|  12.0k|	    CAST(size_t, nbytes)) == -1)
  ------------------
  |  |  460|  12.0k|#define CAST(T, b)	((T)(b))
  ------------------
  537|    130|		goto done;
  538|  11.9k|	rv = 0;
  539|  12.0k|done:
  540|  12.0k|	free(buf);
  541|  12.0k|	if (fd != -1) {
  ------------------
  |  Branch (541:6): [True: 12.0k, False: 0]
  ------------------
  542|  12.0k|		if (pos != CAST(off_t, -1))
  ------------------
  |  |  460|  12.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (542:7): [True: 12.0k, False: 0]
  ------------------
  543|  12.0k|			(void)lseek(fd, pos, SEEK_SET);
  544|  12.0k|		close_and_restore(ms, inname, fd, okstat ? &sb : NULL);
  ------------------
  |  Branch (544:37): [True: 12.0k, False: 0]
  ------------------
  545|  12.0k|	}
  546|  12.0k|out:
  547|  12.0k|	return rv == 0 ? file_getbuffer(ms) : NULL;
  ------------------
  |  Branch (547:9): [True: 11.9k, False: 130]
  ------------------
  548|  12.0k|}
magic.c:close_and_restore:
  367|  12.0k|{
  368|  12.0k|	if (fd == STDIN_FILENO || name == NULL)
  ------------------
  |  Branch (368:6): [True: 0, False: 12.0k]
  |  Branch (368:28): [True: 12.0k, False: 0]
  ------------------
  369|  12.0k|		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|  56.7k|{
  237|  56.7k|	const char	*f1p, *f2p;
  238|  56.7k|	EFT		f1t, f2t;
  239|       |
  240|  56.7k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 56.7k]
  ------------------
  241|       |
  242|  56.7k|	f1p = f1;
  243|  56.7k|	f1t = FMTCHECK_START;
  244|  56.7k|	f2p = f2;
  245|  56.7k|	f2t = FMTCHECK_START;
  246|   113k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 56.7k, False: 56.7k]
  ------------------
  247|  56.7k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 56.7k]
  ------------------
  248|      0|			return f2;
  249|  56.7k|		f2t = get_next_format(&f2p, f2t);
  250|  56.7k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 56.7k]
  ------------------
  251|      0|			return f2;
  252|  56.7k|	}
  253|  56.7k|	return f1;
  254|  56.7k|}
fmtcheck.c:get_next_format:
  190|   170k|{
  191|   170k|	int		infmt;
  192|   170k|	const char	*f;
  193|       |
  194|   170k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 170k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|   170k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 170k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|   170k|	f = *pf;
  203|   170k|	infmt = 0;
  204|   283k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 170k, False: 113k]
  ------------------
  205|   170k|		f = strchr(f, '%');
  206|   170k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 56.7k, False: 113k]
  ------------------
  207|  56.7k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  56.7k|#define RETURN(pf,f,r) do { \
  |  |   61|  56.7k|			*(pf) = (f); \
  |  |   62|  56.7k|			return r; \
  |  |   63|  56.7k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  208|   113k|		f++;
  209|   113k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 113k]
  ------------------
  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|   113k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 113k, False: 0]
  ------------------
  212|   113k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|   113k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|   121k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 121k, False: 0]
  |  Branch (218:15): [True: 8.38k, False: 113k]
  ------------------
  219|  8.38k|		f++;
  220|       |
  221|   113k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 113k]
  ------------------
  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|   113k|	while (isdigit((unsigned char)*f)) f++;
  ------------------
  |  Branch (225:9): [True: 6.82k, False: 113k]
  ------------------
  226|   113k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 113k]
  ------------------
  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|   113k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|   113k|#define RETURN(pf,f,r) do { \
  |  |   61|   113k|			*(pf) = (f); \
  |  |   62|   113k|			return r; \
  |  |   63|   113k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|   113k|}
fmtcheck.c:get_next_format_from_width:
  171|   113k|{
  172|   113k|	const char	*f;
  173|       |
  174|   113k|	f = *pf;
  175|   113k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 7.25k, False: 106k]
  ------------------
  176|  7.25k|		f++;
  177|  7.25k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 7.25k]
  ------------------
  178|      0|			RETURN(pf,f,FMTCHECK_PRECISION);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  179|      0|		}
  180|       |		/* eat any precision (empty is allowed) */
  181|  7.72k|		while (isdigit((unsigned char)*f)) f++;
  ------------------
  |  Branch (181:10): [True: 7.72k, False: 7.25k]
  ------------------
  182|  7.25k|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (182:7): [True: 0, False: 7.25k]
  ------------------
  183|  7.25k|	}
  184|   113k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|   113k|#define RETURN(pf,f,r) do { \
  |  |   61|   113k|			*(pf) = (f); \
  |  |   62|   113k|			return r; \
  |  |   63|   113k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|   113k|}
fmtcheck.c:get_next_format_from_precision:
   67|   113k|{
   68|   113k|	int		sh, lg, quad, longdouble;
   69|   113k|	const char	*f;
   70|       |
   71|   113k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|   113k|	f = *pf;
   74|   113k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 113k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|  1.91k|	case 'l':
  ------------------
  |  Branch (79:2): [True: 1.91k, False: 111k]
  ------------------
   80|  1.91k|		f++;
   81|  1.91k|		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.91k]
  ------------------
   82|  1.91k|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 1.91k, False: 0]
  ------------------
   83|  1.91k|			f++;
   84|  1.91k|			quad = 1;
   85|  1.91k|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|  1.91k|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 113k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 113k]
  ------------------
   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|   111k|	default:
  ------------------
  |  Branch (114:2): [True: 111k, False: 1.91k]
  ------------------
  115|   111k|		break;
  116|   113k|	}
  117|   113k|	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: 113k]
  ------------------
  118|   113k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 79.0k, False: 34.4k]
  ------------------
  119|  79.0k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 79.0k]
  ------------------
  120|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  121|  79.0k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 79.0k]
  ------------------
  122|      0|			RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  123|  79.0k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 1.91k, False: 77.1k]
  ------------------
  124|  1.91k|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|  1.91k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.91k|			*(pf) = (f); \
  |  |   62|  1.91k|			return r; \
  |  |   63|  1.91k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  125|  77.1k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  77.1k|#define RETURN(pf,f,r) do { \
  |  |   61|  77.1k|			*(pf) = (f); \
  |  |   62|  77.1k|			return r; \
  |  |   63|  77.1k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  126|  77.1k|	}
  127|  34.4k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 34.4k]
  ------------------
  128|      0|		if (longdouble)
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, 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|  34.4k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 34.4k]
  ------------------
  139|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (139:7): [True: 0, False: 0]
  ------------------
  140|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, 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|  34.4k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 1.85k, False: 32.5k]
  ------------------
  144|  1.85k|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 1.85k]
  ------------------
  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.85k|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 1.85k]
  ------------------
  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.85k|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|  1.85k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.85k|			*(pf) = (f); \
  |  |   62|  1.85k|			return r; \
  |  |   63|  1.85k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  149|  1.85k|	}
  150|  32.5k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 548, False: 32.0k]
  ------------------
  151|    548|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 548]
  ------------------
  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|    548|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    548|#define RETURN(pf,f,r) do { \
  |  |   61|    548|			*(pf) = (f); \
  |  |   62|    548|			return r; \
  |  |   63|    548|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  154|    548|	}
  155|  32.0k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 32.0k, False: 0]
  ------------------
  156|  32.0k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 32.0k]
  ------------------
  157|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  158|  32.0k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  32.0k|#define RETURN(pf,f,r) do { \
  |  |   61|  32.0k|			*(pf) = (f); \
  |  |   62|  32.0k|			return r; \
  |  |   63|  32.0k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  159|  32.0k|	}
  160|      0|	if (*f == 'p') {
  ------------------
  |  Branch (160:6): [True: 0, False: 0]
  ------------------
  161|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (161:7): [True: 0, False: 0]
  ------------------
  162|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  163|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  164|      0|	}
  165|      0|	RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded, False: 0]
  |  |  ------------------
  ------------------
  166|       |	/*NOTREACHED*/
  167|      0|}

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

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.29k, False: 1.95k]
  ------------------
  317|  1.29k|		struct timespec ts;
  318|  1.29k|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  460|  1.29k|#define CAST(T, b)	((T)(b))
  ------------------
  319|  1.29k|		t = ts.tv_sec;
  320|  1.95k|	} else {
  321|       |		// XXX: perhaps detect and print something if overflow
  322|       |		// on 32 bit time_t?
  323|  1.95k|		t = CAST(time_t, v);
  ------------------
  |  |  460|  1.95k|#define CAST(T, b)	((T)(b))
  ------------------
  324|  1.95k|	}
  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: 282, False: 2.97k]
  ------------------
  327|    282|		goto out;
  328|       |
  329|  2.97k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  548|  2.97k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (329:6): [True: 411, False: 2.55k]
  ------------------
  330|    411|#ifdef HAVE_TZSET
  331|    411|		tzset();
  332|    411|#endif
  333|    411|		tm = localtime_r(&t, &tmz);
  334|  2.55k|	} else {
  335|  2.55k|		tm = gmtime_r(&t, &tmz);
  336|  2.55k|	}
  337|  2.97k|	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: 253, False: 2.63k]
  ------------------
  342|    253|		goto out;
  343|  2.63k|	pp[strcspn(pp, "\n")] = '\0';
  344|  2.63k|	return pp;
  345|    616|out:
  346|    616|	strlcpy(buf, "*Invalid datetime*", bsize);
  347|    616|	return buf;
  348|  2.88k|}
file_fmtdate:
  356|    212|{
  357|    212|	struct tm tm;
  358|       |
  359|    212|	memset(&tm, 0, sizeof(tm));
  360|    212|	tm.tm_mday = v & 0x1f;
  361|    212|	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|    212|	if (tm.tm_mon < 0 || tm.tm_mon > 11)
  ------------------
  |  Branch (364:6): [True: 71, False: 141]
  |  Branch (364:23): [True: 70, False: 71]
  ------------------
  365|    141|		tm.tm_mon = 0;
  366|    212|	tm.tm_year = (v >> 9) + 80;
  367|       |
  368|    212|	if (strftime(buf, bsize, "%b %d %Y", &tm) == 0)
  ------------------
  |  Branch (368:6): [True: 0, False: 212]
  ------------------
  369|      0|		goto out;
  370|       |
  371|    212|	return buf;
  372|      0|out:
  373|      0|	strlcpy(buf, "*Invalid date*", bsize);
  374|      0|	return buf;
  375|    212|}
file_fmttime:
  379|    212|{
  380|    212|	struct tm tm;
  381|       |
  382|    212|	memset(&tm, 0, sizeof(tm));
  383|    212|	tm.tm_sec = (v & 0x1f) * 2;
  384|    212|	tm.tm_min = ((v >> 5) & 0x3f);
  385|    212|	tm.tm_hour = (v >> 11);
  386|       |
  387|    212|	if (strftime(buf, bsize, "%T", &tm) == 0)
  ------------------
  |  Branch (387:6): [True: 0, False: 212]
  ------------------
  388|      0|		goto out;
  389|       |
  390|    212|	return buf;
  391|      0|out:
  392|      0|	strlcpy(buf, "*Invalid time*", bsize);
  393|      0|	return buf;
  394|       |
  395|    212|}

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.3k, False: 1.07k]
  ------------------
  583|  14.3k|		return 0;
  584|       |#ifdef CDF_DEBUG
  585|       |	cdf_dump_header(&h);
  586|       |#endif
  587|       |
  588|  1.07k|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (588:6): [True: 174, False: 901]
  ------------------
  589|    174|		expn = "Can't read SAT";
  590|    174|		goto out0;
  591|    174|	}
  592|       |#ifdef CDF_DEBUG
  593|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  594|       |#endif
  595|       |
  596|    901|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (596:6): [True: 277, False: 624]
  ------------------
  597|    277|		expn = "Can't read SSAT";
  598|    277|		goto out1;
  599|    277|	}
  600|       |#ifdef CDF_DEBUG
  601|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  602|       |#endif
  603|       |
  604|    624|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (604:6): [True: 88, False: 536]
  ------------------
  605|     88|		expn = "Can't read directory";
  606|     88|		goto out2;
  607|     88|	}
  608|       |
  609|    536|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (609:6): [True: 88, False: 448]
  ------------------
  610|    536|	    &root_storage)) == -1) {
  611|     88|		expn = "Cannot read short stream";
  612|     88|		goto out3;
  613|     88|	}
  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|    448|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (629:6): [True: 12, False: 436]
  ------------------
  630|    448|	    "FileHeader", &scn) != -1) {
  631|     12|#define HWP5_SIGNATURE "HWP Document File"
  632|     12|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  631|     12|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (632:7): [True: 10, False: 2]
  ------------------
  633|     10|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  631|     10|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (633:10): [True: 1, False: 9]
  ------------------
  634|     10|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  631|     10|#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|     11|		} else {
  646|     11|		    cdf_zero_stream(&scn);
  647|     11|		}
  648|     12|	}
  649|       |
  650|    447|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (650:6): [True: 342, False: 105]
  ------------------
  651|    447|	    &scn)) == -1) {
  652|    342|		if (errno != ESRCH) {
  ------------------
  |  Branch (652:7): [True: 154, False: 188]
  ------------------
  653|    154|			expn = "Cannot read summary info";
  654|    154|		}
  655|    342|	} else {
  656|    105|		i = cdf_check_summary_info(ms, &info, &h,
  657|    105|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  658|    105|		cdf_zero_stream(&scn);
  659|    105|	}
  660|    447|	if (i <= 0) {
  ------------------
  |  Branch (660:6): [True: 447, False: 0]
  ------------------
  661|    447|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (661:7): [True: 431, False: 16]
  ------------------
  662|    447|		    &sst, &dir, &scn)) == -1) {
  663|    431|			if (errno != ESRCH) {
  ------------------
  |  Branch (663:8): [True: 23, False: 408]
  ------------------
  664|     23|				expn = "Cannot read summary info";
  665|     23|			}
  666|    431|		} else {
  667|     16|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  668|     16|			    &sst, &dir, &scn, root_storage, &expn);
  669|     16|		}
  670|    447|	}
  671|    447|	if (i <= 0) {
  ------------------
  |  Branch (671:6): [True: 447, False: 0]
  ------------------
  672|    447|		i = cdf_file_dir_info(ms, &dir);
  673|    447|		if (i < 0)
  ------------------
  |  Branch (673:7): [True: 443, False: 4]
  ------------------
  674|    443|			expn = "Cannot read section info";
  675|    447|	}
  676|    448|out5:
  677|    448|	cdf_zero_stream(&scn);
  678|    448|	cdf_zero_stream(&sst);
  679|    536|out3:
  680|    536|	free(dir.dir_tab);
  681|    624|out2:
  682|    624|	free(ssat.sat_tab);
  683|    901|out1:
  684|    901|	free(sat.sat_tab);
  685|  1.07k|out0:
  686|       |	/* If we handled it already, return */
  687|  1.07k|	if (i != -1)
  ------------------
  |  Branch (687:6): [True: 5, False: 1.07k]
  ------------------
  688|      5|		return i;
  689|       |	/* Provide a default handler */
  690|  1.07k|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|  1.07k|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|  1.07k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.07k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.07k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1.07k, False: 0]
  |  |  ------------------
  ------------------
  691|  1.07k|		if (file_printf(ms,
  ------------------
  |  Branch (691:7): [True: 0, False: 1.07k]
  ------------------
  692|  1.07k|		    "Composite Document File V2 Document") == -1)
  693|      0|			return -1;
  694|  1.07k|		if (*expn)
  ------------------
  |  Branch (694:7): [True: 1.07k, False: 0]
  ------------------
  695|  1.07k|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (695:8): [True: 0, False: 1.07k]
  ------------------
  696|      0|				return -1;
  697|  1.07k|	} 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.07k|	return 1;
  703|  1.07k|}
readcdf.c:cdf_check_summary_info:
  396|    121|{
  397|    121|	int i;
  398|    121|	const char *str = NULL;
  399|    121|	cdf_directory_t *d;
  400|    121|	char name[__arraycount(d->d_name) + 1];
  401|    121|	size_t j, k;
  402|       |
  403|       |#ifdef CDF_DEBUG
  404|       |	cdf_dump_summary_info(h, scn);
  405|       |#endif
  406|    121|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (406:6): [True: 121, False: 0]
  ------------------
  407|    121|	    *expn = "Can't expand summary_info";
  408|    121|	    return i;
  409|    121|	}
  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|    121|{
  305|    121|	cdf_summary_info_header_t si;
  306|    121|	cdf_property_info_t *info;
  307|    121|	size_t count;
  308|    121|	int m;
  309|       |
  310|    121|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (310:6): [True: 121, False: 0]
  ------------------
  311|    121|		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|    447|{
  520|    447|	size_t sd, i, j;
  521|    447|	uint16_t *dir_name;
  522|    447|	int dir_type;
  523|    447|	const char* section_name;
  524|       |
  525|  7.63k|	for (i = 0; i < dir->dir_len; i++) {
  ------------------
  |  Branch (525:14): [True: 7.19k, False: 443]
  ------------------
  526|  7.19k|		dir_name = dir->dir_tab[i].d_name;
  527|  7.19k|		dir_type = dir->dir_tab[i].d_type;
  528|       |
  529|  50.3k|		for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  138|  50.3k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (529:16): [True: 43.1k, False: 7.18k]
  ------------------
  530|  43.1k|			const struct sinfo *si = &sectioninfo[sd];
  531|   107k|			for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (531:16): [True: 64.7k, False: 43.1k]
  ------------------
  532|  64.7k|				if (si->sections[j] == NULL)
  ------------------
  |  Branch (532:9): [True: 0, False: 64.7k]
  ------------------
  533|      0|					continue;
  534|  64.7k|				section_name = si->sections[j];
  535|  64.7k|				if (si->types[j] != dir_type ||
  ------------------
  |  Branch (535:9): [True: 59.4k, False: 5.29k]
  ------------------
  536|  5.29k|				    cdf_namecmp(section_name, dir_name,
  ------------------
  |  Branch (536:9): [True: 5.29k, False: 4]
  ------------------
  537|  5.29k|					strlen(section_name) + 1) != 0)
  538|  64.7k|				    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|  43.1k|		}
  557|  7.19k|	}
  558|    443|	return -1;
  559|    447|}

file_tryelf:
 1896|  7.89k|{
 1897|  7.89k|	int fd = b->fd;
 1898|  7.89k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  460|  7.89k|#define CAST(T, b)	((T)(b))
  ------------------
 1899|  7.89k|	size_t nbytes = b->flen;
 1900|  7.89k|	union {
 1901|  7.89k|		int32_t l;
 1902|  7.89k|		char c[sizeof(int32_t)];
 1903|  7.89k|	} u;
 1904|  7.89k|	int clazz;
 1905|  7.89k|	int swap;
 1906|  7.89k|	struct stat st;
 1907|  7.89k|	const struct stat *stp;
 1908|  7.89k|	off_t fsize;
 1909|  7.89k|	int flags = 0;
 1910|  7.89k|	Elf32_Ehdr elf32hdr;
 1911|  7.89k|	Elf64_Ehdr elf64hdr;
 1912|  7.89k|	uint16_t type, phnum, shnum, notecount;
 1913|       |
 1914|  7.89k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  7.89k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  7.89k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (1914:6): [True: 0, False: 7.89k]
  ------------------
 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.89k|	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  157|  7.89k|#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.17k, False: 4.72k]
  ------------------
 1925|  4.72k|	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  4.72k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  167|  9.45k|#define	ELFMAG1		'E'
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  3.80k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  172|  3.80k|#define	OLFMAG1		'O'
  ------------------
  |  Branch (1925:10): [True: 3.80k, False: 920]
  |  Branch (1925:37): [True: 17, False: 3.79k]
  ------------------
 1926|  4.71k|	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  159|  4.71k|#define	EI_MAG2		2
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  168|  12.6k|#define	ELFMAG2		'L'
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  160|  4.69k|#define	EI_MAG3		3
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  169|  4.69k|#define	ELFMAG3		'F'
  ------------------
  |  Branch (1926:9): [True: 13, False: 4.69k]
  |  Branch (1926:36): [True: 9, False: 4.68k]
  ------------------
 1927|  3.20k|		return 0;
 1928|       |
 1929|       |	/*
 1930|       |	 * If we cannot seek, it must be a pipe, socket or fifo.
 1931|       |	 */
 1932|  4.68k|	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  460|  4.68k|#define CAST(T, b)	((T)(b))
  ------------------
              	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  460|  4.68k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1932:5): [True: 0, False: 4.68k]
  ------------------
 1933|      0|	    && (errno == ESPIPE))
  ------------------
  |  Branch (1933:9): [True: 0, False: 0]
  ------------------
 1934|      0|		fd = file_pipe2file(ms, fd, buf, nbytes);
 1935|       |
 1936|  4.68k|	if (fd == -1) {
  ------------------
  |  Branch (1936:6): [True: 0, False: 4.68k]
  ------------------
 1937|      0|		file_badread(ms);
 1938|      0|		return -1;
 1939|      0|	}
 1940|       |
 1941|  4.68k|	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.68k|	if (b->st.st_size == 0) {
  ------------------
  |  Branch (1946:6): [True: 0, False: 4.68k]
  ------------------
 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.68k|	if (S_ISREG(stp->st_mode) || stp->st_size != 0)
  ------------------
  |  Branch (1953:6): [True: 4.68k, False: 0]
  |  Branch (1953:31): [True: 0, False: 0]
  ------------------
 1954|  4.68k|		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.68k|	clazz = buf[EI_CLASS];
  ------------------
  |  |  161|  4.68k|#define	EI_CLASS	4
  ------------------
 1959|       |
 1960|  4.68k|	switch (clazz) {
 1961|  3.01k|	case ELFCLASS32:
  ------------------
  |  |  153|  3.01k|#define	ELFCLASS32	1
  ------------------
  |  Branch (1961:2): [True: 3.01k, False: 1.67k]
  ------------------
 1962|  3.01k|#undef elf_getu
 1963|  3.01k|#define elf_getu(a, b)	elf_getu32(a, b)
 1964|  3.01k|#undef elfhdr
 1965|  3.01k|#define elfhdr elf32hdr
 1966|  3.01k|#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.01k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1965|  3.01k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 21, False: 2.99k]
  |  |  ------------------
  |  |   28|     21|		return 0;
  |  |   29|       |
  |  |   30|  2.99k|	u.l = 1;
  |  |   31|  2.99k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.99k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1965|  2.99k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |   32|  2.99k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1965|  2.99k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  2.99k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  2.99k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  2.99k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  2.99k|	notecount = ms->elf_notes_max;
  |  |   36|  2.99k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|  1.86k|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|  1.86k|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 1.86k, False: 1.13k]
  |  |  ------------------
  |  |   39|  1.86k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|  1.86k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|  1.86k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 13, False: 1.84k]
  |  |  ------------------
  |  |   41|     13|			return toomany(ms, "program headers", phnum);
  |  |   42|  1.84k|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|  1.84k|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|  1.84k|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 1.84k]
  |  |  ------------------
  |  |   44|  1.84k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|  1.84k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|  1.84k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.84k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|  1.84k|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|  1.84k|		break;
  |  |   49|  1.84k|#endif
  |  |   50|  1.84k|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|  1.00k|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 1.00k, False: 1.99k]
  |  |  ------------------
  |  |   51|  1.11k|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|  1.11k|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 108, False: 2.88k]
  |  |  ------------------
  |  |   52|  1.11k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|  1.11k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|  1.11k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 19, False: 1.09k]
  |  |  ------------------
  |  |   54|     19|			return toomany(ms, "program", phnum);
  |  |   55|  1.09k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|  1.09k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|  1.09k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 15, False: 1.08k]
  |  |  ------------------
  |  |   57|     15|			return toomany(ms, "section", shnum);
  |  |   58|  1.08k|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 1.08k]
  |  |  ------------------
  |  |   59|  1.08k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|  1.08k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|  1.08k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.08k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|  1.08k|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|  1.09k|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|  1.09k|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 17, False: 2.98k]
  |  |  ------------------
  |  |   65|  1.09k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|  1.09k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|  1.09k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 11, False: 1.08k]
  |  |  ------------------
  |  |   67|     11|			return toomany(ms, "section headers", shnum);
  |  |   68|  1.08k|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 64, False: 1.02k]
  |  |  ------------------
  |  |   69|  1.08k|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  460|  1.08k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|  1.08k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.08k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|  1.08k|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|  1.08k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|  1.08k|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  460|  1.08k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|  1.08k|		    &flags, &notecount) == -1)
  |  |   74|     64|			return -1;
  |  |   75|  1.02k|		break;
  |  |   76|       |
  |  |   77|  1.02k|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 3, False: 2.99k]
  |  |  ------------------
  |  |   78|      3|		break;
  |  |   79|  2.99k|	}
  |  |   80|  2.87k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 19, False: 2.85k]
  |  |  ------------------
  |  |   81|     19|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  2.85k|	return 1;
  ------------------
 1967|  1.66k|	case ELFCLASS64:
  ------------------
  |  |  154|  1.66k|#define	ELFCLASS64	2
  ------------------
  |  Branch (1967:2): [True: 1.66k, False: 3.02k]
  ------------------
 1968|  1.66k|#undef elf_getu
 1969|  1.66k|#define elf_getu(a, b)	elf_getu64(a, b)
 1970|  1.66k|#undef elfhdr
 1971|  1.66k|#define elfhdr elf64hdr
 1972|  1.66k|#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.66k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1971|  1.66k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 10, False: 1.65k]
  |  |  ------------------
  |  |   28|     10|		return 0;
  |  |   29|       |
  |  |   30|  1.65k|	u.l = 1;
  |  |   31|  1.65k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.65k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1971|  1.65k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |   32|  1.65k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1971|  1.65k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  1.65k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  1.65k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  157|  1.65k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  1.65k|	notecount = ms->elf_notes_max;
  |  |   36|  1.65k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|    608|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|    608|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 608, False: 1.04k]
  |  |  ------------------
  |  |   39|    608|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    608|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|    608|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 10, False: 598]
  |  |  ------------------
  |  |   41|     10|			return toomany(ms, "program headers", phnum);
  |  |   42|    598|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  361|    598|#define FLAGS_IS_CORE			0x1000
  |  |  ------------------
  |  |   43|    598|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 598]
  |  |  ------------------
  |  |   44|    598|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|    598|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|    598|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|    598|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|    598|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|    598|		break;
  |  |   49|    598|#endif
  |  |   50|    598|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    551|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 551, False: 1.10k]
  |  |  ------------------
  |  |   51|    944|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    944|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 393, False: 1.26k]
  |  |  ------------------
  |  |   52|    944|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  157|    944|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    944|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 3, False: 941]
  |  |  ------------------
  |  |   54|      3|			return toomany(ms, "program", phnum);
  |  |   55|    941|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|    941|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    941|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 16, False: 925]
  |  |  ------------------
  |  |   57|     16|			return toomany(ms, "section", shnum);
  |  |   58|    925|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 924]
  |  |  ------------------
  |  |   59|    925|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  460|    925|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    925|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  460|    925|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    925|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|  1.02k|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|  1.02k|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 102, False: 1.55k]
  |  |  ------------------
  |  |   65|  1.02k|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  157|  1.02k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|  1.02k|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 6, False: 1.02k]
  |  |  ------------------
  |  |   67|      6|			return toomany(ms, "section headers", shnum);
  |  |   68|  1.02k|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 81, False: 939]
  |  |  ------------------
  |  |   69|  1.02k|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  460|  1.02k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|  1.02k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  460|  1.02k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|  1.02k|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  157|  1.02k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|  1.02k|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  460|  1.02k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|  1.02k|		    &flags, &notecount) == -1)
  |  |   74|     81|			return -1;
  |  |   75|    939|		break;
  |  |   76|       |
  |  |   77|    939|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 2, False: 1.65k]
  |  |  ------------------
  |  |   78|      2|		break;
  |  |   79|  1.65k|	}
  |  |   80|  1.53k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 6, False: 1.53k]
  |  |  ------------------
  |  |   81|      6|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  1.53k|	return 1;
  ------------------
 1973|      5|	default:
  ------------------
  |  Branch (1973:2): [True: 5, False: 4.68k]
  ------------------
 1974|      5|	    if (elf_printf(ms, ", unknown class %d", clazz) == -1)
  ------------------
  |  Branch (1974:10): [True: 0, False: 5]
  ------------------
 1975|      0|		    return -1;
 1976|      5|	    break;
 1977|  4.68k|	}
 1978|      5|	return 0;
 1979|  4.68k|}
readelf.c:getu16:
   94|  24.1k|{
   95|  24.1k|	union {
   96|  24.1k|		uint16_t ui;
   97|  24.1k|		char c[2];
   98|  24.1k|	} retval, tmpval;
   99|       |
  100|  24.1k|	if (swap) {
  ------------------
  |  Branch (100:6): [True: 7.74k, False: 16.3k]
  ------------------
  101|  7.74k|		tmpval.ui = value;
  102|       |
  103|  7.74k|		retval.c[0] = tmpval.c[1];
  104|  7.74k|		retval.c[1] = tmpval.c[0];
  105|       |
  106|  7.74k|		return retval.ui;
  107|  7.74k|	} else
  108|  16.3k|		return value;
  109|  24.1k|}
readelf.c:toomany:
   86|    118|{
   87|    118|	if (elf_printf(ms, ", too many %s (%u)", name, num) == -1)
  ------------------
  |  Branch (87:6): [True: 0, False: 118]
  ------------------
   88|      0|		return -1;
   89|    118|	return 1;
   90|    118|}
readelf.c:dophn_core:
  367|  2.44k|{
  368|  2.44k|	Elf32_Phdr ph32;
  369|  2.44k|	Elf64_Phdr ph64;
  370|  2.44k|	size_t offset, len;
  371|  2.44k|	unsigned char nbuf[NBUFSIZE];
  372|  2.44k|	ssize_t bufsize;
  373|  2.44k|	off_t ph_off = off, offs;
  374|  2.44k|	int ph_num = num;
  375|       |
  376|  2.44k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  2.44k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.44k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.44k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (376:6): [True: 0, False: 2.44k]
  ------------------
  377|      0|		return 0;
  378|       |
  379|  2.44k|	if (num == 0) {
  ------------------
  |  Branch (379:6): [True: 3, False: 2.44k]
  ------------------
  380|      3|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (380:7): [True: 0, False: 3]
  ------------------
  381|      0|			return -1;
  382|      3|		return 0;
  383|      3|	}
  384|  2.44k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  2.44k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.44k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 1.84k, False: 598]
  |  |  ------------------
  |  |  184|  2.44k|			 ? sizeof(ph32)				\
  |  |  185|  2.44k|			 : sizeof(ph64))
  ------------------
  |  Branch (384:6): [True: 26, False: 2.41k]
  ------------------
  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|  17.8k|	for ( ; num; num--) {
  ------------------
  |  Branch (393:10): [True: 17.7k, False: 97]
  ------------------
  394|  17.7k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  17.7k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  17.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 11.2k, False: 6.53k]
  |  |  ------------------
  |  |  181|  17.7k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  460|  11.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  17.7k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  460|  6.53k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  17.7k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  17.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 11.2k, False: 6.53k]
  |  |  ------------------
  |  |  184|  17.7k|			 ? sizeof(ph32)				\
  |  |  185|  17.7k|			 : sizeof(ph64))
  ------------------
  |  Branch (394:7): [True: 2.30k, False: 15.4k]
  ------------------
  395|  17.7k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  460|  35.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 11.2k, False: 6.53k]
  |  |  ------------------
  ------------------
  396|  2.30k|			if (elf_printf(ms, 
  ------------------
  |  Branch (396:8): [True: 0, False: 2.30k]
  ------------------
  397|  2.30k|			    ", can't read elf program headers at %jd",
  398|  2.30k|			    (intmax_t)off) == -1)
  399|      0|				return -1;
  400|  2.30k|			return 0;
  401|  2.30k|		}
  402|  15.4k|		off += size;
  403|       |
  404|  15.4k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  15.4k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  30.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  15.4k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  30.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 9.42k, False: 6.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  15.4k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  15.4k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (404:7): [True: 15.4k, False: 0]
  |  Branch (404:32): [True: 4.35k, False: 11.0k]
  ------------------
  405|       |			/* Perhaps warn here */
  406|  4.35k|			continue;
  407|  4.35k|		}
  408|       |
  409|  11.0k|		if (xph_type != PT_NOTE)
  ------------------
  |  |  186|  11.0k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  11.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 7.44k, False: 3.65k]
  |  |  ------------------
  |  |  187|  11.0k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  7.44k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  11.0k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  3.65k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
              		if (xph_type != PT_NOTE)
  ------------------
  |  |  201|  11.0k|#define	PT_NOTE		4
  ------------------
  |  Branch (409:7): [True: 3.96k, False: 7.13k]
  ------------------
  410|  3.96k|			continue;
  411|       |
  412|       |		/*
  413|       |		 * This is a PT_NOTE section; loop through all the notes
  414|       |		 * in the section.
  415|       |		 */
  416|  7.13k|		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  7.13k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  14.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.59k, False: 1.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.13k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.13k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  202|  1.27k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  2.54k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 750, False: 524]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.13k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.13k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (416:9): [True: 1.27k, False: 5.86k]
  ------------------
  417|  7.13k|		offs = xph_offset;
  ------------------
  |  |  189|  7.13k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  14.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.59k, False: 1.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  7.13k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  7.13k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  418|  7.13k|		if ((bufsize = pread(fd, nbuf, len, offs)) == -1) {
  ------------------
  |  Branch (418:7): [True: 21, False: 7.11k]
  ------------------
  419|     21|			if (elf_printf(ms, " can't read note section at %jd",
  ------------------
  |  Branch (419:8): [True: 0, False: 21]
  ------------------
  420|     21|			    (intmax_t)offs) == -1)
  421|      0|				return -1;
  422|     21|			return 0;
  423|     21|		}
  424|  7.11k|		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.29k, False: 26.3k]
  ------------------
  427|  5.29k|				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.5k]
  ------------------
  432|  1.82k|				break;
  433|       |
  434|  26.3k|		}
  435|  7.11k|	}
  436|     97|	return 0;
  437|  2.41k|}
readelf.c:donote:
 1234|  35.0k|{
 1235|  35.0k|	Elf32_Nhdr nh32;
 1236|  35.0k|	Elf64_Nhdr nh64;
 1237|  35.0k|	size_t noff, doff;
 1238|  35.0k|	uint32_t namesz, descsz;
 1239|  35.0k|	char buf[256];
 1240|  35.0k|	unsigned char *nbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  460|  35.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1241|       |
 1242|  35.0k|	if (*notecount == 0)
  ------------------
  |  Branch (1242:6): [True: 536, False: 34.5k]
  ------------------
 1243|    536|		return 0;
 1244|  34.5k|	--*notecount;
 1245|       |
 1246|  34.5k|	if (xnh_sizeof + offset > size) {
  ------------------
  |  |  211|  34.5k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  34.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 28.1k, False: 6.33k]
  |  |  ------------------
  |  |  212|  34.5k|			 ? sizeof(nh32)				\
  |  |  213|  34.5k|			 : sizeof(nh64))
  ------------------
  |  Branch (1246:6): [True: 2.71k, False: 31.8k]
  ------------------
 1247|       |		/*
 1248|       |		 * We're out of note headers.
 1249|       |		 */
 1250|  2.71k|		return xnh_sizeof + offset;
  ------------------
  |  |  211|  2.71k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.71k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 2.27k, False: 439]
  |  |  ------------------
  |  |  212|  2.71k|			 ? sizeof(nh32)				\
  |  |  213|  2.71k|			 : sizeof(nh64))
  ------------------
 1251|  2.71k|	}
 1252|       |	/*XXX: GCC */
 1253|  31.8k|	memset(&nh32, 0, sizeof(nh32));
 1254|  31.8k|	memset(&nh64, 0, sizeof(nh64));
 1255|       |
 1256|  31.8k|	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  208|  31.8k|#define xnh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (208:19): [True: 25.9k, False: 5.89k]
  |  |  ------------------
  |  |  209|  31.8k|			 ? CAST(void *, &nh32)			\
  |  |  ------------------
  |  |  |  |  460|  25.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  210|  31.8k|			 : CAST(void *, &nh64))
  |  |  ------------------
  |  |  |  |  460|  5.89k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  211|  31.8k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 25.9k, False: 5.89k]
  |  |  ------------------
  |  |  212|  31.8k|			 ? sizeof(nh32)				\
  |  |  213|  31.8k|			 : sizeof(nh64))
  ------------------
 1257|  31.8k|	offset += xnh_sizeof;
  ------------------
  |  |  211|  31.8k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (211:21): [True: 25.9k, False: 5.89k]
  |  |  ------------------
  |  |  212|  31.8k|			 ? sizeof(nh32)				\
  |  |  213|  31.8k|			 : sizeof(nh64))
  ------------------
 1258|       |
 1259|  31.8k|	namesz = xnh_namesz;
  ------------------
  |  |  217|  31.8k|#define xnh_namesz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (217:21): [True: 25.9k, False: 5.89k]
  |  |  ------------------
  |  |  218|  31.8k|			 ? elf_getu32(swap, nh32.n_namesz)	\
  |  |  ------------------
  |  |  |  |  158|  25.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  219|  31.8k|			 : elf_getu32(swap, nh64.n_namesz))
  |  |  ------------------
  |  |  |  |  158|  5.89k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1260|  31.8k|	descsz = xnh_descsz;
  ------------------
  |  |  220|  31.8k|#define xnh_descsz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (220:21): [True: 25.9k, False: 5.89k]
  |  |  ------------------
  |  |  221|  31.8k|			 ? elf_getu32(swap, nh32.n_descsz)	\
  |  |  ------------------
  |  |  |  |  158|  25.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  222|  31.8k|			 : elf_getu32(swap, nh64.n_descsz))
  |  |  ------------------
  |  |  |  |  158|  5.89k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1261|       |
 1262|  31.8k|	if ((namesz == 0) && (descsz == 0)) {
  ------------------
  |  Branch (1262:6): [True: 4.00k, False: 27.7k]
  |  Branch (1262:23): [True: 284, False: 3.72k]
  ------------------
 1263|       |		/*
 1264|       |		 * We're out of note headers.
 1265|       |		 */
 1266|    284|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1266:10): [True: 34, False: 250]
  ------------------
 1267|    284|	}
 1268|       |
 1269|  31.5k|	if (namesz & 0x80000000) {
  ------------------
  |  Branch (1269:6): [True: 614, False: 30.9k]
  ------------------
 1270|    614|	    (void)elf_printf(ms, ", bad note name size %#lx",
 1271|    614|		CAST(unsigned long, namesz));
  ------------------
  |  |  460|    614|#define CAST(T, b)	((T)(b))
  ------------------
 1272|    614|	    return 0;
 1273|    614|	}
 1274|       |
 1275|  30.9k|	if (descsz & 0x80000000) {
  ------------------
  |  Branch (1275:6): [True: 1.81k, False: 29.0k]
  ------------------
 1276|  1.81k|		(void)elf_printf(ms, ", bad note description size %#lx",
 1277|  1.81k|		    CAST(unsigned long, descsz));
  ------------------
  |  |  460|  1.81k|#define CAST(T, b)	((T)(b))
  ------------------
 1278|  1.81k|		return 0;
 1279|  1.81k|	}
 1280|       |
 1281|  29.0k|	noff = offset;
 1282|  29.0k|	doff = ELF_ALIGN(offset + namesz);
  ------------------
  |  |   56|  29.0k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1283|       |
 1284|  29.0k|	if (offset + namesz > size) {
  ------------------
  |  Branch (1284:6): [True: 2.38k, False: 26.7k]
  ------------------
 1285|       |		/*
 1286|       |		 * We're past the end of the buffer.
 1287|       |		 */
 1288|  2.38k|		return doff;
 1289|  2.38k|	}
 1290|       |
 1291|  26.7k|	offset = ELF_ALIGN(doff + descsz);
  ------------------
  |  |   56|  26.7k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1292|  26.7k|	if (doff + descsz > size) {
  ------------------
  |  Branch (1292:6): [True: 1.46k, False: 25.2k]
  ------------------
 1293|       |		/*
 1294|       |		 * We're past the end of the buffer.
 1295|       |		 */
 1296|  1.46k|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1296:10): [True: 1.06k, False: 395]
  ------------------
 1297|  1.46k|	}
 1298|       |
 1299|       |
 1300|  25.2k|	if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
  ------------------
  |  |  352|  25.2k|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  |  Branch (1300:6): [True: 24.6k, False: 555]
  ------------------
 1301|  24.6k|		if (do_os_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  24.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  24.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 20.9k, False: 3.70k]
  |  |  ------------------
  |  |  215|  24.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  20.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  24.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.70k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1301:7): [True: 132, False: 24.5k]
  ------------------
 1302|  24.6k|		    namesz, descsz, noff, doff, flags))
 1303|    132|			return offset;
 1304|  24.6k|	}
 1305|       |
 1306|  25.1k|	if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
  ------------------
  |  |  353|  25.1k|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  |  Branch (1306:6): [True: 24.6k, False: 468]
  ------------------
 1307|  24.6k|		if (do_bid_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  24.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  24.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 20.9k, False: 3.70k]
  |  |  ------------------
  |  |  215|  24.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  20.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  24.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.70k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1307:7): [True: 1.14k, False: 23.5k]
  ------------------
 1308|  24.6k|		    namesz, descsz, noff, doff, flags))
 1309|  1.14k|			return offset;
 1310|  24.6k|	}
 1311|       |
 1312|  23.9k|	if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
  ------------------
  |  |  355|  23.9k|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  |  Branch (1312:6): [True: 23.2k, False: 685]
  ------------------
 1313|  23.2k|		if (do_pax_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  23.2k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.5k, False: 3.70k]
  |  |  ------------------
  |  |  215|  23.2k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.2k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.70k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1313:7): [True: 52, False: 23.2k]
  ------------------
 1314|  23.2k|		    namesz, descsz, noff, doff, flags))
 1315|     52|			return offset;
 1316|  23.2k|	}
 1317|  23.9k|	if ((*flags & FLAGS_DID_ANDROID_MEMTAG) == 0) {
  ------------------
  |  |  360|  23.9k|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  |  Branch (1317:6): [True: 23.6k, False: 218]
  ------------------
 1318|  23.6k|		if (do_memtag_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  23.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.9k, False: 3.70k]
  |  |  ------------------
  |  |  215|  23.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.70k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1318:7): [True: 60, False: 23.6k]
  ------------------
 1319|  23.6k|		    namesz, descsz, noff, doff, flags))
 1320|     60|			return offset;
 1321|  23.6k|	}
 1322|       |
 1323|  23.8k|	if ((*flags & FLAGS_DID_CORE) == 0) {
  ------------------
  |  |  351|  23.8k|#define FLAGS_DID_CORE			0x0004
  ------------------
  |  Branch (1323:6): [True: 23.0k, False: 833]
  ------------------
 1324|  23.0k|		if (do_core_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.3k, False: 3.70k]
  |  |  ------------------
  |  |  215|  23.0k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.0k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.70k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1324:7): [True: 83, False: 22.9k]
  ------------------
 1325|  23.0k|		    namesz, descsz, noff, doff, flags, size, clazz))
 1326|     83|			return offset;
 1327|  23.0k|	}
 1328|       |
 1329|  23.7k|	if ((*flags & FLAGS_DID_AUXV) == 0) {
  ------------------
  |  |  362|  23.7k|#define FLAGS_DID_AUXV			0x2000
  ------------------
  |  Branch (1329:6): [True: 23.2k, False: 503]
  ------------------
 1330|  23.2k|		if (do_auxv_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  214|  23.2k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 19.5k, False: 3.68k]
  |  |  ------------------
  |  |  215|  23.2k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  19.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  23.2k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|  3.68k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1330:7): [True: 734, False: 22.5k]
  ------------------
 1331|  23.2k|			namesz, descsz, noff, doff, flags, size, clazz,
 1332|  23.2k|			fd, ph_off, ph_num, fsize))
 1333|    734|			return offset;
 1334|  23.2k|	}
 1335|       |
 1336|  23.0k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "NetBSD")) {
  ------------------
  |  |   67|  23.0k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.89k, False: 20.1k]
  |  |  |  Branch (67:29): [True: 1.61k, False: 1.28k]
  |  |  ------------------
  ------------------
 1337|  1.61k|		int descw, flag;
 1338|  1.61k|		const char *str, *tag;
 1339|  1.61k|		if (descsz > 100)
  ------------------
  |  Branch (1339:7): [True: 375, False: 1.24k]
  ------------------
 1340|    375|			descsz = 100;
 1341|  1.61k|		switch (xnh_type) {
  ------------------
  |  |  214|  1.61k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.61k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (214:19): [True: 1.37k, False: 243]
  |  |  ------------------
  |  |  215|  1.61k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  158|  1.37k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  216|  1.61k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  158|    243|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1342|    516|	    	case NT_NETBSD_VERSION:
  ------------------
  |  |  285|    516|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (1342:7): [True: 516, False: 1.10k]
  ------------------
 1343|    516|			return offset;
 1344|    209|		case NT_NETBSD_MARCH:
  ------------------
  |  |  346|    209|#define NT_NETBSD_MARCH		5
  ------------------
  |  Branch (1344:3): [True: 209, False: 1.40k]
  ------------------
 1345|    209|			flag = FLAGS_DID_NETBSD_MARCH;
  ------------------
  |  |  356|    209|#define FLAGS_DID_NETBSD_MARCH		0x0080
  ------------------
 1346|    209|			tag = "compiled for";
 1347|    209|			break;
 1348|    205|		case NT_NETBSD_CMODEL:
  ------------------
  |  |  356|    205|#define NT_NETBSD_CMODEL	6
  ------------------
  |  Branch (1348:3): [True: 205, False: 1.41k]
  ------------------
 1349|    205|			flag = FLAGS_DID_NETBSD_CMODEL;
  ------------------
  |  |  357|    205|#define FLAGS_DID_NETBSD_CMODEL		0x0100
  ------------------
 1350|    205|			tag = "compiler model";
 1351|    205|			break;
 1352|    202|		case NT_NETBSD_EMULATION:
  ------------------
  |  |  286|    202|#define	NT_NETBSD_EMULATION	2
  ------------------
  |  Branch (1352:3): [True: 202, False: 1.41k]
  ------------------
 1353|    202|			flag = FLAGS_DID_NETBSD_EMULATION;
  ------------------
  |  |  358|    202|#define FLAGS_DID_NETBSD_EMULATION	0x0200
  ------------------
 1354|    202|			tag = "emulation:";
 1355|    202|			break;
 1356|    484|		default:
  ------------------
  |  Branch (1356:3): [True: 484, False: 1.13k]
  ------------------
 1357|    484|			if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  ------------------
  |  |  359|    484|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
  |  Branch (1357:8): [True: 407, False: 77]
  ------------------
 1358|    407|				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.61k|		}
 1364|       |
 1365|    616|		if (*flags & flag)
  ------------------
  |  Branch (1365:7): [True: 586, False: 30]
  ------------------
 1366|    586|			return offset;
 1367|     30|		str = RCAST(const char *, &nbuf[doff]);
  ------------------
  |  |  461|     30|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1368|     30|		descw = CAST(int, descsz);
  ------------------
  |  |  460|     30|#define CAST(T, b)	((T)(b))
  ------------------
 1369|     30|		*flags |= flag;
 1370|     30|		elf_printf(ms, ", %s: %s", tag,
 1371|     30|		    file_copystr(buf, sizeof(buf), descw, str));
 1372|     30|		return offset;
 1373|    616|	}
 1374|       |
 1375|  21.4k|	return offset;
 1376|  23.0k|}
readelf.c:do_os_note:
  615|  24.6k|{
  616|  24.6k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  24.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  617|       |
  618|  24.6k|	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |   67|  49.3k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.08k, False: 23.6k]
  |  |  |  Branch (67:29): [True: 485, False: 595]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "SuSE") && type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |  297|  25.1k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (618:34): [True: 238, False: 247]
  |  Branch (618:60): [True: 1, False: 237]
  ------------------
  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.6k|	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |   67|  49.3k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 14.6k, False: 10.0k]
  |  |  |  Branch (67:29): [True: 1.12k, False: 13.5k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "GNU") && type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |  297|  25.8k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (626:33): [True: 229, False: 891]
  |  Branch (626:59): [True: 15, False: 214]
  ------------------
  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.6k|	if (NAMEEQUALS(name, "NetBSD") &&
  ------------------
  |  |   67|  49.3k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 2.91k, False: 21.7k]
  |  |  |  Branch (67:29): [True: 1.63k, False: 1.28k]
  |  |  ------------------
  ------------------
  665|  1.63k|	    type == NT_NETBSD_VERSION && descsz == 4) {
  ------------------
  |  |  285|  26.3k|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (665:6): [True: 535, False: 1.10k]
  |  Branch (665:35): [True: 57, False: 478]
  ------------------
  666|     57|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     57|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  667|     57|		if (do_note_netbsd_version(ms, swap, &nbuf[doff]) == -1)
  ------------------
  |  Branch (667:7): [True: 0, False: 57]
  ------------------
  668|      0|			return -1;
  669|     57|		return 1;
  670|     57|	}
  671|       |
  672|  24.6k|	if (NAMEEQUALS(name, "FreeBSD") &&
  ------------------
  |  |   67|  49.2k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.45k, False: 23.1k]
  |  |  |  Branch (67:29): [True: 478, False: 973]
  |  |  ------------------
  ------------------
  673|    478|	    type == NT_FREEBSD_VERSION && descsz == 4) {
  ------------------
  |  |  287|  25.0k|#define	NT_FREEBSD_VERSION	1
  ------------------
  |  Branch (673:6): [True: 259, False: 219]
  |  Branch (673:36): [True: 56, False: 203]
  ------------------
  674|     56|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  352|     56|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  675|     56|		if (do_note_freebsd_version(ms, swap, &nbuf[doff])
  ------------------
  |  Branch (675:7): [True: 0, False: 56]
  ------------------
  676|     56|		    == -1)
  677|      0|			return -1;
  678|     56|		return 1;
  679|     56|	}
  680|       |
  681|  24.5k|	if (NAMEEQUALS(name, "OpenBSD") &&
  ------------------
  |  |   67|  49.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.39k, False: 23.1k]
  |  |  |  Branch (67:29): [True: 192, False: 1.20k]
  |  |  ------------------
  ------------------
  682|    192|	    type == NT_OPENBSD_VERSION && descsz == 4) {
  ------------------
  |  |  288|  24.7k|#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.5k|	if (NAMEEQUALS(name, "DragonFly") &&
  ------------------
  |  |   67|  49.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 584, False: 23.9k]
  |  |  |  Branch (67:29): [True: 341, False: 243]
  |  |  ------------------
  ------------------
  691|    341|	    type == NT_DRAGONFLY_VERSION && descsz == 4) {
  ------------------
  |  |  289|  24.9k|#define	NT_DRAGONFLY_VERSION	1
  ------------------
  |  Branch (691:6): [True: 70, False: 271]
  |  Branch (691:38): [True: 2, False: 68]
  ------------------
  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.5k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  49.1k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.39k, False: 23.1k]
  |  |  |  Branch (67:29): [True: 487, False: 907]
  |  |  ------------------
  ------------------
  705|    487|	    type == NT_ANDROID_VERSION && descsz >= 4) {
  ------------------
  |  |  377|  25.0k|#define NT_ANDROID_VERSION	1
  ------------------
  |  Branch (705:6): [True: 82, False: 405]
  |  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.5k|	return 0;
  726|  24.5k|}
readelf.c:do_note_netbsd_version:
  442|     57|{
  443|     57|	uint32_t desc;
  444|     57|	memcpy(&desc, v, sizeof(desc));
  445|     57|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     57|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  446|       |
  447|     57|	if (elf_printf(ms, ", for NetBSD") == -1)
  ------------------
  |  Branch (447:6): [True: 0, False: 57]
  ------------------
  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|     57|	if (desc > 100000000U) {
  ------------------
  |  Branch (461:6): [True: 54, False: 3]
  ------------------
  462|     54|		uint32_t ver_patch = (desc / 100) % 100;
  463|     54|		uint32_t ver_rel = (desc / 10000) % 100;
  464|     54|		uint32_t ver_min = (desc / 1000000) % 100;
  465|     54|		uint32_t ver_maj = desc / 100000000;
  466|       |
  467|     54|		if (elf_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
  ------------------
  |  Branch (467:7): [True: 0, False: 54]
  ------------------
  468|      0|			return -1;
  469|     54|		if (ver_maj >= 9) {
  ------------------
  |  Branch (469:7): [True: 27, False: 27]
  ------------------
  470|     27|			ver_patch += 100 * ver_rel;
  471|     27|			ver_rel = 0;
  472|     27|		}
  473|     54|		if (ver_rel == 0 && ver_patch != 0) {
  ------------------
  |  Branch (473:7): [True: 27, False: 27]
  |  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|     29|		} else if (ver_rel != 0) {
  ------------------
  |  Branch (476:14): [True: 27, False: 2]
  ------------------
  477|     81|			while (ver_rel > 26) {
  ------------------
  |  Branch (477:11): [True: 54, False: 27]
  ------------------
  478|     54|				if (elf_printf(ms, "Z") == -1)
  ------------------
  |  Branch (478:9): [True: 0, False: 54]
  ------------------
  479|      0|					return -1;
  480|     54|				ver_rel -= 26;
  481|     54|			}
  482|     27|			if (elf_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
  ------------------
  |  Branch (482:8): [True: 0, False: 27]
  ------------------
  483|      0|				return -1;
  484|     27|		}
  485|     54|	}
  486|     57|	return 0;
  487|     57|}
readelf.c:do_note_freebsd_version:
  491|     56|{
  492|     56|	uint32_t desc;
  493|       |
  494|     56|	memcpy(&desc, v, sizeof(desc));
  495|     56|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     56|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  496|     56|	if (elf_printf(ms, ", for FreeBSD") == -1)
  ------------------
  |  Branch (496:6): [True: 0, False: 56]
  ------------------
  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|     56|	if (desc == 460002) {
  ------------------
  |  Branch (525:6): [True: 1, False: 55]
  ------------------
  526|      1|		if (elf_printf(ms, " 4.6.2") == -1)
  ------------------
  |  Branch (526:7): [True: 0, False: 1]
  ------------------
  527|      0|			return -1;
  528|     55|	} else if (desc < 460100) {
  ------------------
  |  Branch (528:13): [True: 18, False: 37]
  ------------------
  529|     18|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (529:7): [True: 0, False: 18]
  ------------------
  530|     18|		    desc / 10000 % 10) == -1)
  531|      0|			return -1;
  532|     18|		if (desc / 1000 % 10 > 0)
  ------------------
  |  Branch (532:7): [True: 15, False: 3]
  ------------------
  533|     15|			if (elf_printf(ms, ".%d", desc / 1000 % 10) == -1)
  ------------------
  |  Branch (533:8): [True: 0, False: 15]
  ------------------
  534|      0|				return -1;
  535|     18|		if ((desc % 1000 > 0) || (desc % 100000 == 0))
  ------------------
  |  Branch (535:7): [True: 15, False: 3]
  |  Branch (535:28): [True: 1, False: 2]
  ------------------
  536|     16|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (536:8): [True: 0, False: 16]
  ------------------
  537|      0|				return -1;
  538|     37|	} else if (desc < 500000) {
  ------------------
  |  Branch (538:13): [True: 5, False: 32]
  ------------------
  539|      5|		if (elf_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (539:7): [True: 0, False: 5]
  ------------------
  540|      5|		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
  541|      0|			return -1;
  542|      5|		if (desc / 100 % 10 > 0) {
  ------------------
  |  Branch (542:7): [True: 3, False: 2]
  ------------------
  543|      3|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (543:8): [True: 0, False: 3]
  ------------------
  544|      0|				return -1;
  545|      3|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (545:14): [True: 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: 14, False: 18]
  ------------------
  554|     18|		    (desc % 100000 / 100 == 0)) {
  ------------------
  |  Branch (554:7): [True: 1, False: 17]
  ------------------
  555|     15|			if (elf_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (555:8): [True: 0, False: 15]
  ------------------
  556|      0|				return -1;
  557|     17|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (557:14): [True: 14, False: 3]
  ------------------
  558|     14|			if (elf_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (558:8): [True: 0, False: 14]
  ------------------
  559|      0|				return -1;
  560|     14|		}
  561|     32|	}
  562|     56|	return 0;
  563|     56|}
readelf.c:do_bid_note:
  570|  24.6k|{
  571|  24.6k|	if (NAMEEQUALS(RCAST(char *, &nbuf[noff]), "GNU") &&
  ------------------
  |  |   67|  49.2k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 14.5k, False: 10.0k]
  |  |  |  Branch (67:29): [True: 1.27k, False: 13.2k]
  |  |  ------------------
  ------------------
  572|  1.27k|	    type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
  ------------------
  |  |  319|  25.9k|#define	NT_GNU_BUILD_ID		3
  ------------------
  |  Branch (572:6): [True: 477, False: 797]
  |  Branch (572:34): [True: 411, False: 66]
  |  Branch (572:49): [True: 14, False: 397]
  ------------------
  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.6k|	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: 10.0k]
  |  Branch (599:21): [True: 1.87k, False: 12.6k]
  ------------------
  600|  1.87k|	    type == NT_GO_BUILD_ID && descsz < 128) {
  ------------------
  |  |  365|  26.5k|#define NT_GO_BUILD_ID	4
  ------------------
  |  Branch (600:6): [True: 1.37k, False: 499]
  |  Branch (600:32): [True: 1.13k, False: 242]
  ------------------
  601|  1.13k|		char buf[256];
  602|  1.13k|		if (elf_printf(ms, ", Go BuildID=%s",
  ------------------
  |  Branch (602:7): [True: 0, False: 1.13k]
  ------------------
  603|  1.13k|		    file_copystr(buf, sizeof(buf), descsz,
  604|  1.13k|		    RCAST(const char *, &nbuf[doff]))) == -1)
  ------------------
  |  |  461|  1.13k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  605|      0|			return -1;
  606|  1.13k|		return 1;
  607|  1.13k|	}
  608|  23.5k|	return 0;
  609|  24.6k|}
readelf.c:do_pax_note:
  732|  23.2k|{
  733|  23.2k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  23.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  734|       |
  735|  23.2k|	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |   67|  46.5k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 13.2k, False: 10.0k]
  |  |  |  Branch (67:29): [True: 1.46k, False: 11.7k]
  |  |  ------------------
  ------------------
              	if (NAMEEQUALS(name, "PaX") && type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |  330|  24.7k|#define NT_NETBSD_PAX		3
  ------------------
  |  Branch (735:33): [True: 445, False: 1.02k]
  |  Branch (735:58): [True: 52, False: 393]
  ------------------
  736|     52|		static const char *pax[] = {
  737|     52|		    "+mprotect",
  738|     52|		    "-mprotect",
  739|     52|		    "+segvguard",
  740|     52|		    "-segvguard",
  741|     52|		    "+ASLR",
  742|     52|		    "-ASLR",
  743|     52|		};
  744|     52|		uint32_t desc;
  745|     52|		size_t i;
  746|     52|		int did = 0;
  747|       |
  748|     52|		*flags |= FLAGS_DID_NETBSD_PAX;
  ------------------
  |  |  355|     52|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  749|     52|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  750|     52|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     52|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  751|       |
  752|     52|		if (desc && elf_printf(ms, ", PaX: ") == -1)
  ------------------
  |  Branch (752:7): [True: 51, False: 1]
  |  Branch (752:15): [True: 0, False: 51]
  ------------------
  753|      0|			return -1;
  754|       |
  755|    364|		for (i = 0; i < __arraycount(pax); i++) {
  ------------------
  |  |  138|    364|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (755:15): [True: 312, False: 52]
  ------------------
  756|    312|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  460|    312|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (756:8): [True: 211, False: 101]
  ------------------
  757|    211|				continue;
  758|    101|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (758:8): [True: 0, False: 101]
  |  Branch (758:31): [True: 67, False: 34]
  ------------------
  759|    101|			    pax[i]) == -1)
  760|      0|				return -1;
  761|    101|		}
  762|     52|		return 1;
  763|     52|	}
  764|  23.2k|	return 0;
  765|  23.2k|}
readelf.c:do_memtag_note:
  771|  23.6k|{
  772|  23.6k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  23.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  773|       |
  774|  23.6k|	if (NAMEEQUALS(name, "Android") &&
  ------------------
  |  |   67|  47.3k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.36k, False: 22.3k]
  |  |  |  Branch (67:29): [True: 456, False: 910]
  |  |  ------------------
  ------------------
  775|    456|	    type == NT_ANDROID_MEMTAG && descsz == 4) {
  ------------------
  |  |  389|  24.1k|#define NT_ANDROID_MEMTAG	4
  ------------------
  |  Branch (775:6): [True: 128, False: 328]
  |  Branch (775:35): [True: 60, False: 68]
  ------------------
  776|     60|		static const char *memtag[] = {
  777|     60|		    "none",
  778|     60|		    "async",
  779|     60|		    "sync",
  780|     60|		    "heap",
  781|     60|		    "stack",
  782|     60|		};
  783|     60|		uint32_t desc;
  784|     60|		size_t i;
  785|     60|		int did = 0;
  786|       |
  787|     60|		*flags |= FLAGS_DID_ANDROID_MEMTAG;
  ------------------
  |  |  360|     60|#define FLAGS_DID_ANDROID_MEMTAG	0x0800
  ------------------
  788|     60|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  789|     60|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  158|     60|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  790|       |
  791|     60|		if (desc && elf_printf(ms, ", Android Memtag: ") == -1)
  ------------------
  |  Branch (791:7): [True: 59, False: 1]
  |  Branch (791:15): [True: 0, False: 59]
  ------------------
  792|      0|			return -1;
  793|       |
  794|    360|		for (i = 0; i < __arraycount(memtag); i++) {
  ------------------
  |  |  138|    360|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (794:15): [True: 300, False: 60]
  ------------------
  795|    300|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  460|    300|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (795:8): [True: 172, False: 128]
  ------------------
  796|    172|				continue;
  797|    128|			if (elf_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (797:8): [True: 0, False: 128]
  |  Branch (797:31): [True: 75, False: 53]
  ------------------
  798|    128|			    memtag[i]) == -1)
  799|      0|				return -1;
  800|    128|		}
  801|     60|		return 1;
  802|     60|	}
  803|  23.6k|	return 0;
  804|  23.6k|}
readelf.c:do_core_note:
  810|  23.0k|{
  811|  23.0k|#ifdef ELFCORE
  812|  23.0k|	char buf[256];
  813|  23.0k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  461|  23.0k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  814|       |
  815|  23.0k|	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|  23.0k|	if ((namesz == 4 && memcmp(name, "CORE", 4) == 0) ||
  ------------------
  |  Branch (830:7): [True: 13.0k, False: 9.99k]
  |  Branch (830:22): [True: 1.69k, False: 11.3k]
  ------------------
  831|  21.3k|	    NAMEEQUALS(name, "CORE")) {
  ------------------
  |  |   67|  21.3k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.07k, False: 20.2k]
  |  |  |  Branch (67:29): [True: 216, False: 863]
  |  |  ------------------
  ------------------
  832|  1.91k|		os_style = OS_STYLE_SVR4;
  ------------------
  |  |  339|  1.91k|#define	OS_STYLE_SVR4		0
  ------------------
  833|  1.91k|	}
  834|       |
  835|  23.0k|	if (NAMEEQUALS(name, "FreeBSD")) {
  ------------------
  |  |   67|  23.0k|    (namesz == sizeof(v) && memcmp(n, v, namesz) == 0)
  |  |  ------------------
  |  |  |  Branch (67:6): [True: 1.32k, False: 21.7k]
  |  |  |  Branch (67:29): [True: 421, False: 901]
  |  |  ------------------
  ------------------
  836|    421|		os_style = OS_STYLE_FREEBSD;
  ------------------
  |  |  340|    421|#define	OS_STYLE_FREEBSD	1
  ------------------
  837|    421|	}
  838|       |
  839|  23.0k|	if ((namesz >= 11 && memcmp(name, "NetBSD-CORE", 11) == 0)) {
  ------------------
  |  Branch (839:7): [True: 1.31k, False: 21.7k]
  |  Branch (839:23): [True: 519, False: 798]
  ------------------
  840|    519|		os_style = OS_STYLE_NETBSD;
  ------------------
  |  |  341|    519|#define	OS_STYLE_NETBSD		2
  ------------------
  841|    519|	}
  842|       |
  843|  23.0k|	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
  ------------------
  |  |  354|  2.85k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (843:6): [True: 2.85k, False: 20.1k]
  |  Branch (843:24): [True: 952, False: 1.90k]
  ------------------
  844|    952|		if (elf_printf(ms, ", %s-style", os_style_names[os_style])
  ------------------
  |  Branch (844:7): [True: 0, False: 952]
  ------------------
  845|    952|		    == -1)
  846|      0|			return -1;
  847|    952|		*flags |= FLAGS_DID_CORE_STYLE;
  ------------------
  |  |  354|    952|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  848|    952|		*flags |= os_style;
  849|    952|	}
  850|       |
  851|  23.0k|	switch (os_style) {
  852|    519|	case OS_STYLE_NETBSD:
  ------------------
  |  |  341|    519|#define	OS_STYLE_NETBSD		2
  ------------------
  |  Branch (852:2): [True: 519, False: 22.5k]
  ------------------
  853|    519|		if (type == NT_NETBSD_CORE_PROCINFO) {
  ------------------
  |  |  232|    519|#define	NT_NETBSD_CORE_PROCINFO		1
  ------------------
  |  Branch (853:7): [True: 3, False: 516]
  ------------------
  854|      3|			char sbuf[512];
  855|      3|			struct NetBSD_elfcore_procinfo pi;
  856|      3|			memset(&pi, 0, sizeof(pi));
  857|      3|			memcpy(&pi, nbuf + doff, MIN(descsz, sizeof(pi)));
  ------------------
  |  Branch (857:29): [True: 2, False: 1]
  ------------------
  858|       |
  859|      3|			if (elf_printf(ms, ", from '%.31s', pid=%u, uid=%u, "
  ------------------
  |  Branch (859:8): [True: 0, False: 3]
  ------------------
  860|      3|			    "gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",
  861|      3|			    file_printable(ms, sbuf, sizeof(sbuf),
  862|      3|			    RCAST(char *, pi.cpi_name), sizeof(pi.cpi_name)),
  ------------------
  |  |  461|      3|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  863|      3|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_pid)),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  864|      3|			    elf_getu32(swap, pi.cpi_euid),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  865|      3|			    elf_getu32(swap, pi.cpi_egid),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  866|      3|			    elf_getu32(swap, pi.cpi_nlwps),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  867|      3|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_siglwp)),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  868|      3|			    elf_getu32(swap, pi.cpi_signo),
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  869|      3|			    elf_getu32(swap, pi.cpi_sigcode)) == -1)
  ------------------
  |  |  158|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  870|      0|				return -1;
  871|       |
  872|      3|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|      3|#define FLAGS_DID_CORE			0x0004
  ------------------
  873|      3|			return 1;
  874|      3|		}
  875|    516|		break;
  876|       |
  877|    516|	case OS_STYLE_FREEBSD:
  ------------------
  |  |  340|    421|#define	OS_STYLE_FREEBSD	1
  ------------------
  |  Branch (877:2): [True: 421, False: 22.6k]
  ------------------
  878|    421|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|    842|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|     99|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (878:7): [True: 99, False: 322]
  |  Branch (878:30): [True: 30, False: 69]
  ------------------
  879|     30|			size_t argoff, pidoff;
  880|       |
  881|     30|			if (clazz == ELFCLASS32)
  ------------------
  |  |  153|     30|#define	ELFCLASS32	1
  ------------------
  |  Branch (881:8): [True: 28, False: 2]
  ------------------
  882|     28|				argoff = 4 + 4 + 17;
  883|      2|			else
  884|      2|				argoff = 4 + 4 + 8 + 17;
  885|     30|			if (doff + argoff + 81 <= size) {
  ------------------
  |  Branch (885:8): [True: 10, False: 20]
  ------------------
  886|     10|				if (elf_printf(ms, ", from '%.80s'",
  ------------------
  |  Branch (886:9): [True: 0, False: 10]
  ------------------
  887|     10|				    nbuf + doff + argoff) == -1)
  888|      0|					return -1;
  889|     10|			}
  890|     30|			pidoff = argoff + 81 + 2;
  891|     30|			if (doff + pidoff + 4 <= size) {
  ------------------
  |  Branch (891:8): [True: 7, False: 23]
  ------------------
  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|     30|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     30|#define FLAGS_DID_CORE			0x0004
  ------------------
  898|     30|		}			    
  899|    421|		break;
  900|       |
  901|  22.0k|	default:
  ------------------
  |  Branch (901:2): [True: 22.0k, False: 940]
  ------------------
  902|  22.0k|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|  44.1k|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  361|  2.49k|#define FLAGS_IS_CORE			0x1000
  ------------------
  |  Branch (902:7): [True: 2.49k, False: 19.5k]
  |  Branch (902:30): [True: 2.03k, False: 454]
  ------------------
  903|  2.03k|			size_t i, j;
  904|  2.03k|			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.7k|			for (i = 0; i < NOFFSETS; i++) {
  ------------------
  |  |  308|  15.7k|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|  15.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|  14.8k|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  14.8k|#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.8k, False: 856]
  |  |  ------------------
  ------------------
  |  Branch (915:16): [True: 13.7k, False: 1.95k]
  ------------------
  916|  13.7k|				unsigned char *cname, *cp;
  917|  13.7k|				size_t reloffset = prpsoffsets(i);
  ------------------
  |  |  263|  13.7k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  13.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 13.0k, False: 715]
  |  |  ------------------
  |  |  264|  13.7k|			 ? prpsoffsets32[i]			\
  |  |  265|  13.7k|			 : prpsoffsets64[i])
  ------------------
  918|  13.7k|				size_t noffset = doff + reloffset;
  919|  13.7k|				size_t k;
  920|  14.9k|				for (j = 0; j < 16; j++, noffset++,
  ------------------
  |  Branch (920:17): [True: 14.9k, False: 12]
  ------------------
  921|  14.9k|				    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.9k|					if (noffset >= size)
  ------------------
  |  Branch (927:10): [True: 2.79k, False: 12.1k]
  ------------------
  928|  2.79k|						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|  12.1k|					if (reloffset >= descsz)
  ------------------
  |  Branch (936:10): [True: 8.03k, False: 4.14k]
  ------------------
  937|  8.03k|						goto tryanother;
  938|       |
  939|  4.14k|					c = nbuf[noffset];
  940|  4.14k|					if (c == '\0') {
  ------------------
  |  Branch (940:10): [True: 963, False: 3.18k]
  ------------------
  941|       |						/*
  942|       |						 * A '\0' at the
  943|       |						 * beginning is
  944|       |						 * obviously wrong.
  945|       |						 * Any other '\0'
  946|       |						 * means we're done.
  947|       |						 */
  948|    963|						if (j == 0)
  ------------------
  |  Branch (948:11): [True: 895, False: 68]
  ------------------
  949|    895|							goto tryanother;
  950|     68|						else
  951|     68|							break;
  952|  3.18k|					} else {
  953|       |						/*
  954|       |						 * A nonprintable
  955|       |						 * character is also
  956|       |						 * wrong.
  957|       |						 */
  958|  3.18k|						if (!isprint(c) || isquote(c))
  ------------------
  |  |   58|  1.65k|#define isquote(c) (strchr("'\"`", (c)) != NULL)
  |  |  ------------------
  |  |  |  Branch (58:20): [True: 454, False: 1.20k]
  |  |  ------------------
  ------------------
  |  Branch (958:11): [True: 1.52k, False: 1.65k]
  ------------------
  959|  1.98k|							goto tryanother;
  960|  3.18k|					}
  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|    266|				for (k = i + 1 ; k < NOFFSETS; k++) {
  ------------------
  |  |  308|    266|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|    266|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  305|    252|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    252|#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: 252, False: 14]
  |  |  ------------------
  ------------------
  |  Branch (970:22): [True: 186, False: 80]
  ------------------
  971|    186|					size_t no;
  972|    186|					int adjust = 1;
  973|    186|					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    186|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    186|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 176, False: 10]
  |  |  ------------------
  |  |  264|    186|			 ? prpsoffsets32[i]			\
  |  |  265|    186|			 : prpsoffsets64[i])
  ------------------
              					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  263|    186|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    186|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 176, False: 10]
  |  |  ------------------
  |  |  264|    186|			 ? prpsoffsets32[i]			\
  |  |  265|    186|			 : prpsoffsets64[i])
  ------------------
  |  Branch (973:10): [True: 51, False: 135]
  ------------------
  974|     51|						continue;
  975|       |					/*
  976|       |					 * pr_fname == pr_psargs - 16 &&
  977|       |					 * non-nul-terminated fname (qemu)
  978|       |					 */
  979|    135|					if (prpsoffsets(k) ==
  ------------------
  |  |  263|    135|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    135|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 125, False: 10]
  |  |  ------------------
  |  |  264|    135|			 ? prpsoffsets32[i]			\
  |  |  265|    135|			 : prpsoffsets64[i])
  ------------------
  |  Branch (979:10): [True: 30, False: 105]
  ------------------
  980|    135|					    prpsoffsets(i) - 16 && j == 16)
  ------------------
  |  |  263|    135|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    135|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 125, False: 10]
  |  |  ------------------
  |  |  264|    135|			 ? prpsoffsets32[i]			\
  |  |  265|    135|			 : prpsoffsets64[i])
  ------------------
  |  Branch (980:33): [True: 7, False: 23]
  ------------------
  981|      7|						continue;
  982|    128|					for (no = doff + prpsoffsets(k);
  ------------------
  |  |  263|    128|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    128|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 118, False: 10]
  |  |  ------------------
  |  |  264|    128|			 ? prpsoffsets32[i]			\
  |  |  265|    128|			 : prpsoffsets64[i])
  ------------------
  983|  4.56k|					     no < doff + prpsoffsets(i); no++)
  ------------------
  |  |  263|  4.56k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  4.56k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (263:25): [True: 3.96k, False: 602]
  |  |  ------------------
  |  |  264|  4.56k|			 ? prpsoffsets32[i]			\
  |  |  265|  4.56k|			 : prpsoffsets64[i])
  ------------------
  |  Branch (983:11): [True: 4.43k, False: 128]
  ------------------
  984|  4.43k|						adjust = adjust
  ------------------
  |  Branch (984:16): [True: 1.05k, False: 3.38k]
  ------------------
  985|  4.43k|						         && isprint(nbuf[no]);
  ------------------
  |  Branch (985:19): [True: 946, False: 106]
  ------------------
  986|    128|					if (adjust)
  ------------------
  |  Branch (986:10): [True: 22, False: 106]
  ------------------
  987|     22|						i = k;
  988|    128|				}
  989|       |
  990|     80|				cname = CAST(unsigned char *,
  ------------------
  |  |  460|    160|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 76, False: 4]
  |  |  ------------------
  ------------------
  991|     80|				    &nbuf[doff + prpsoffsets(i)]);
  992|  1.46k|				for (cp = cname; cp < nbuf + size && *cp
  ------------------
  |  Branch (992:22): [True: 1.46k, False: 8]
  |  Branch (992:42): [True: 1.38k, False: 71]
  ------------------
  993|  1.46k|				    && isprint(*cp); cp++)
  ------------------
  |  Branch (993:12): [True: 1.38k, False: 1]
  ------------------
  994|  1.38k|					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: 421, False: 12]
  |  Branch (999:26): [True: 353, False: 68]
  ------------------
 1000|    353|					cp--;
 1001|     80|				if (elf_printf(ms, ", from '%s'",
  ------------------
  |  Branch (1001:9): [True: 0, False: 80]
  ------------------
 1002|     80|				    file_copystr(buf, sizeof(buf),
 1003|     80|				    CAST(size_t, cp - cname),
  ------------------
  |  |  460|     80|#define CAST(T, b)	((T)(b))
  ------------------
 1004|     80|				    RCAST(char *, cname))) == -1)
  ------------------
  |  |  461|     80|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1005|      0|					return -1;
 1006|     80|				*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  351|     80|#define FLAGS_DID_CORE			0x0004
  ------------------
 1007|     80|				return 1;
 1008|       |
 1009|  13.7k|			tryanother:
 1010|  13.7k|				;
 1011|  13.7k|			}
 1012|  2.03k|		}
 1013|  22.0k|		break;
 1014|  23.0k|	}
 1015|  22.9k|#endif
 1016|  22.9k|	return 0;
 1017|  23.0k|}
readelf.c:do_auxv_note:
 1094|  23.2k|{
 1095|  23.2k|#ifdef ELFCORE
 1096|  23.2k|	Aux32Info auxv32;
 1097|  23.2k|	Aux64Info auxv64;
 1098|  23.2k|	size_t elsize = xauxv_sizeof;
  ------------------
  |  |  253|  23.2k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 19.5k, False: 3.68k]
  |  |  ------------------
  |  |  254|  23.2k|			 ? sizeof(auxv32)			\
  |  |  255|  23.2k|			 : sizeof(auxv64))
  ------------------
 1099|  23.2k|	const char *tag;
 1100|  23.2k|	int is_string;
 1101|  23.2k|	size_t nval, off;
 1102|       |
 1103|  23.2k|	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  361|  23.2k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  354|  23.2k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (1103:6): [True: 18.8k, False: 4.47k]
  ------------------
 1104|  23.2k|	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  361|  23.2k|#define FLAGS_IS_CORE			0x1000
  ------------------
              	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  354|  23.2k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
 1105|  18.8k|		return 0;
 1106|       |
 1107|  4.47k|	switch (*flags & FLAGS_CORE_STYLE) {
  ------------------
  |  |  349|  4.47k|#define FLAGS_CORE_STYLE		0x0003
  ------------------
 1108|  2.52k|	case OS_STYLE_SVR4:
  ------------------
  |  |  339|  2.52k|#define	OS_STYLE_SVR4		0
  ------------------
  |  Branch (1108:2): [True: 2.52k, False: 1.94k]
  ------------------
 1109|  2.52k|		if (type != NT_AUXV)
  ------------------
  |  |  281|  2.52k|#define	NT_AUXV		6
  ------------------
  |  Branch (1109:7): [True: 1.79k, False: 734]
  ------------------
 1110|  1.79k|			return 0;
 1111|    734|		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.94k|	default:
  ------------------
  |  Branch (1122:2): [True: 1.94k, False: 2.52k]
  ------------------
 1123|  1.94k|		return 0;
 1124|  4.47k|	}
 1125|       |
 1126|    734|	*flags |= FLAGS_DID_AUXV;
  ------------------
  |  |  362|    734|#define FLAGS_DID_AUXV			0x2000
  ------------------
 1127|       |
 1128|    734|	nval = 0;
 1129|  6.66k|	for (off = 0; off + elsize <= descsz; off += elsize) {
  ------------------
  |  Branch (1129:16): [True: 5.94k, False: 718]
  ------------------
 1130|  5.94k|		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  250|  5.94k|#define xauxv_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.94k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (250:21): [True: 3.13k, False: 2.81k]
  |  |  ------------------
  |  |  251|  5.94k|			 ? CAST(void *, &auxv32)		\
  |  |  ------------------
  |  |  |  |  460|  3.13k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  252|  5.94k|			 : CAST(void *, &auxv64))
  |  |  ------------------
  |  |  |  |  460|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  253|  5.94k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.94k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (253:23): [True: 3.13k, False: 2.81k]
  |  |  ------------------
  |  |  254|  5.94k|			 ? sizeof(auxv32)			\
  |  |  255|  5.94k|			 : sizeof(auxv64))
  ------------------
 1131|       |		/* Limit processing to 50 vector entries to prevent DoS */
 1132|  5.94k|		if (nval++ >= 50) {
  ------------------
  |  Branch (1132:7): [True: 16, False: 5.93k]
  ------------------
 1133|     16|			file_error(ms, 0, "Too many ELF Auxv elements");
 1134|     16|			return 1;
 1135|     16|		}
 1136|       |
 1137|  5.93k|		switch(xauxv_type) {
  ------------------
  |  |  256|  5.93k|#define xauxv_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  5.93k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (256:21): [True: 3.12k, False: 2.80k]
  |  |  ------------------
  |  |  257|  5.93k|			 ? elf_getu32(swap, auxv32.a_type)	\
  |  |  ------------------
  |  |  |  |  158|  3.12k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  258|  5.93k|			 : elf_getu64(swap, auxv64.a_type))
  |  |  ------------------
  |  |  |  |  159|  2.80k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1138|    964|		case AT_LINUX_EXECFN:
  ------------------
  |  |   90|    964|#define AT_LINUX_EXECFN 31   /* filename of program */
  ------------------
  |  Branch (1138:3): [True: 964, False: 4.96k]
  ------------------
 1139|    964|			is_string = 1;
 1140|    964|			tag = "execfn";
 1141|    964|			break;
 1142|  1.02k|		case AT_LINUX_PLATFORM:
  ------------------
  |  |   81|  1.02k|#define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
  ------------------
  |  Branch (1142:3): [True: 1.02k, False: 4.90k]
  ------------------
 1143|  1.02k|			is_string = 1;
 1144|  1.02k|			tag = "platform";
 1145|  1.02k|			break;
 1146|     45|		case AT_LINUX_UID:
  ------------------
  |  |   77|     45|#define AT_LINUX_UID    11    /* real uid */
  ------------------
  |  Branch (1146:3): [True: 45, False: 5.88k]
  ------------------
 1147|     45|			is_string = 0;
 1148|     45|			tag = "real uid";
 1149|     45|			break;
 1150|     53|		case AT_LINUX_GID:
  ------------------
  |  |   79|     53|#define AT_LINUX_GID    13    /* real gid */
  ------------------
  |  Branch (1150:3): [True: 53, False: 5.87k]
  ------------------
 1151|     53|			is_string = 0;
 1152|     53|			tag = "real gid";
 1153|     53|			break;
 1154|     62|		case AT_LINUX_EUID:
  ------------------
  |  |   78|     62|#define AT_LINUX_EUID   12    /* effective uid */
  ------------------
  |  Branch (1154:3): [True: 62, False: 5.86k]
  ------------------
 1155|     62|			is_string = 0;
 1156|     62|			tag = "effective uid";
 1157|     62|			break;
 1158|     71|		case AT_LINUX_EGID:
  ------------------
  |  |   80|     71|#define AT_LINUX_EGID   14    /* effective gid */
  ------------------
  |  Branch (1158:3): [True: 71, False: 5.86k]
  ------------------
 1159|     71|			is_string = 0;
 1160|     71|			tag = "effective gid";
 1161|     71|			break;
 1162|  3.71k|		default:
  ------------------
  |  Branch (1162:3): [True: 3.71k, False: 2.21k]
  ------------------
 1163|  3.71k|			is_string = 0;
 1164|  3.71k|			tag = NULL;
 1165|  3.71k|			break;
 1166|  5.93k|		}
 1167|       |
 1168|  5.93k|		if (tag == NULL)
  ------------------
  |  Branch (1168:7): [True: 3.71k, False: 2.21k]
  ------------------
 1169|  3.71k|			continue;
 1170|       |
 1171|  2.21k|		if (is_string) {
  ------------------
  |  Branch (1171:7): [True: 1.98k, False: 231]
  ------------------
 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.20k, False: 783]
  |  |  ------------------
  |  |  260|  1.98k|			 ? elf_getu32(swap, auxv32.a_v)		\
  |  |  ------------------
  |  |  |  |  158|  1.20k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  261|  1.98k|			 : elf_getu64(swap, auxv64.a_v))
  |  |  ------------------
  |  |  |  |  159|    783|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1176|       |
 1177|  1.98k|			if (buflen == 0)
  ------------------
  |  Branch (1177:8): [True: 1.90k, False: 80]
  ------------------
 1178|  1.90k|				continue;
 1179|       |
 1180|     80|			if (elf_printf(ms, ", %s: '%s'", tag, buf) == -1)
  ------------------
  |  Branch (1180:8): [True: 0, False: 80]
  ------------------
 1181|      0|				return -1;
 1182|    231|		} else {
 1183|    231|			if (elf_printf(ms, ", %s: %d", tag,
  ------------------
  |  Branch (1183:8): [True: 0, False: 231]
  ------------------
 1184|    231|			    CAST(int, xauxv_val)) == -1)
  ------------------
  |  |  460|    462|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 201, False: 30]
  |  |  ------------------
  ------------------
 1185|      0|				return -1;
 1186|    231|		}
 1187|  2.21k|	}
 1188|    718|	return 1;
 1189|       |#else
 1190|       |	return 0;
 1191|       |#endif
 1192|    734|}
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: 152, False: 1.83k]
  ------------------
 1067|  1.83k|	    (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
  ------------------
  |  |  460|  1.83k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1067:6): [True: 689, False: 1.14k]
  ------------------
 1068|    841|		(void)elf_printf(ms, ", can't read elf string at %jd",
 1069|    841|		    (intmax_t)offset);
 1070|    841|		return 0;
 1071|    841|	}
 1072|       |
 1073|  1.14k|	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.68k|	for (bptr = buf; *bptr && isprint(CAST(unsigned char, *bptr)); bptr++)
  ------------------
  |  Branch (1077:19): [True: 8.48k, False: 196]
  |  Branch (1077:28): [True: 7.53k, False: 950]
  ------------------
 1078|  7.53k|		continue;
 1079|  1.14k|	if (*bptr != '\0')
  ------------------
  |  Branch (1079:6): [True: 950, False: 196]
  ------------------
 1080|    950|		return 0;
 1081|       |
 1082|    196|	return bptr - buf;
 1083|  1.14k|}
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|  21.6k|	for ( ; num; num--) {
  ------------------
  |  Branch (1030:10): [True: 21.5k, False: 137]
  ------------------
 1031|  21.5k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  21.5k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 13.1k, False: 8.35k]
  |  |  ------------------
  |  |  181|  21.5k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  460|  13.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  21.5k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  460|  8.35k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  21.5k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  21.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 13.1k, False: 8.35k]
  |  |  ------------------
  |  |  184|  21.5k|			 ? sizeof(ph32)				\
  |  |  185|  21.5k|			 : sizeof(ph64))
  ------------------
  |  Branch (1031:7): [True: 795, False: 20.7k]
  ------------------
 1032|  21.5k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  460|  43.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 13.1k, False: 8.35k]
  |  |  ------------------
  ------------------
 1033|    795|			if (elf_printf(ms,
  ------------------
  |  Branch (1033:8): [True: 0, False: 795]
  ------------------
 1034|    795|			    ", can't read elf program header at %jd",
 1035|    795|			    (intmax_t)off) == -1)
 1036|      0|				return -1;
 1037|    795|			return 0;
 1038|       |
 1039|    795|		}
 1040|  20.7k|		off += xph_sizeof;
  ------------------
  |  |  183|  20.7k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  20.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 12.6k, False: 8.06k]
  |  |  ------------------
  |  |  184|  20.7k|			 ? sizeof(ph32)				\
  |  |  185|  20.7k|			 : sizeof(ph64))
  ------------------
 1041|       |
 1042|  20.7k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  20.7k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  41.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  20.7k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  41.5k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 12.6k, False: 8.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  20.7k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  20.7k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1042:7): [True: 20.7k, False: 0]
  |  Branch (1042:32): [True: 12.2k, False: 8.47k]
  ------------------
 1043|       |			/* Perhaps warn here */
 1044|  12.2k|			continue;
 1045|  12.2k|		}
 1046|       |
 1047|  8.47k|		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  8.47k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  33.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 3.06k, False: 691]
  |  |  |  |  |  Branch (460:25): [True: 4.31k, False: 405]
  |  |  |  |  |  Branch (460:25): [True: 3.76k, False: 4.71k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  8.47k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  8.47k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  8.47k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  8.47k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  197|  5.24k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  20.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 2.05k, False: 691]
  |  |  |  |  |  Branch (460:25): [True: 2.10k, False: 402]
  |  |  |  |  |  Branch (460:25): [True: 2.74k, False: 2.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  5.24k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  5.24k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  5.24k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  5.24k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  202|  5.24k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  10.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 2.74k, False: 2.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1047:7): [True: 5.24k, False: 3.22k]
  |  Branch (1047:32): [True: 1.05k, False: 4.19k]
  ------------------
 1048|  1.05k|			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  189|  1.05k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  2.11k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 614, False: 441]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  1.05k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  1.05k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
              			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  197|  1.05k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  4.22k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 445, False: 169]
  |  |  |  |  |  Branch (460:25): [True: 332, False: 109]
  |  |  |  |  |  Branch (460:25): [True: 614, False: 441]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  198|  1.05k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  199|  1.05k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  200|  1.05k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  201|  1.05k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
 1049|  8.47k|	}
 1050|    137|	return 0;
 1051|  1.98k|}
readelf.c:getu32:
  113|   660k|{
  114|   660k|	union {
  115|   660k|		uint32_t ui;
  116|   660k|		char c[4];
  117|   660k|	} retval, tmpval;
  118|       |
  119|   660k|	if (swap) {
  ------------------
  |  Branch (119:6): [True: 152k, False: 508k]
  ------------------
  120|   152k|		tmpval.ui = value;
  121|       |
  122|   152k|		retval.c[0] = tmpval.c[3];
  123|   152k|		retval.c[1] = tmpval.c[2];
  124|   152k|		retval.c[2] = tmpval.c[1];
  125|   152k|		retval.c[3] = tmpval.c[0];
  126|       |
  127|   152k|		return retval.ui;
  128|   152k|	} else
  129|   508k|		return value;
  130|   660k|}
readelf.c:dophn_exec:
 1740|  2.00k|{
 1741|  2.00k|	Elf32_Phdr ph32;
 1742|  2.00k|	Elf64_Phdr ph64;
 1743|  2.00k|	const char *str;
 1744|  2.00k|	unsigned char nbuf[NBUFSIZE];
 1745|  2.00k|	char interp[NBUFSIZE];
 1746|  2.00k|	ssize_t bufsize;
 1747|  2.00k|	size_t offset, align, need = 0;
 1748|  2.00k|	int pie = 0, dynamic = 0;
 1749|       |
 1750|  2.00k|	if (num == 0) {
  ------------------
  |  Branch (1750:6): [True: 602, False: 1.40k]
  ------------------
 1751|    602|		if (elf_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (1751:7): [True: 0, False: 602]
  ------------------
 1752|      0|			return -1;
 1753|    602|		return 0;
 1754|    602|	}
 1755|  1.40k|	if (size != xph_sizeof) {
  ------------------
  |  |  183|  1.40k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.40k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 806, False: 598]
  |  |  ------------------
  |  |  184|  1.40k|			 ? sizeof(ph32)				\
  |  |  185|  1.40k|			 : sizeof(ph64))
  ------------------
  |  Branch (1755:6): [True: 429, False: 975]
  ------------------
 1756|    429|		if (elf_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (1756:7): [True: 0, False: 429]
  ------------------
 1757|      0|			return -1;
 1758|    429|		return 0;
 1759|    429|	}
 1760|       |
 1761|    975|	interp[0] = '\0';
 1762|  32.1k|  	for ( ; num; num--) {
  ------------------
  |  Branch (1762:12): [True: 32.0k, False: 63]
  ------------------
 1763|  32.0k|		int doread;
 1764|  32.0k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  180|  32.0k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (180:19): [True: 25.3k, False: 6.68k]
  |  |  ------------------
  |  |  181|  32.0k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  460|  25.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  182|  32.0k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  460|  6.68k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  183|  32.0k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (183:21): [True: 25.3k, False: 6.68k]
  |  |  ------------------
  |  |  184|  32.0k|			 ? sizeof(ph32)				\
  |  |  185|  32.0k|			 : sizeof(ph64))
  ------------------
  |  Branch (1764:7): [True: 894, False: 31.1k]
  ------------------
 1765|  32.0k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  460|  64.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 25.3k, False: 6.68k]
  |  |  ------------------
  ------------------
 1766|    894|			if (elf_printf(ms,
  ------------------
  |  Branch (1766:8): [True: 0, False: 894]
  ------------------
 1767|    894|			    ", can't read elf program headers at %jd",
 1768|    894|			    (intmax_t)off) == -1)
 1769|      0|				return -1;
 1770|    894|			return 0;
 1771|    894|		}
 1772|       |
 1773|  31.1k|		off += size;
 1774|  31.1k|		bufsize = 0;
 1775|  31.1k|		align = 4;
 1776|       |
 1777|       |		/* Things we can determine before we seek */
 1778|  31.1k|		switch (xph_type) {
  ------------------
  |  |  186|  31.1k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  31.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 24.8k, False: 6.29k]
  |  |  ------------------
  |  |  187|  31.1k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  24.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  31.1k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  6.29k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1779|  2.15k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  2.15k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1779:3): [True: 2.15k, False: 28.9k]
  ------------------
 1780|  2.15k|			doread = 1;
 1781|  2.15k|			break;
 1782|  4.70k|		case PT_NOTE:
  ------------------
  |  |  201|  4.70k|#define	PT_NOTE		4
  ------------------
  |  Branch (1782:3): [True: 4.70k, False: 26.4k]
  ------------------
 1783|  4.70k|			if (sh_num)	/* Did this through section headers */
  ------------------
  |  Branch (1783:8): [True: 416, False: 4.28k]
  ------------------
 1784|    416|				continue;
 1785|  4.28k|			if (((align = xph_align) & 0x80000000UL) != 0 ||
  ------------------
  |  |  192|  4.28k|#define xph_align	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  17.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.31k, False: 1.20k]
  |  |  |  |  |  Branch (460:25): [True: 1.34k, False: 420]
  |  |  |  |  |  Branch (460:25): [True: 2.51k, False: 1.76k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|  4.28k|			 ? CAST(off_t, (ph32.p_align ? 		\
  |  |  194|  4.28k|			    elf_getu32(swap, ph32.p_align) : 4))\
  |  |  195|  4.28k|			 : CAST(off_t, (ph64.p_align ?		\
  |  |  196|  4.28k|			    elf_getu64(swap, ph64.p_align) : 4))))
  ------------------
  |  Branch (1785:8): [True: 366, False: 3.92k]
  ------------------
 1786|  3.92k|			    align < 4) {
  ------------------
  |  Branch (1786:8): [True: 530, False: 3.39k]
  ------------------
 1787|    896|				if (elf_printf(ms,
  ------------------
  |  Branch (1787:9): [True: 0, False: 896]
  ------------------
 1788|    896|				    ", invalid note alignment %#lx",
 1789|    896|				    CAST(unsigned long, align)) == -1)
  ------------------
  |  |  460|    896|#define CAST(T, b)	((T)(b))
  ------------------
 1790|      0|					return -1;
 1791|    896|				align = 4;
 1792|    896|			}
 1793|       |			/*FALLTHROUGH*/
 1794|  5.40k|		case PT_INTERP:
  ------------------
  |  |  200|  5.40k|#define	PT_INTERP	3
  ------------------
  |  Branch (1794:3): [True: 1.11k, False: 30.0k]
  ------------------
 1795|  5.40k|			doread = 1;
 1796|  5.40k|			break;
 1797|  23.1k|		default:
  ------------------
  |  Branch (1797:3): [True: 23.1k, False: 7.97k]
  ------------------
 1798|  23.1k|			doread = 0;
 1799|  23.1k|			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   65|  23.1k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  46.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  189|  23.1k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  46.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 18.8k, False: 4.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  23.1k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  23.1k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1799:8): [True: 23.1k, False: 0]
  |  Branch (1799:33): [True: 11.7k, False: 11.4k]
  ------------------
 1800|       |				/* Maybe warn here? */
 1801|  11.7k|				continue;
 1802|  11.7k|			}
 1803|  11.4k|			break;
 1804|  31.1k|		}
 1805|       |
 1806|  18.9k|		if (doread) {
  ------------------
  |  Branch (1806:7): [True: 7.55k, False: 11.4k]
  ------------------
 1807|  7.55k|			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  7.55k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  15.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.57k, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.55k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.55k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  202|  2.54k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  5.08k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.85k, False: 685]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  203|  7.55k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  204|  7.55k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (1807:17): [True: 2.54k, False: 5.01k]
  ------------------
 1808|  7.55k|			    : sizeof(nbuf);
 1809|  7.55k|			off_t offs = xph_offset;
  ------------------
  |  |  189|  7.55k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  15.1k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 5.57k, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  190|  7.55k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  191|  7.55k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
 1810|  7.55k|			bufsize = pread(fd, nbuf, len, offs);
 1811|  7.55k|			if (bufsize == -1) {
  ------------------
  |  Branch (1811:8): [True: 18, False: 7.53k]
  ------------------
 1812|     18|				if (elf_printf(ms,
  ------------------
  |  Branch (1812:9): [True: 0, False: 18]
  ------------------
 1813|     18|				    ", can't read section at %jd",
 1814|     18|				    (intmax_t)offs) == -1)
 1815|      0|					return -1;
 1816|     18|				return 0;
 1817|     18|			}
 1818|  7.55k|		}
 1819|       |
 1820|       |		/* Things we can determine when we seek */
 1821|  18.9k|		switch (xph_type) {
  ------------------
  |  |  186|  18.9k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  18.9k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (186:19): [True: 14.6k, False: 4.25k]
  |  |  ------------------
  |  |  187|  18.9k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  158|  14.6k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  188|  18.9k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  158|  4.25k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1822|  2.15k|		case PT_DYNAMIC:
  ------------------
  |  |  199|  2.15k|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1822:3): [True: 2.15k, False: 16.7k]
  ------------------
 1823|  2.15k|			dynamic = 1;
 1824|  2.15k|			offset = 0;
 1825|       |			// Let DF_1 determine if we are PIE or not.
 1826|  2.15k|			ms->mode &= ~0111;
 1827|  56.1k|			for (;;) {
 1828|  56.1k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  460|  56.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1828:9): [True: 2.15k, False: 54.0k]
  ------------------
 1829|  2.15k|					break;
 1830|  54.0k|				offset = dodynamic(ms, nbuf, offset,
 1831|  54.0k|				    CAST(size_t, bufsize), clazz, swap,
  ------------------
  |  |  460|  54.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1832|  54.0k|				    &pie, &need);
 1833|  54.0k|				if (offset == 0)
  ------------------
  |  Branch (1833:9): [True: 0, False: 54.0k]
  ------------------
 1834|      0|					break;
 1835|  54.0k|			}
 1836|  2.15k|			break;
 1837|       |
 1838|  54.0k|		case PT_INTERP:
  ------------------
  |  |  200|  1.11k|#define	PT_INTERP	3
  ------------------
  |  Branch (1838:3): [True: 1.11k, False: 17.8k]
  ------------------
 1839|  1.11k|			need++;
 1840|  1.11k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.11k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.11k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.11k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1840:8): [True: 0, False: 1.11k]
  ------------------
 1841|      0|				continue;
 1842|  1.11k|			if (bufsize && nbuf[0]) {
  ------------------
  |  Branch (1842:8): [True: 562, False: 552]
  |  Branch (1842:19): [True: 303, False: 259]
  ------------------
 1843|    303|				nbuf[bufsize - 1] = '\0';
 1844|    303|				str = RCAST(const char *, nbuf);
  ------------------
  |  |  461|    303|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1845|    303|			} else
 1846|    811|				str = "*empty*";
 1847|  1.11k|			strlcpy(interp, str, sizeof(interp));
 1848|  1.11k|			break;
 1849|  4.27k|		case PT_NOTE:
  ------------------
  |  |  201|  4.27k|#define	PT_NOTE		4
  ------------------
  |  Branch (1849:3): [True: 4.27k, False: 14.6k]
  ------------------
 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.54k|			for (;;) {
 1858|  7.54k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  460|  7.54k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1858:9): [True: 3.52k, False: 4.01k]
  ------------------
 1859|  3.52k|					break;
 1860|  4.01k|				offset = donote(ms, nbuf, offset,
 1861|  4.01k|				    CAST(size_t, bufsize), clazz, swap, align,
  ------------------
  |  |  460|  4.01k|#define CAST(T, b)	((T)(b))
  ------------------
 1862|  4.01k|				    flags, notecount, fd, 0, 0, 0);
 1863|  4.01k|				if (offset == 0)
  ------------------
  |  Branch (1863:9): [True: 747, False: 3.26k]
  ------------------
 1864|    747|					break;
 1865|  4.01k|			}
 1866|  4.27k|			break;
 1867|  11.4k|		default:
  ------------------
  |  Branch (1867:3): [True: 11.4k, False: 7.53k]
  ------------------
 1868|  11.4k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  11.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  11.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  11.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1868:8): [True: 0, False: 11.4k]
  ------------------
 1869|      0|				continue;
 1870|  11.4k|			break;
 1871|  18.9k|		}
 1872|  18.9k|	}
 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: 25, False: 38]
  ------------------
 1876|     25|		if (pie && need == 0)
  ------------------
  |  Branch (1876:7): [True: 3, False: 22]
  |  Branch (1876:14): [True: 1, False: 2]
  ------------------
 1877|      1|			str = "static-pie";
 1878|     24|		else
 1879|     24|			str = "dynamically";
 1880|     38|	} else {
 1881|     38|		str = "statically";
 1882|     38|	}
 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: 15, False: 48]
  ------------------
 1886|     15|		if (elf_printf(ms, ", interpreter %s", file_printable(ms,
  ------------------
  |  Branch (1886:7): [True: 2, False: 13]
  ------------------
 1887|     15|		    RCAST(char *, nbuf), sizeof(nbuf),
  ------------------
  |  |  461|     15|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1888|     15|		    interp, sizeof(interp))) == -1)
 1889|      2|			return -1;
 1890|     61|	return 0;
 1891|     63|}
readelf.c:dodynamic:
 1197|  54.0k|{
 1198|  54.0k|	Elf32_Dyn dh32;
 1199|  54.0k|	Elf64_Dyn dh64;
 1200|  54.0k|	unsigned char *dbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  460|  54.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1201|       |
 1202|  54.0k|	if (xdh_sizeof + offset > size) {
  ------------------
  |  |  227|  54.0k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  54.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 49.8k, False: 4.20k]
  |  |  ------------------
  |  |  228|  54.0k|			 ? sizeof(dh32)				\
  |  |  229|  54.0k|			 : sizeof(dh64))
  ------------------
  |  Branch (1202:6): [True: 1.64k, False: 52.3k]
  ------------------
 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.51k, False: 129]
  |  |  ------------------
  |  |  228|  1.64k|			 ? sizeof(dh32)				\
  |  |  229|  1.64k|			 : sizeof(dh64))
  ------------------
 1207|  1.64k|	}
 1208|       |
 1209|  52.3k|	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  224|  52.3k|#define xdh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (224:19): [True: 48.3k, False: 4.07k]
  |  |  ------------------
  |  |  225|  52.3k|			 ? CAST(void *, &dh32)			\
  |  |  ------------------
  |  |  |  |  460|  48.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  226|  52.3k|			 : CAST(void *, &dh64))
  |  |  ------------------
  |  |  |  |  460|  4.07k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  227|  52.3k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 48.3k, False: 4.07k]
  |  |  ------------------
  |  |  228|  52.3k|			 ? sizeof(dh32)				\
  |  |  229|  52.3k|			 : sizeof(dh64))
  ------------------
 1210|  52.3k|	offset += xdh_sizeof;
  ------------------
  |  |  227|  52.3k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (227:21): [True: 48.3k, False: 4.07k]
  |  |  ------------------
  |  |  228|  52.3k|			 ? sizeof(dh32)				\
  |  |  229|  52.3k|			 : sizeof(dh64))
  ------------------
 1211|       |
 1212|  52.3k|	switch (xdh_tag) {
  ------------------
  |  |  230|  52.3k|#define xdh_tag		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (230:19): [True: 48.3k, False: 4.07k]
  |  |  ------------------
  |  |  231|  52.3k|			 ? elf_getu32(swap, dh32.d_tag)		\
  |  |  ------------------
  |  |  |  |  158|  48.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  232|  52.3k|			 : elf_getu64(swap, dh64.d_tag))
  |  |  ------------------
  |  |  |  |  159|  4.07k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1213|  2.76k|	case DT_FLAGS_1:
  ------------------
  |  |  531|  2.76k|#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
  ------------------
  |  Branch (1213:2): [True: 2.76k, False: 49.6k]
  ------------------
 1214|  2.76k|		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  233|  2.76k|#define xdh_val		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.76k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (233:19): [True: 2.33k, False: 424]
  |  |  ------------------
  |  |  234|  2.76k|			 ? elf_getu32(swap, dh32.d_un.d_val)	\
  |  |  ------------------
  |  |  |  |  158|  2.33k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  235|  2.76k|			 : elf_getu64(swap, dh64.d_un.d_val))
  |  |  ------------------
  |  |  |  |  159|    424|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
              		if (xdh_val & DF_1_PIE) {
  ------------------
  |  |  574|  2.76k|#define	DF_1_PIE	0x08000000	/* Position Independent Executable */
  ------------------
  |  Branch (1214:7): [True: 2.11k, False: 646]
  ------------------
 1215|  2.11k|			*pie = 1;
 1216|  2.11k|			ms->mode |= 0111;
 1217|  2.11k|		} else
 1218|    646|			ms->mode &= ~0111;
 1219|  2.76k|		break;
 1220|  2.18k|	case DT_NEEDED:
  ------------------
  |  |  494|  2.18k|#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
  ------------------
  |  Branch (1220:2): [True: 2.18k, False: 50.1k]
  ------------------
 1221|  2.18k|		(*need)++;
 1222|  2.18k|		break;
 1223|  47.4k|	default:
  ------------------
  |  Branch (1223:2): [True: 47.4k, False: 4.94k]
  ------------------
 1224|  47.4k|		break;
 1225|  52.3k|	}
 1226|  52.3k|	return offset;
 1227|  52.3k|}
readelf.c:doshn:
 1432|  2.10k|{
 1433|  2.10k|	Elf32_Shdr sh32;
 1434|  2.10k|	Elf64_Shdr sh64;
 1435|  2.10k|	int stripped = 1, has_debug_info = 0;
 1436|  2.10k|	size_t nbadcap = 0;
 1437|  2.10k|	void *nbuf;
 1438|  2.10k|	off_t noff, coff, name_off, offs;
 1439|  2.10k|	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilities */
 1440|  2.10k|	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilities */
 1441|  2.10k|	char name[50];
 1442|  2.10k|	ssize_t namesize;
 1443|       |
 1444|  2.10k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  2.10k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.10k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.10k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1444:6): [True: 0, False: 2.10k]
  ------------------
 1445|      0|		return 0;
 1446|       |
 1447|  2.10k|	if (num == 0) {
  ------------------
  |  Branch (1447:6): [True: 565, False: 1.54k]
  ------------------
 1448|    565|		if (elf_printf(ms, ", no section header") == -1)
  ------------------
  |  Branch (1448:7): [True: 0, False: 565]
  ------------------
 1449|      0|			return -1;
 1450|    565|		return 0;
 1451|    565|	}
 1452|  1.54k|	if (size != xsh_sizeof) {
  ------------------
  |  |  164|  1.54k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.54k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 838, False: 703]
  |  |  ------------------
  |  |  165|  1.54k|			 ? sizeof(sh32)				\
  |  |  166|  1.54k|			 : sizeof(sh64))
  ------------------
  |  Branch (1452:6): [True: 329, False: 1.21k]
  ------------------
 1453|    329|		if (elf_printf(ms, ", corrupted section header size") == -1)
  ------------------
  |  Branch (1453:7): [True: 0, False: 329]
  ------------------
 1454|      0|			return -1;
 1455|    329|		return 0;
 1456|    329|	}
 1457|       |
 1458|       |	/* Read offset of name section to be able to read section names later */
 1459|  1.21k|	offs = CAST(off_t, (off + size * strtab));
  ------------------
  |  |  460|  1.21k|#define CAST(T, b)	((T)(b))
  ------------------
 1460|  1.21k|	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  161|  1.21k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.21k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 632, False: 580]
  |  |  ------------------
  |  |  162|  1.21k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  460|    632|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  1.21k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  460|    580|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  164|  1.21k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.21k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 632, False: 580]
  |  |  ------------------
  |  |  165|  1.21k|			 ? sizeof(sh32)				\
  |  |  166|  1.21k|			 : sizeof(sh64))
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  460|  2.42k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 632, False: 580]
  |  |  ------------------
  ------------------
  |  Branch (1460:6): [True: 12, False: 1.20k]
  ------------------
 1461|     12|		if (elf_printf(ms, ", missing section headers at %jd",
  ------------------
  |  Branch (1461:7): [True: 0, False: 12]
  ------------------
 1462|     12|		    (intmax_t)offs) == -1)
 1463|      0|			return -1;
 1464|     12|		return 0;
 1465|     12|	}
 1466|  1.20k|	name_off = xsh_offset;
  ------------------
  |  |  170|  1.20k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  2.40k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 624, False: 576]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.20k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.20k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1467|       |
 1468|  1.20k|	if (fsize != SIZE_UNKNOWN && fsize < name_off) {
  ------------------
  |  |   65|  1.20k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|  2.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1468:6): [True: 1.20k, False: 0]
  |  Branch (1468:31): [True: 23, False: 1.17k]
  ------------------
 1469|     23|		if (elf_printf(ms, ", too large section header offset %jd",
  ------------------
  |  Branch (1469:7): [True: 0, False: 23]
  ------------------
 1470|     23|		    (intmax_t)name_off) == -1)
 1471|      0|			return -1;
 1472|     23|		return 0;
 1473|     23|	}
 1474|       |
 1475|  68.3k|	for ( ; num; num--) {
  ------------------
  |  Branch (1475:10): [True: 68.0k, False: 251]
  ------------------
 1476|       |		/* Read the name of this section. */
 1477|  68.0k|		offs = name_off + xsh_name;
  ------------------
  |  |  176|  68.0k|#define xsh_name    	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (176:23): [True: 58.4k, False: 9.65k]
  |  |  ------------------
  |  |  177|  68.0k|			 ? elf_getu32(swap, sh32.sh_name)	\
  |  |  ------------------
  |  |  |  |  158|  58.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  178|  68.0k|			 : elf_getu32(swap, sh64.sh_name))
  |  |  ------------------
  |  |  |  |  158|  9.65k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1478|  68.0k|		if ((namesize = pread(fd, name, sizeof(name) - 1, offs))
  ------------------
  |  Branch (1478:7): [True: 40, False: 68.0k]
  ------------------
 1479|  68.0k|		    == -1) {
 1480|     40|			if (elf_printf(ms, 
  ------------------
  |  Branch (1480:8): [True: 0, False: 40]
  ------------------
 1481|     40|			    ", can't read name of elf section at %jd",
 1482|     40|			    (intmax_t)offs) == -1)
 1483|      0|				return -1;
 1484|     40|			return 0;
 1485|     40|		}
 1486|  68.0k|		name[namesize] = '\0';
 1487|  68.0k|		if (strcmp(name, ".debug_info") == 0) {
  ------------------
  |  Branch (1487:7): [True: 199, False: 67.8k]
  ------------------
 1488|    199|			has_debug_info = 1;
 1489|    199|			stripped = 0;
 1490|    199|		}
 1491|       |
 1492|  68.0k|		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  161|  68.0k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (161:19): [True: 58.4k, False: 9.61k]
  |  |  ------------------
  |  |  162|  68.0k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  460|  58.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  163|  68.0k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  460|  9.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  164|  68.0k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  68.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (164:21): [True: 58.4k, False: 9.61k]
  |  |  ------------------
  |  |  165|  68.0k|			 ? sizeof(sh32)				\
  |  |  166|  68.0k|			 : sizeof(sh64))
  ------------------
  |  Branch (1492:7): [True: 595, False: 67.4k]
  ------------------
 1493|  68.0k|		    CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  460|   136k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 58.4k, False: 9.61k]
  |  |  ------------------
  ------------------
 1494|    595|			if (elf_printf(ms, ", can't read elf section at %jd",
  ------------------
  |  Branch (1494:8): [True: 0, False: 595]
  ------------------
 1495|    595|			    (intmax_t)off) == -1)
 1496|      0|				return -1;
 1497|    595|			return 0;
 1498|    595|		}
 1499|  67.4k|		off += size;
 1500|       |
 1501|       |		/* Things we can determine before we seek */
 1502|  67.4k|		switch (xsh_type) {
  ------------------
  |  |  173|  67.4k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  67.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 58.0k, False: 9.39k]
  |  |  ------------------
  |  |  174|  67.4k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  58.0k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  67.4k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  9.39k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1503|  2.06k|		case SHT_SYMTAB:
  ------------------
  |  |  141|  2.06k|#define	SHT_SYMTAB	2
  ------------------
  |  Branch (1503:3): [True: 2.06k, False: 65.3k]
  ------------------
 1504|       |#if 0
 1505|       |		case SHT_DYNSYM:
 1506|       |#endif
 1507|  2.06k|			stripped = 0;
 1508|  2.06k|			break;
 1509|  65.3k|		default:
  ------------------
  |  Branch (1509:3): [True: 65.3k, False: 2.06k]
  ------------------
 1510|  65.3k|			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |   65|  65.3k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  460|   130k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |  170|  65.3k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|   130k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 56.0k, False: 9.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  65.3k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  65.3k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1510:8): [True: 65.3k, False: 0]
  |  Branch (1510:33): [True: 34.7k, False: 30.6k]
  ------------------
 1511|       |				/* Perhaps warn here */
 1512|  34.7k|				continue;
 1513|  34.7k|			}
 1514|  30.6k|			break;
 1515|  67.4k|		}
 1516|       |
 1517|       |
 1518|       |		/* Things we can determine when we seek */
 1519|  32.6k|		switch (xsh_type) {
  ------------------
  |  |  173|  32.6k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  32.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (173:19): [True: 28.3k, False: 4.33k]
  |  |  ------------------
  |  |  174|  32.6k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  158|  28.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  175|  32.6k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  158|  4.33k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1520|  2.75k|		case SHT_NOTE:
  ------------------
  |  |  142|  2.75k|#define	SHT_NOTE	7
  ------------------
  |  Branch (1520:3): [True: 2.75k, False: 29.9k]
  ------------------
 1521|  2.75k|			if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
  ------------------
  |  |  460|  11.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 1.84k, False: 911]
  |  |  |  Branch (460:25): [True: 1.84k, False: 911]
  |  |  ------------------
  ------------------
  |  Branch (1521:8): [True: 122, False: 2.63k]
  ------------------
 1522|  2.75k|			    CAST(uintmax_t, fsize)) {
  ------------------
  |  |  460|  2.75k|#define CAST(T, b)	((T)(b))
  ------------------
 1523|    122|				if (elf_printf(ms,
  ------------------
  |  Branch (1523:9): [True: 0, False: 122]
  ------------------
 1524|    122|				    ", note offset/size %#" INTMAX_T_FORMAT
 1525|    122|				    "x+%#" INTMAX_T_FORMAT "x exceeds"
 1526|    122|				    " file size %#" INTMAX_T_FORMAT "x",
 1527|    122|				    CAST(uintmax_t, xsh_offset),
  ------------------
  |  |  460|    244|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 58, False: 64]
  |  |  ------------------
  ------------------
 1528|    122|				    CAST(uintmax_t, xsh_size),
  ------------------
  |  |  460|    244|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 58, False: 64]
  |  |  ------------------
  ------------------
 1529|    122|				    CAST(uintmax_t, fsize)) == -1)
  ------------------
  |  |  460|    122|#define CAST(T, b)	((T)(b))
  ------------------
 1530|      0|					return -1;
 1531|    122|				return 0;
 1532|    122|			}
 1533|  2.63k|			if (xsh_size > ms->elf_shsize_max) {
  ------------------
  |  |  167|  2.63k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  5.26k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.78k, False: 847]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.63k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.63k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1533:8): [True: 37, False: 2.59k]
  ------------------
 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.59k|			if ((nbuf = malloc(xsh_size)) == NULL) {
  ------------------
  |  |  167|  2.59k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  5.18k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.78k, False: 810]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.59k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.59k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1539:8): [True: 0, False: 2.59k]
  ------------------
 1540|      0|				file_error(ms, errno, "Cannot allocate memory"
 1541|      0|				    " for note");
 1542|      0|				return -1;
 1543|      0|			}
 1544|  2.59k|			offs = xsh_offset;
  ------------------
  |  |  170|  2.59k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  5.18k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.78k, False: 810]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  2.59k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  2.59k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1545|  2.59k|			if (pread(fd, nbuf, xsh_size, offs) <
  ------------------
  |  |  167|  2.59k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  5.18k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 1.78k, False: 810]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  2.59k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  2.59k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1545:8): [True: 24, False: 2.57k]
  ------------------
 1546|  2.59k|			    CAST(ssize_t, xsh_size)) {
  ------------------
  |  |  460|  5.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 1.78k, False: 810]
  |  |  ------------------
  ------------------
 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.57k|			noff = 0;
 1556|  6.88k|			for (;;) {
 1557|  6.88k|				if (noff >= CAST(off_t, xsh_size))
  ------------------
  |  |  460|  13.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 3.72k, False: 3.15k]
  |  |  ------------------
  ------------------
  |  Branch (1557:9): [True: 2.17k, False: 4.71k]
  ------------------
 1558|  2.17k|					break;
 1559|  4.71k|				noff = donote(ms, nbuf, CAST(size_t, noff),
  ------------------
  |  |  460|  4.71k|#define CAST(T, b)	((T)(b))
  ------------------
 1560|  4.71k|				    xsh_size, clazz, swap, 4, flags, notecount,
  ------------------
  |  |  167|  4.71k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  9.42k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 2.09k, False: 2.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  168|  4.71k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  169|  4.71k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1561|  4.71k|				    fd, 0, 0, 0);
 1562|  4.71k|				if (noff == 0)
  ------------------
  |  Branch (1562:9): [True: 392, False: 4.31k]
  ------------------
 1563|    392|					break;
 1564|  4.71k|			}
 1565|  2.57k|			free(nbuf);
 1566|  2.57k|			break;
 1567|  2.59k|		case SHT_SUNW_cap:
  ------------------
  |  |  144|  2.59k|#define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
  ------------------
  |  Branch (1567:3): [True: 2.59k, False: 30.0k]
  ------------------
 1568|  2.59k|			switch (mach) {
 1569|    410|			case EM_SPARC:
  ------------------
  |  |  133|    410|#define	EM_SPARC	2
  ------------------
  |  Branch (1569:4): [True: 410, False: 2.18k]
  ------------------
 1570|  1.18k|			case EM_SPARCV9:
  ------------------
  |  |  136|  1.18k|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1570:4): [True: 775, False: 1.82k]
  ------------------
 1571|  1.46k|			case EM_IA_64:
  ------------------
  |  |  137|  1.46k|#define	EM_IA_64	50
  ------------------
  |  Branch (1571:4): [True: 282, False: 2.31k]
  ------------------
 1572|  2.10k|			case EM_386:
  ------------------
  |  |  134|  2.10k|#define	EM_386		3
  ------------------
  |  Branch (1572:4): [True: 636, False: 1.96k]
  ------------------
 1573|  2.26k|			case EM_AMD64:
  ------------------
  |  |  138|  2.26k|#define	EM_AMD64	62
  ------------------
  |  Branch (1573:4): [True: 159, False: 2.44k]
  ------------------
 1574|  2.26k|				break;
 1575|    337|			default:
  ------------------
  |  Branch (1575:4): [True: 337, False: 2.26k]
  ------------------
 1576|    337|				goto skip;
 1577|  2.59k|			}
 1578|       |
 1579|  2.26k|			if (nbadcap > 5)
  ------------------
  |  Branch (1579:8): [True: 614, False: 1.64k]
  ------------------
 1580|    614|				break;
 1581|  1.64k|			if (lseek(fd, xsh_offset, SEEK_SET)
  ------------------
  |  |  170|  1.64k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  460|  3.29k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (460:25): [True: 872, False: 776]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  171|  1.64k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  172|  1.64k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1581:8): [True: 3, False: 1.64k]
  ------------------
 1582|  1.64k|			    == CAST(off_t, -1)) {
  ------------------
  |  |  460|  1.64k|#define CAST(T, b)	((T)(b))
  ------------------
 1583|      3|				file_badseek(ms);
 1584|      3|				return -1;
 1585|      3|			}
 1586|  1.64k|			coff = 0;
 1587|  7.87k|			for (;;) {
 1588|  7.87k|				Elf32_Cap cap32;
 1589|  7.87k|				Elf64_Cap cap64;
 1590|  7.87k|				cap32.c_un.c_val = 0;
 1591|  7.87k|				cap64.c_un.c_val = 0;
 1592|  7.87k|				char cbuf[/*CONSTCOND*/
 1593|  7.87k|				    MAX(sizeof(cap32), sizeof(cap64))];
 1594|  7.87k|				if ((coff += xcap_sizeof) >
  ------------------
  |  |  240|  7.87k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  7.87k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 4.91k, False: 2.95k]
  |  |  ------------------
  |  |  241|  7.87k|			 ? sizeof(cap32)			\
  |  |  242|  7.87k|			 : sizeof(cap64))
  ------------------
  |  Branch (1594:9): [True: 713, False: 7.15k]
  ------------------
 1595|  7.87k|				    CAST(off_t, xsh_size))
  ------------------
  |  |  460|  15.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 4.91k, False: 2.95k]
  |  |  ------------------
  ------------------
 1596|    713|					break;
 1597|  7.15k|				if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
  ------------------
  |  |  460|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 4.52k, False: 2.63k]
  |  |  ------------------
  ------------------
  |  Branch (1597:9): [True: 105, False: 7.05k]
  ------------------
 1598|  7.15k|				    CAST(ssize_t, xcap_sizeof)) {
  ------------------
  |  |  460|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 4.52k, False: 2.63k]
  |  |  ------------------
  ------------------
 1599|    105|					file_badread(ms);
 1600|    105|					return -1;
 1601|    105|				}
 1602|  7.05k|				if (cbuf[0] == 'A') {
  ------------------
  |  Branch (1602:9): [True: 577, False: 6.47k]
  ------------------
 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|    577|					break;
 1631|    577|				}
 1632|  6.47k|				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  237|  6.47k|#define xcap_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.47k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (237:20): [True: 4.19k, False: 2.28k]
  |  |  ------------------
  |  |  238|  6.47k|			 ? CAST(void *, &cap32)			\
  |  |  ------------------
  |  |  |  |  460|  4.19k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  239|  6.47k|			 : CAST(void *, &cap64))
  |  |  ------------------
  |  |  |  |  460|  2.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  240|  6.47k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.47k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (240:22): [True: 4.19k, False: 2.28k]
  |  |  ------------------
  |  |  241|  6.47k|			 ? sizeof(cap32)			\
  |  |  242|  6.47k|			 : sizeof(cap64))
  ------------------
 1633|  6.47k|				switch (xcap_tag) {
  ------------------
  |  |  243|  6.47k|#define xcap_tag	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.47k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (243:19): [True: 4.19k, False: 2.28k]
  |  |  ------------------
  |  |  244|  6.47k|			 ? elf_getu32(swap, cap32.c_tag)	\
  |  |  ------------------
  |  |  |  |  158|  4.19k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  245|  6.47k|			 : elf_getu64(swap, cap64.c_tag))
  |  |  ------------------
  |  |  |  |  159|  2.28k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1634|  2.99k|				case CA_SUNW_NULL:
  ------------------
  |  |  424|  2.99k|#define	CA_SUNW_NULL	0
  ------------------
  |  Branch (1634:5): [True: 2.99k, False: 3.48k]
  ------------------
 1635|  2.99k|					break;
 1636|  1.15k|				case CA_SUNW_HW_1:
  ------------------
  |  |  425|  1.15k|#define	CA_SUNW_HW_1	1
  ------------------
  |  Branch (1636:5): [True: 1.15k, False: 5.32k]
  ------------------
 1637|  1.15k|					cap_hw1 |= xcap_val;
  ------------------
  |  |  246|  1.15k|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.15k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 742, False: 409]
  |  |  ------------------
  |  |  247|  1.15k|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    742|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|  1.15k|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    409|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1638|  1.15k|					break;
 1639|  1.11k|				case CA_SUNW_SF_1:
  ------------------
  |  |  426|  1.11k|#define	CA_SUNW_SF_1	2
  ------------------
  |  Branch (1639:5): [True: 1.11k, False: 5.36k]
  ------------------
 1640|  1.11k|					cap_sf1 |= xcap_val;
  ------------------
  |  |  246|  1.11k|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.11k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:19): [True: 718, False: 397]
  |  |  ------------------
  |  |  247|  1.11k|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  158|    718|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  248|  1.11k|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  159|    397|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1641|  1.11k|					break;
 1642|  1.21k|				default:
  ------------------
  |  Branch (1642:5): [True: 1.21k, False: 5.25k]
  ------------------
 1643|  1.21k|					if (elf_printf(ms,
  ------------------
  |  Branch (1643:10): [True: 0, False: 1.21k]
  ------------------
 1644|  1.21k|					    ", with unknown capability "
 1645|  1.21k|					    "%#" INT64_T_FORMAT "x = %#"
 1646|  1.21k|					    INT64_T_FORMAT "x",
 1647|  1.21k|					    CAST(unsigned long long, xcap_tag),
  ------------------
  |  |  460|  2.43k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 644, False: 574]
  |  |  ------------------
  ------------------
 1648|  1.21k|					    CAST(unsigned long long, xcap_val))
  ------------------
  |  |  460|  2.43k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (460:25): [True: 644, False: 574]
  |  |  ------------------
  ------------------
 1649|  1.21k|					    == -1)
 1650|      0|						return -1;
 1651|  1.21k|					if (nbadcap++ > 2)
  ------------------
  |  Branch (1651:10): [True: 250, False: 968]
  ------------------
 1652|    250|						goto skip;
 1653|    968|					break;
 1654|  6.47k|				}
 1655|  6.47k|			}
 1656|       |			/*FALLTHROUGH*/
 1657|  1.87k|		skip:
 1658|  29.2k|		default:
  ------------------
  |  Branch (1658:3): [True: 27.3k, False: 5.35k]
  ------------------
 1659|  29.2k|			break;
 1660|  32.6k|		}
 1661|  32.6k|	}
 1662|       |
 1663|    251|	if (has_debug_info) {
  ------------------
  |  Branch (1663:6): [True: 1, False: 250]
  ------------------
 1664|      1|		if (elf_printf(ms, ", with debug_info") == -1)
  ------------------
  |  Branch (1664:7): [True: 0, False: 1]
  ------------------
 1665|      0|			return -1;
 1666|      1|	}
 1667|    251|	if (elf_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
  ------------------
  |  Branch (1667:6): [True: 0, False: 251]
  |  Branch (1667:37): [True: 247, False: 4]
  ------------------
 1668|      0|		return -1;
 1669|    251|	if (cap_hw1) {
  ------------------
  |  Branch (1669:6): [True: 106, False: 145]
  ------------------
 1670|    106|		const cap_desc_t *cdp;
 1671|    106|		switch (mach) {
 1672|      4|		case EM_SPARC:
  ------------------
  |  |  133|      4|#define	EM_SPARC	2
  ------------------
  |  Branch (1672:3): [True: 4, False: 102]
  ------------------
 1673|      4|		case EM_SPARC32PLUS:
  ------------------
  |  |  135|      4|#define	EM_SPARC32PLUS	18
  ------------------
  |  Branch (1673:3): [True: 0, False: 106]
  ------------------
 1674|     97|		case EM_SPARCV9:
  ------------------
  |  |  136|     97|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1674:3): [True: 93, False: 13]
  ------------------
 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: 102]
  ------------------
 1678|      5|		case EM_IA_64:
  ------------------
  |  |  137|      5|#define	EM_IA_64	50
  ------------------
  |  Branch (1678:3): [True: 1, False: 105]
  ------------------
 1679|      9|		case EM_AMD64:
  ------------------
  |  |  138|      9|#define	EM_AMD64	62
  ------------------
  |  Branch (1679:3): [True: 4, False: 102]
  ------------------
 1680|      9|			cdp = cap_desc_386;
 1681|      9|			break;
 1682|      0|		default:
  ------------------
  |  Branch (1682:3): [True: 0, False: 106]
  ------------------
 1683|      0|			cdp = NULL;
 1684|      0|			break;
 1685|    106|		}
 1686|    106|		if (elf_printf(ms, ", uses") == -1)
  ------------------
  |  Branch (1686:7): [True: 0, False: 106]
  ------------------
 1687|      0|			return -1;
 1688|    106|		if (cdp) {
  ------------------
  |  Branch (1688:7): [True: 106, False: 0]
  ------------------
 1689|  1.39k|			while (cdp->cd_name) {
  ------------------
  |  Branch (1689:11): [True: 1.29k, False: 106]
  ------------------
 1690|  1.29k|				if (cap_hw1 & cdp->cd_mask) {
  ------------------
  |  Branch (1690:9): [True: 629, False: 663]
  ------------------
 1691|    629|					if (elf_printf(ms,
  ------------------
  |  Branch (1691:10): [True: 0, False: 629]
  ------------------
 1692|    629|					    " %s", cdp->cd_name) == -1)
 1693|      0|						return -1;
 1694|    629|					cap_hw1 &= ~cdp->cd_mask;
 1695|    629|				}
 1696|  1.29k|				++cdp;
 1697|  1.29k|			}
 1698|    106|			if (cap_hw1)
  ------------------
  |  Branch (1698:8): [True: 103, False: 3]
  ------------------
 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|    106|		} 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|    106|	}
 1711|    251|	if (cap_sf1) {
  ------------------
  |  Branch (1711:6): [True: 105, False: 146]
  ------------------
 1712|    105|		if (cap_sf1 & SF1_SUNW_FPUSED) {
  ------------------
  |  |  430|    105|#define	SF1_SUNW_FPUSED	0x02
  ------------------
  |  Branch (1712:7): [True: 50, False: 55]
  ------------------
 1713|     50|			if (elf_printf(ms,
  ------------------
  |  Branch (1713:8): [True: 0, False: 50]
  ------------------
 1714|     50|			    (cap_sf1 & SF1_SUNW_FPKNWN)
  ------------------
  |  |  429|     50|#define	SF1_SUNW_FPKNWN	0x01
  ------------------
  |  Branch (1714:8): [True: 33, False: 17]
  ------------------
 1715|     50|			    ? ", uses frame pointer"
 1716|     50|			    : ", not known to use frame pointer") == -1)
 1717|      0|				return -1;
 1718|     50|		}
 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|    251|	return 0;
 1728|    251|}
readelf.c:getu64:
  134|  78.0k|{
  135|  78.0k|	union {
  136|  78.0k|		uint64_t ui;
  137|  78.0k|		char c[8];
  138|  78.0k|	} retval, tmpval;
  139|       |
  140|  78.0k|	if (swap) {
  ------------------
  |  Branch (140:6): [True: 39.0k, False: 38.9k]
  ------------------
  141|  39.0k|		tmpval.ui = value;
  142|       |
  143|  39.0k|		retval.c[0] = tmpval.c[7];
  144|  39.0k|		retval.c[1] = tmpval.c[6];
  145|  39.0k|		retval.c[2] = tmpval.c[5];
  146|  39.0k|		retval.c[3] = tmpval.c[4];
  147|  39.0k|		retval.c[4] = tmpval.c[3];
  148|  39.0k|		retval.c[5] = tmpval.c[2];
  149|  39.0k|		retval.c[6] = tmpval.c[1];
  150|  39.0k|		retval.c[7] = tmpval.c[0];
  151|       |
  152|  39.0k|		return retval.ui;
  153|  39.0k|	} else
  154|  38.9k|		return value;
  155|  78.0k|}
readelf.c:elf_printf:
   72|  17.2k|{
   73|  17.2k|	va_list ap;
   74|  17.2k|	int rv;
   75|       |
   76|  17.2k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  17.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  17.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  17.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (76:6): [True: 0, False: 17.2k]
  ------------------
   77|      0|		return 1;
   78|       |
   79|  17.2k|	va_start(ap, fmt);
   80|  17.2k|	rv = file_vprintf(ms, fmt, ap);
   81|       |	va_end(ap);
   82|  17.2k|	return rv;
   83|  17.2k|}

file_softmagic:
  130|  17.8k|{
  131|  17.8k|	struct mlist *ml;
  132|  17.8k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  133|  17.8k|	uint16_t nc, ic;
  134|       |
  135|  17.8k|	if (name_count == NULL) {
  ------------------
  |  Branch (135:6): [True: 17.8k, False: 0]
  ------------------
  136|  17.8k|		nc = 0;
  137|  17.8k|		name_count = &nc;
  138|  17.8k|	}
  139|  17.8k|	if (indir_count == NULL) {
  ------------------
  |  Branch (139:6): [True: 17.8k, False: 0]
  ------------------
  140|  17.8k|		ic = 0;
  141|  17.8k|		indir_count = &ic;
  142|  17.8k|	}
  143|       |
  144|  35.4k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (144:32): [True: 17.8k, False: 17.6k]
  ------------------
  145|  17.8k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  146|  17.8k|		    0, mode, text, 0, indir_count, name_count,
  147|  17.8k|		    &printed_something, &need_separator, &firstline,
  148|  17.8k|		    NULL, NULL);
  149|  17.8k|		switch (ret) {
  150|    190|		case -1:
  ------------------
  |  Branch (150:3): [True: 190, False: 17.6k]
  ------------------
  151|    190|			return ret;
  152|  5.53k|		case 0:
  ------------------
  |  Branch (152:3): [True: 5.53k, False: 12.2k]
  ------------------
  153|  5.53k|			continue;
  154|  12.0k|		default:
  ------------------
  |  Branch (154:3): [True: 12.0k, False: 5.72k]
  ------------------
  155|  12.0k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  12.0k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (155:8): [True: 0, False: 12.0k]
  ------------------
  156|      0|				return ret;
  157|  12.0k|			rv = ret;
  158|  12.0k|			break;
  159|  17.8k|		}
  160|  17.8k|	}
  161|       |
  162|  17.6k|	return rv;
  163|  17.8k|}
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.0k, False: 66.2k]
  ------------------
  236|  36.0k|		returnval = &returnvalv;
  237|   102k|	if (found_match == NULL)
  ------------------
  |  Branch (237:6): [True: 36.0k, False: 66.2k]
  ------------------
  238|  36.0k|		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.0k]
  ------------------
  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: 138M, False: 66.2k]
  ------------------
  249|   138M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  318|   277M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  258|   277M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (318:3): [True: 84.5M, False: 54.4M]
  |  |  ------------------
  |  |  319|   138M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  266|   193M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (319:3): [True: 35.7k, False: 54.4M]
  |  |  ------------------
  |  |  320|   138M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  271|   193M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (320:3): [True: 0, False: 54.4M]
  |  |  ------------------
  |  |  321|   138M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  272|   193M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (321:3): [True: 71.4k, False: 54.3M]
  |  |  ------------------
  |  |  322|   138M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  270|   193M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (322:3): [True: 2.84M, False: 51.4M]
  |  |  ------------------
  |  |  323|   138M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  273|   190M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (323:3): [True: 9.48M, False: 42.0M]
  |  |  ------------------
  |  |  324|   138M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  294|   180M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (324:3): [True: 0, False: 42.0M]
  |  |  ------------------
  |  |  325|   138M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  298|   180M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (325:3): [True: 0, False: 42.0M]
  |  |  ------------------
  |  |  326|   138M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  299|   180M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (326:3): [True: 0, False: 42.0M]
  |  |  ------------------
  |  |  327|   277M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  314|  42.0M|#define				FILE_OCTAL		61
  |  |  ------------------
  |  |  |  Branch (327:3): [True: 0, False: 42.0M]
  |  |  ------------------
  ------------------
  250|  96.9M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  251|  96.9M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  390|  12.8M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  250|  12.8M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  410|  12.8M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  12.8M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  409|  12.8M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  12.8M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  410|  12.8M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  403|  12.8M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (251:10): [True: 12.8M, False: 84.0M]
  |  Branch (251:18): [True: 516k, False: 12.3M]
  ------------------
  252|  96.4M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  390|  84.0M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  250|  84.0M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  410|  84.0M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  84.0M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  409|  84.0M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  84.0M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  409|  84.0M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  403|  84.0M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (252:10): [True: 84.0M, False: 12.3M]
  |  Branch (252:19): [True: 4.45M, False: 79.5M]
  ------------------
  253|   133M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (253:7): [True: 18.0M, False: 115M]
  ------------------
  254|   138M|flush:
  255|       |			/* Skip sub-tests */
  256|   622M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (256:11): [True: 622M, False: 5.04k]
  ------------------
  257|   622M|			    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (257:8): [True: 484M, False: 138M]
  ------------------
  258|   484M|				magindex++;
  259|   484M|			}
  260|   138M|			cont_level = 0;
  261|   138M|			continue; /* Skip to next top-level test*/
  262|  22.9M|		}
  263|       |
  264|   116M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1) {
  ------------------
  |  Branch (264:7): [True: 91.2k, False: 115M]
  ------------------
  265|  91.2k|			if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  183|  91.2k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  91.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (265:8): [True: 0, False: 91.2k]
  ------------------
  266|      0|				continue;
  267|  91.2k|			else
  268|  91.2k|				goto flush;
  269|  91.2k|		}
  270|   115M|		ms->line = m->lineno;
  271|       |
  272|       |		/* if main entry matches, print it... */
  273|   115M|		switch (mget(ms, m, b, &bb, offset, cont_level,
  274|   115M|		    mode, text, flip, indir_count, name_count,
  275|   115M|		    printed_something, need_separator, firstline, returnval,
  276|   115M|		    found_match))
  277|   115M|		{
  278|     53|		case -1:
  ------------------
  |  Branch (278:3): [True: 53, False: 115M]
  ------------------
  279|     53|			return -1;
  280|  17.2M|		case 0:
  ------------------
  |  Branch (280:3): [True: 17.2M, False: 98.6M]
  ------------------
  281|  17.2M|			flush = m->reln != '!';
  282|  17.2M|			break;
  283|  98.6M|		default:
  ------------------
  |  Branch (283:3): [True: 98.6M, False: 17.2M]
  ------------------
  284|  98.6M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  294|  98.6M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (284:8): [True: 0, False: 98.6M]
  ------------------
  285|      0|				*found_match = 1;
  286|      0|				*returnval = 1;
  287|      0|			}
  288|       |
  289|  98.6M|			switch (magiccheck(ms, m, m_rxcomp)) {
  290|      0|			case -1:
  ------------------
  |  Branch (290:4): [True: 0, False: 98.6M]
  ------------------
  291|      0|				return -1;
  292|  98.2M|			case 0:
  ------------------
  |  Branch (292:4): [True: 98.2M, False: 450k]
  ------------------
  293|  98.2M|				flush++;
  294|  98.2M|				break;
  295|   450k|			default:
  ------------------
  |  Branch (295:4): [True: 450k, False: 98.2M]
  ------------------
  296|   450k|				flush = 0;
  297|   450k|				break;
  298|  98.6M|			}
  299|  98.6M|			break;
  300|   115M|		}
  301|   115M|		if (flush) {
  ------------------
  |  Branch (301:7): [True: 115M, False: 450k]
  ------------------
  302|       |			/*
  303|       |			 * main entry didn't match,
  304|       |			 * flush its continuations
  305|       |			 */
  306|   115M|			goto flush;
  307|   115M|		}
  308|       |
  309|   450k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (309:7): [True: 0, False: 450k]
  ------------------
  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|   450k|		if (*m->desc) {
  ------------------
  |  Branch (323:7): [True: 30.6k, False: 419k]
  ------------------
  324|  30.6k|			*found_match = 1;
  325|  30.6k|			if (print) {
  ------------------
  |  Branch (325:8): [True: 30.6k, False: 0]
  ------------------
  326|  30.6k|				*returnval = 1;
  327|  30.6k|				*need_separator = 1;
  328|  30.6k|				*printed_something = 1;
  329|  30.6k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (329:9): [True: 0, False: 30.6k]
  ------------------
  330|      0|					return -1;
  331|  30.6k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (331:9): [True: 0, False: 30.6k]
  ------------------
  332|      0|					return -1;
  333|  30.6k|			}
  334|  30.6k|		}
  335|       |
  336|   450k|		switch (moffset(ms, m, bb.flen, offset,
  337|   450k|		    &ms->c.li[cont_level].off)) {
  338|  25.8k|		case -1:
  ------------------
  |  Branch (338:3): [True: 25.8k, False: 424k]
  ------------------
  339|  25.8k|		case 0:
  ------------------
  |  Branch (339:3): [True: 0, False: 450k]
  ------------------
  340|  25.8k|			goto flush;
  341|   424k|		default:
  ------------------
  |  Branch (341:3): [True: 424k, False: 25.8k]
  ------------------
  342|   424k|			break;
  343|   450k|		}
  344|       |
  345|       |		/* and any continuations that match */
  346|   424k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (346:7): [True: 0, False: 424k]
  ------------------
  347|      0|			return -1;
  348|       |
  349|  7.15M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (349:10): [True: 7.05M, False: 93.9k]
  ------------------
  350|  7.05M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (350:7): [True: 6.72M, False: 327k]
  ------------------
  351|  6.72M|			m = &magic[++magindex];
  352|  6.72M|			m_rxcomp = &magic_rxcomp[magindex];
  353|  6.72M|			ms->line = m->lineno; /* for messages */
  354|       |
  355|  6.72M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (355:8): [True: 4.92M, False: 1.80M]
  ------------------
  356|  4.92M|				continue;
  357|  1.80M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (357:8): [True: 151k, False: 1.65M]
  ------------------
  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: 131, False: 1.80M]
  ------------------
  365|  1.80M|			    == -1) {
  366|    131|				if (b->elen == FILE_BADSIZE)
  ------------------
  |  |  183|    131|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|    131|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (366:9): [True: 0, False: 131]
  ------------------
  367|      0|					continue;
  368|    131|				else
  369|    131|					goto flush;
  370|    131|			}
  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.61M|#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.16k|			case -1:
  ------------------
  |  Branch (394:4): [True: 3.16k, False: 1.80M]
  ------------------
  395|  3.16k|				return -1;
  396|   115k|			case 0:
  ------------------
  |  Branch (396:4): [True: 115k, False: 1.69M]
  ------------------
  397|   115k|				if (m->reln != '!')
  ------------------
  |  Branch (397:9): [True: 112k, False: 2.82k]
  ------------------
  398|   112k|					continue;
  399|  2.82k|				flush = 1;
  400|  2.82k|				break;
  401|  1.68M|			default:
  ------------------
  |  Branch (401:4): [True: 1.68M, False: 118k]
  ------------------
  402|  1.68M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  294|  1.68M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (402:9): [True: 13.7k, False: 1.67M]
  ------------------
  403|  13.7k|					*found_match = 1;
  404|  13.7k|					*returnval = 1;
  405|  13.7k|				}
  406|  1.68M|				flush = 0;
  407|  1.68M|				break;
  408|  1.80M|			}
  409|       |
  410|  1.69M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (410:12): [True: 2.82k, False: 1.68M]
  ------------------
  411|      0|			case -1:
  ------------------
  |  Branch (411:4): [True: 0, False: 1.69M]
  ------------------
  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.25k, False: 429k]
  ------------------
  423|  3.25k|					ms->c.li[cont_level].got_match = 0;
  424|   429k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (424:14): [True: 105k, False: 323k]
  ------------------
  425|   105k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  256|   105k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (425:10): [True: 2.85k, False: 103k]
  ------------------
  426|  2.85k|						break;
  427|   105k|				} else
  428|   323k|					ms->c.li[cont_level].got_match = 1;
  429|       |
  430|   429k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (430:9): [True: 0, False: 429k]
  ------------------
  431|   429k|				    != 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|   429k|				if (*m->desc) {
  ------------------
  |  Branch (439:9): [True: 137k, False: 292k]
  ------------------
  440|   137k|					*found_match = 1;
  441|   137k|				}
  442|   429k|				if (print && *m->desc) {
  ------------------
  |  Branch (442:9): [True: 429k, 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.1k, False: 111k]
  ------------------
  456|  25.1k|						*printed_something = 1;
  457|  25.1k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (457:11): [True: 0, False: 25.1k]
  ------------------
  458|  25.1k|						    == -1)
  459|      0|							return -1;
  460|  25.1k|					}
  461|       |					/* space if previous printed */
  462|   137k|					if (*need_separator
  ------------------
  |  Branch (462:10): [True: 128k, False: 8.27k]
  ------------------
  463|   128k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  238|   128k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (463:13): [True: 58.6k, False: 70.2k]
  ------------------
  464|  58.6k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (464:11): [True: 0, False: 58.6k]
  ------------------
  465|      0|							return -1;
  466|  58.6k|					}
  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|   429k|				switch (moffset(ms, m, bb.flen, offset,
  473|   429k|				    &ms->c.li[cont_level].off)) {
  474|  6.20k|				case -1:
  ------------------
  |  Branch (474:5): [True: 6.20k, False: 423k]
  ------------------
  475|  6.20k|				case 0:
  ------------------
  |  Branch (475:5): [True: 0, False: 429k]
  ------------------
  476|  6.20k|					cont_level--;
  477|  6.20k|					break;
  478|   423k|				default:
  ------------------
  |  Branch (478:5): [True: 423k, False: 6.20k]
  ------------------
  479|   423k|					break;
  480|   429k|				}
  481|       |
  482|       |				/*
  483|       |				 * If we see any continuations
  484|       |				 * at a higher level,
  485|       |				 * process them.
  486|       |				 */
  487|   429k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (487:9): [True: 0, False: 429k]
  ------------------
  488|      0|					return -1;
  489|   429k|				break;
  490|  1.69M|			}
  491|  1.69M|		}
  492|   421k|		if (*printed_something) {
  ------------------
  |  Branch (492:7): [True: 114k, False: 306k]
  ------------------
  493|   114k|			*firstline = 0;
  494|   114k|		}
  495|   421k|		if (*found_match) {
  ------------------
  |  Branch (495:7): [True: 286k, False: 134k]
  ------------------
  496|   286k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   286k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (496:8): [True: 0, False: 286k]
  ------------------
  497|      0|				return *returnval;
  498|       |			// So that we print a separator
  499|   286k|			*printed_something = 0;
  500|   286k|			*firstline = 0;
  501|   286k|		}
  502|   421k|		cont_level = 0;
  503|   421k|	}
  504|  99.0k|	return *returnval;
  505|   102k|}
softmagic.c:msetoffset:
 1571|   117M|{
 1572|   117M|	int32_t offset;
 1573|   117M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  242|   117M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1573:6): [True: 351k, False: 117M]
  ------------------
 1574|   351k|		offset = -m->offset;
 1575|   351k|		if (cont_level > 0) {
  ------------------
  |  Branch (1575:7): [True: 18.5k, False: 332k]
  ------------------
 1576|  18.5k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  235|  18.5k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  236|  18.5k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1576:8): [True: 10.1k, False: 8.36k]
  ------------------
 1577|  10.1k|				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.5k|		}
 1584|   341k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1584:7): [True: 0, False: 341k]
  ------------------
 1585|      0|			return -1;
 1586|   341k|		if (o != 0) {
  ------------------
  |  Branch (1586:7): [True: 58, False: 340k]
  ------------------
 1587|       |			// Not yet!
 1588|     58|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1589|     58|			    "u at level %u", o, cont_level);
 1590|     58|			return -1;
 1591|     58|		}
 1592|   340k|		if (b->fd == -1) {
  ------------------
  |  Branch (1592:7): [True: 104k, False: 236k]
  ------------------
 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.2k]
  ------------------
 1594|  17.7k|				return -1;
 1595|  86.2k|			ms->eoffset = ms->offset =
 1596|  86.2k|			    CAST(int32_t, b->flen - m->offset);
  ------------------
  |  |  460|  86.2k|#define CAST(T, b)	((T)(b))
  ------------------
 1597|   236k|		} else {
 1598|   236k|			if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  460|   236k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1598:8): [True: 73.5k, False: 163k]
  ------------------
 1599|  73.5k|				return -1;
 1600|   163k|			buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1601|   163k|			ms->eoffset = ms->offset =
 1602|   163k|			    CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  460|   163k|#define CAST(T, b)	((T)(b))
  ------------------
 1603|   163k|		}
 1604|   117M|	} else {
 1605|   117M|		offset = m->offset;
 1606|   117M|		if ((m->flag & OFFPOSITIVE) || cont_level == 0) {
  ------------------
  |  |  243|   117M|#define OFFPOSITIVE	0x100	/* relative to the beginning of file */
  ------------------
  |  Branch (1606:7): [True: 93, False: 117M]
  |  Branch (1606:34): [True: 115M, False: 1.78M]
  ------------------
 1607|   115M|normal:
 1608|       |			// XXX: Pass real fd, then who frees bb?
 1609|   115M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1610|   115M|			ms->offset = offset;
 1611|   115M|			ms->eoffset = 0;
 1612|   115M|		} else {
 1613|  1.78M|			ms->offset = ms->eoffset + offset;
 1614|  1.78M|		}
 1615|   117M|	}
 1616|   117M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   117M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1616:6): [True: 0, False: 117M]
  ------------------
 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|   117M|	return 0;
 1624|   117M|}
softmagic.c:mget:
 1654|   117M|{
 1655|   117M|	uint32_t eoffset, offset = ms->offset;
 1656|   117M|	struct buffer sbb;
 1657|   117M|	intmax_t lhs;
 1658|   117M|	file_pushbuf_t *pb;
 1659|   117M|	int rv, oneed_separator, in_type, nfound_match;
 1660|   117M|	char *rbuf;
 1661|   117M|	union VALUETYPE *p = &ms->ms_value;
 1662|   117M|	struct mlist ml, *mlp;
 1663|   117M|	struct cont c;
 1664|   117M|	const unsigned char *s = CAST(const unsigned char *, bb->fbuf);
  ------------------
  |  |  460|   117M|#define CAST(T, b)	((T)(b))
  ------------------
 1665|   117M|	size_t nbytes = bb->flen;
 1666|       |
 1667|   117M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1667:6): [True: 51, False: 117M]
  ------------------
 1668|     51|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1669|     51|		    *indir_count);
 1670|     51|		return -1;
 1671|     51|	}
 1672|       |
 1673|   117M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1673:6): [True: 2, False: 117M]
  ------------------
 1674|      2|		file_error(ms, 0, "name use count (%hu) exceeded",
 1675|      2|		    *name_count);
 1676|      2|		return -1;
 1677|      2|	}
 1678|       |
 1679|       |
 1680|   117M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  234|   117M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1680:6): [True: 0, False: 117M]
  ------------------
 1681|   117M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  460|   117M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  460|   117M|#define CAST(T, b)	((T)(b))
  ------------------
 1682|      0|		return -1;
 1683|       |
 1684|   117M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   117M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1684:6): [True: 0, False: 117M]
  ------------------
 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|   117M|	if (m->flag & INDIR) {
  ------------------
  |  |  234|   117M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1697:6): [True: 842k, False: 116M]
  ------------------
 1698|   842k|		intmax_t off = m->in_offset;
 1699|   842k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  363|   842k|#define				FILE_OPSIGNED	0x20
  ------------------
 1700|   842k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  365|   842k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1700:7): [True: 1.02k, False: 841k]
  ------------------
 1701|  1.02k|			uint8_t *hb;
 1702|  1.02k|			uint16_t hs;
 1703|  1.02k|			uint32_t hl;
 1704|  1.02k|			int op;
 1705|       |
 1706|  1.02k|			if (offset_oob(nbytes, offset + off, 0))
  ------------------
  |  Branch (1706:8): [True: 197, False: 830]
  ------------------
 1707|    197|				return 0;
 1708|    830|			hb = CCAST(uint8_t *, s + offset + off);
  ------------------
  |  |  462|    830|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1709|    830|			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: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 1738|      0|			case FILE_BEID3:
  ------------------
  |  |  292|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1738:4): [True: 0, False: 830]
  ------------------
 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: 830]
  ------------------
 1744|    830|			case FILE_LELONG:
  ------------------
  |  |  264|    830|#define				FILE_LELONG		11
  ------------------
  |  Branch (1744:4): [True: 830, False: 0]
  ------------------
 1745|    830|				if (offset_oob(nbytes, offset + off, 4))
  ------------------
  |  Branch (1745:9): [True: 225, False: 605]
  ------------------
 1746|    225|					return 0;
 1747|    605|				off = SEXT(sgn,32,LE32(hb));
  ------------------
  |  |  108|    605|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 605]
  |  |  ------------------
  |  |  109|    605|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    605|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    605|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1748|    605|				break;
 1749|      0|			case FILE_MELONG:
  ------------------
  |  |  276|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1749:4): [True: 0, False: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 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: 830]
  ------------------
 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|    830|			}
 1774|    605|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    605|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1774:8): [True: 0, False: 605]
  ------------------
 1775|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1776|    605|		}
 1777|   841k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1778|  30.7k|		case FILE_BYTE:
  ------------------
  |  |  254|  30.7k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1778:3): [True: 30.7k, False: 811k]
  ------------------
 1779|  30.7k|			if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1779:8): [True: 68, False: 30.6k]
  ------------------
 1780|     68|				return 0;
 1781|  30.6k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  108|  30.6k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 30.6k]
  |  |  ------------------
  |  |  109|  30.6k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  30.6k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  30.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1781:8): [True: 0, False: 30.6k]
  ------------------
 1782|      0|				return 0;
 1783|  30.6k|			break;
 1784|  30.6k|		case FILE_BESHORT:
  ------------------
  |  |  260|  25.5k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1784:3): [True: 25.5k, False: 816k]
  ------------------
 1785|  25.5k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1785:8): [True: 240, False: 25.3k]
  ------------------
 1786|    240|				return 0;
 1787|  25.3k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p->hs)), off))
  ------------------
  |  |  108|  25.3k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 25.3k]
  |  |  ------------------
  |  |  109|  25.3k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  25.3k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  25.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1787:8): [True: 0, False: 25.3k]
  ------------------
 1788|      0|				return 0;
 1789|  25.3k|			break;
 1790|  25.3k|		case FILE_LESHORT:
  ------------------
  |  |  263|  12.1k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1790:3): [True: 12.1k, False: 829k]
  ------------------
 1791|  12.1k|			if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1791:8): [True: 1.14k, False: 10.9k]
  ------------------
 1792|  1.14k|				return 0;
 1793|  10.9k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p->hs)), off))
  ------------------
  |  |  108|  10.9k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 10.9k]
  |  |  ------------------
  |  |  109|  10.9k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  10.9k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  10.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1793:8): [True: 0, False: 10.9k]
  ------------------
 1794|      0|				return 0;
 1795|  10.9k|			break;
 1796|  10.9k|		case FILE_SHORT:
  ------------------
  |  |  255|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1796:3): [True: 0, False: 841k]
  ------------------
 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.39k|		case FILE_BELONG:
  ------------------
  |  |  261|  8.39k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1802:3): [True: 8.39k, False: 833k]
  ------------------
 1803|  8.51k|		case FILE_BEID3:
  ------------------
  |  |  292|  8.51k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1803:3): [True: 125, False: 841k]
  ------------------
 1804|  8.51k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1804:8): [True: 136, False: 8.37k]
  ------------------
 1805|    136|				return 0;
 1806|  8.37k|			lhs = BE32(p->hl);
  ------------------
  |  |   95|  8.37k|#define BE32(p) ( \
  |  |   96|  8.37k|    (CAST(uint32_t, (p)[0])<<24)| \
  |  |  ------------------
  |  |  |  |  460|  8.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   97|  8.37k|    (CAST(uint32_t, (p)[1])<<16)| \
  |  |  ------------------
  |  |  |  |  460|  8.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  8.37k|    (CAST(uint32_t, (p)[2])<<8)| \
  |  |  ------------------
  |  |  |  |  460|  8.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  8.37k|    (CAST(uint32_t, (p)[3])))
  |  |  ------------------
  |  |  |  |  460|  8.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1807|  8.37k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  292|  8.37k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1807:8): [True: 116, False: 8.26k]
  ------------------
 1808|    116|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  460|    116|#define CAST(T, b)	((T)(b))
  ------------------
 1809|  8.37k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|  8.37k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 8.37k]
  |  |  ------------------
  |  |  109|  8.37k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  8.37k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  8.37k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1809:8): [True: 581, False: 7.79k]
  ------------------
 1810|    581|				return 0;
 1811|  7.79k|			break;
 1812|   760k|		case FILE_LELONG:
  ------------------
  |  |  264|   760k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1812:3): [True: 760k, False: 81.5k]
  ------------------
 1813|   760k|		case FILE_LEID3:
  ------------------
  |  |  293|   760k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1813:3): [True: 0, False: 841k]
  ------------------
 1814|   760k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1814:8): [True: 296k, False: 463k]
  ------------------
 1815|   296k|				return 0;
 1816|   463k|			lhs = LE32(p->hl);
  ------------------
  |  |   90|   463k|#define LE32(p) ( \
  |  |   91|   463k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  460|   463k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|   463k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  460|   463k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|   463k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  460|   463k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|   463k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  460|   463k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1817|   463k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  293|   463k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1817:8): [True: 0, False: 463k]
  ------------------
 1818|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  460|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1819|   463k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  108|   463k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 463k]
  |  |  ------------------
  |  |  109|   463k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|   463k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|   463k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1819:8): [True: 7.78k, False: 455k]
  ------------------
 1820|  7.78k|				return 0;
 1821|   455k|			break;
 1822|   455k|		case FILE_MELONG:
  ------------------
  |  |  276|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1822:3): [True: 0, False: 841k]
  ------------------
 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.81k|		case FILE_LONG:
  ------------------
  |  |  257|  3.81k|#define				FILE_LONG		4
  ------------------
  |  Branch (1828:3): [True: 3.81k, False: 838k]
  ------------------
 1829|  3.81k|			if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1829:8): [True: 409, False: 3.40k]
  ------------------
 1830|    409|				return 0;
 1831|  3.40k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  108|  3.40k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 3.40k]
  |  |  ------------------
  |  |  109|  3.40k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|  3.40k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|  3.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1831:8): [True: 137, False: 3.27k]
  ------------------
 1832|    137|				return 0;
 1833|  3.27k|			break;
 1834|  3.27k|		case FILE_LEQUAD:
  ------------------
  |  |  278|    174|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1834:3): [True: 174, False: 841k]
  ------------------
 1835|    174|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1835:8): [True: 0, False: 174]
  ------------------
 1836|      0|				return 0;
 1837|    174|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p->hq)), off))	
  ------------------
  |  |  108|    174|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 174]
  |  |  ------------------
  |  |  109|    174|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    174|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    174|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1837:8): [True: 92, False: 82]
  ------------------
 1838|     92|				return 0;
 1839|     82|			break;
 1840|    336|		case FILE_BEQUAD:
  ------------------
  |  |  279|    336|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1840:3): [True: 336, False: 841k]
  ------------------
 1841|    336|			if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1841:8): [True: 0, False: 336]
  ------------------
 1842|      0|				return 0;
 1843|    336|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p->hq)), off))
  ------------------
  |  |  108|    336|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 336]
  |  |  ------------------
  |  |  109|    336|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    336|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    336|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1843:8): [True: 213, False: 123]
  ------------------
 1844|    213|				return 0;
 1845|    123|			break;
 1846|    300|		case FILE_OCTAL:
  ------------------
  |  |  314|    300|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1846:3): [True: 300, False: 841k]
  ------------------
 1847|    300|			if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1847:8): [True: 114, False: 186]
  ------------------
 1848|    114|				return 0;
 1849|    186|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1849:7): [True: 67, False: 119]
  ------------------
 1850|    186|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  108|    186|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (108:22): [True: 0, False: 186]
  |  |  ------------------
  |  |  109|    186|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  110|    186|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  460|    186|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1851|     67|				return 0;
 1852|    119|			break;
 1853|    119|		default:
  ------------------
  |  Branch (1853:3): [True: 0, False: 841k]
  ------------------
 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|   841k|		}
 1858|       |
 1859|   534k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  236|   534k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1859:7): [True: 2.09k, False: 532k]
  ------------------
 1860|  2.09k|			if (cont_level == 0) {
  ------------------
  |  Branch (1860:8): [True: 0, False: 2.09k]
  ------------------
 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.09k|			offset += ms->c.li[cont_level - 1].off;
 1867|  2.09k|			if (offset == 0) {
  ------------------
  |  Branch (1867:8): [True: 96, False: 1.99k]
  ------------------
 1868|     96|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     96|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1868:9): [True: 0, False: 96]
  ------------------
 1869|      0|					fprintf(stderr,
 1870|      0|					    "indirect *zero* offset\n");
 1871|     96|				return 0;
 1872|     96|			}
 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|   534k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1876:7): [True: 0, False: 534k]
  ------------------
 1877|      0|			return -1;
 1878|   534k|		ms->offset = offset;
 1879|       |
 1880|   534k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   534k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1880:7): [True: 0, False: 534k]
  ------------------
 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|   534k|	}
 1888|       |
 1889|       |	/* Verify we have enough data to match magic type */
 1890|   117M|	switch (m->type) {
 1891|  1.99M|	case FILE_BYTE:
  ------------------
  |  |  254|  1.99M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1891:2): [True: 1.99M, False: 115M]
  ------------------
 1892|  1.99M|		if (offset_oob(nbytes, offset, 1))
  ------------------
  |  Branch (1892:7): [True: 189k, False: 1.80M]
  ------------------
 1893|   189k|			return 0;
 1894|  1.80M|		break;
 1895|       |
 1896|  2.18M|	case FILE_SHORT:
  ------------------
  |  |  255|  2.18M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1896:2): [True: 2.18M, False: 115M]
  ------------------
 1897|  6.97M|	case FILE_BESHORT:
  ------------------
  |  |  260|  6.97M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1897:2): [True: 4.78M, False: 112M]
  ------------------
 1898|  11.6M|	case FILE_LESHORT:
  ------------------
  |  |  263|  11.6M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1898:2): [True: 4.71M, False: 112M]
  ------------------
 1899|  11.6M|		if (offset_oob(nbytes, offset, 2))
  ------------------
  |  Branch (1899:7): [True: 945k, False: 10.7M]
  ------------------
 1900|   945k|			return 0;
 1901|  10.7M|		break;
 1902|       |
 1903|  10.7M|	case FILE_LONG:
  ------------------
  |  |  257|  1.72M|#define				FILE_LONG		4
  ------------------
  |  Branch (1903:2): [True: 1.72M, False: 115M]
  ------------------
 1904|  16.3M|	case FILE_BELONG:
  ------------------
  |  |  261|  16.3M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1904:2): [True: 14.6M, False: 102M]
  ------------------
 1905|  23.9M|	case FILE_LELONG:
  ------------------
  |  |  264|  23.9M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1905:2): [True: 7.55M, False: 109M]
  ------------------
 1906|  23.9M|	case FILE_MELONG:
  ------------------
  |  |  276|  23.9M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1906:2): [True: 34, False: 117M]
  ------------------
 1907|  23.9M|	case FILE_DATE:
  ------------------
  |  |  259|  23.9M|#define				FILE_DATE		6
  ------------------
  |  Branch (1907:2): [True: 0, False: 117M]
  ------------------
 1908|  23.9M|	case FILE_BEDATE:
  ------------------
  |  |  262|  23.9M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1908:2): [True: 458, False: 117M]
  ------------------
 1909|  23.9M|	case FILE_LEDATE:
  ------------------
  |  |  265|  23.9M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1909:2): [True: 998, False: 117M]
  ------------------
 1910|  23.9M|	case FILE_MEDATE:
  ------------------
  |  |  274|  23.9M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1910:2): [True: 40, False: 117M]
  ------------------
 1911|  23.9M|	case FILE_LDATE:
  ------------------
  |  |  267|  23.9M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1911:2): [True: 0, False: 117M]
  ------------------
 1912|  23.9M|	case FILE_BELDATE:
  ------------------
  |  |  268|  23.9M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1912:2): [True: 339, False: 117M]
  ------------------
 1913|  23.9M|	case FILE_LELDATE:
  ------------------
  |  |  269|  23.9M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1913:2): [True: 65, False: 117M]
  ------------------
 1914|  23.9M|	case FILE_MELDATE:
  ------------------
  |  |  275|  23.9M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1914:2): [True: 0, False: 117M]
  ------------------
 1915|  23.9M|	case FILE_FLOAT:
  ------------------
  |  |  286|  23.9M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1915:2): [True: 0, False: 117M]
  ------------------
 1916|  23.9M|	case FILE_BEFLOAT:
  ------------------
  |  |  287|  23.9M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1916:2): [True: 0, False: 117M]
  ------------------
 1917|  23.9M|	case FILE_LEFLOAT:
  ------------------
  |  |  288|  23.9M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1917:2): [True: 3.29k, False: 117M]
  ------------------
 1918|  23.9M|		if (offset_oob(nbytes, offset, 4))
  ------------------
  |  Branch (1918:7): [True: 2.30M, False: 21.6M]
  ------------------
 1919|  2.30M|			return 0;
 1920|  21.6M|		break;
 1921|       |
 1922|  21.6M|	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1922:2): [True: 0, False: 117M]
  ------------------
 1923|    225|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|    225|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1923:2): [True: 225, False: 117M]
  ------------------
 1924|  1.53k|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|  1.53k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1924:2): [True: 1.31k, False: 117M]
  ------------------
 1925|  1.53k|		if (offset_oob(nbytes, offset, 8))
  ------------------
  |  Branch (1925:7): [True: 816, False: 722]
  ------------------
 1926|    816|			return 0;
 1927|    722|		break;
 1928|       |
 1929|    722|	case FILE_LEGUID:
  ------------------
  |  |  303|      0|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1929:2): [True: 0, False: 117M]
  ------------------
 1930|    139|	case FILE_BEGUID:
  ------------------
  |  |  304|    139|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1930:2): [True: 139, False: 117M]
  ------------------
 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.1k, False: 189k]
  ------------------
 1933|  24.1k|			return 0;
 1934|   189k|		break;
 1935|       |
 1936|  75.1M|	case FILE_STRING:
  ------------------
  |  |  258|  75.1M|#define				FILE_STRING		5
  ------------------
  |  Branch (1936:2): [True: 75.1M, False: 42.2M]
  ------------------
 1937|  75.1M|	case FILE_PSTRING:
  ------------------
  |  |  266|  75.1M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1937:2): [True: 35.2k, False: 117M]
  ------------------
 1938|  76.3M|	case FILE_SEARCH:
  ------------------
  |  |  273|  76.3M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1938:2): [True: 1.18M, False: 116M]
  ------------------
 1939|  76.3M|	case FILE_OCTAL:
  ------------------
  |  |  314|  76.3M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1939:2): [True: 0, False: 117M]
  ------------------
 1940|  76.3M|		if (offset_oob(nbytes, offset, m->vallen))
  ------------------
  |  Branch (1940:7): [True: 13.5M, False: 62.7M]
  ------------------
 1941|  13.5M|			return 0;
 1942|  62.7M|		break;
 1943|       |
 1944|  62.7M|	case FILE_REGEX:
  ------------------
  |  |  270|   497k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1944:2): [True: 497k, False: 116M]
  ------------------
 1945|   497k|		if (nbytes < offset)
  ------------------
  |  Branch (1945:7): [True: 1.19k, False: 496k]
  ------------------
 1946|  1.19k|			return 0;
 1947|   496k|		break;
 1948|       |
 1949|   496k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  21.5k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1949:2): [True: 21.5k, False: 117M]
  ------------------
 1950|  21.5k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  390|  21.5k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  443|  21.5k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  403|  21.5k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1950:7): [True: 12.1k, False: 9.36k]
  ------------------
 1951|  12.1k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  460|  12.1k|#define CAST(T, b)	((T)(b))
  ------------------
 1952|  21.5k|		if (offset == 0)
  ------------------
  |  Branch (1952:7): [True: 1.34k, False: 20.1k]
  ------------------
 1953|  1.34k|			return 0;
 1954|       |
 1955|  20.1k|		if (nbytes < offset)
  ------------------
  |  Branch (1955:7): [True: 1.92k, False: 18.2k]
  ------------------
 1956|  1.92k|			return 0;
 1957|       |
 1958|  18.2k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1958:7): [True: 0, False: 18.2k]
  ------------------
 1959|      0|			return -1;
 1960|       |
 1961|  18.2k|		(*indir_count)++;
 1962|  18.2k|		sbb = *b;
 1963|  18.2k|		sbb.fbuf = s + offset;
 1964|  18.2k|		sbb.flen = nbytes - offset;
 1965|  18.2k|		sbb.ebuf = NULL;
 1966|  18.2k|		sbb.elen = 0;
 1967|  18.2k|		rv = -1;
 1968|  20.6k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1968:34): [True: 18.2k, False: 2.46k]
  ------------------
 1969|  18.2k|		    mlp = mlp->next)
 1970|  18.2k|		{
 1971|  18.2k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1971:8): [True: 15.7k, False: 2.46k]
  ------------------
 1972|  18.2k|			    mlp->nmagic, &sbb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  239|  18.2k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1973|  18.2k|			    name_count, printed_something, need_separator,
 1974|  18.2k|			    firstline, NULL, NULL)) != 0)
 1975|  15.7k|				break;
 1976|  18.2k|		}
 1977|  18.2k|		buffer_fini(&sbb);
 1978|       |
 1979|  18.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  18.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1979:7): [True: 0, False: 18.2k]
  ------------------
 1980|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1981|       |
 1982|  18.2k|		rbuf = file_pop_buffer(ms, pb);
 1983|  18.2k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  495|  3.45k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1983:7): [True: 3.45k, False: 14.7k]
  |  Branch (1983:23): [True: 1.85k, False: 1.59k]
  ------------------
 1984|  1.85k|			return -1;
 1985|       |
 1986|  16.3k|		if (rv == 1) {
  ------------------
  |  Branch (1986:7): [True: 13.9k, False: 2.46k]
  ------------------
 1987|  13.9k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  13.9k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  13.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  13.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  13.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  13.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1987:8): [True: 13.9k, False: 0]
  ------------------
 1988|  13.9k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  167|  13.9k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1988:8): [True: 0, False: 13.9k]
  ------------------
 1989|      0|				goto out;
 1990|  13.9k|			if (rbuf && file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1990:8): [True: 13.9k, False: 0]
  |  Branch (1990:16): [True: 132, False: 13.7k]
  ------------------
 1991|    132|out:				free(rbuf);
 1992|    132|				return -1;
 1993|    132|			}
 1994|  13.9k|		}
 1995|  16.2k|		free(rbuf);
 1996|  16.2k|		return rv;
 1997|       |
 1998|  75.7k|	case FILE_USE:
  ------------------
  |  |  299|  75.7k|#define				FILE_USE		46
  ------------------
  |  Branch (1998:2): [True: 75.7k, False: 117M]
  ------------------
 1999|  75.7k|		if (nbytes < offset)
  ------------------
  |  Branch (1999:7): [True: 9.59k, False: 66.2k]
  ------------------
 2000|  9.59k|			return 0;
 2001|  66.2k|		rbuf = m->value.s;
 2002|  66.2k|		if (*rbuf == '^') {
  ------------------
  |  Branch (2002:7): [True: 547, False: 65.6k]
  ------------------
 2003|    547|			rbuf++;
 2004|    547|			flip = !flip;
 2005|    547|		}
 2006|  66.2k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (2006:7): [True: 0, False: 66.2k]
  ------------------
 2007|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 2008|      0|			return -1;
 2009|      0|		}
 2010|  66.2k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (2010:7): [True: 0, False: 66.2k]
  ------------------
 2011|      0|			file_error(ms, errno, "can't allocate continuation");
 2012|      0|			return -1;
 2013|      0|		}
 2014|       |
 2015|  66.2k|		oneed_separator = *need_separator;
 2016|  66.2k|		if (m->flag & NOSPACE)
  ------------------
  |  |  238|  66.2k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (2016:7): [True: 12.3k, False: 53.8k]
  ------------------
 2017|  12.3k|			*need_separator = 0;
 2018|       |
 2019|  66.2k|		nfound_match = 0;
 2020|  66.2k|		(*name_count)++;
 2021|  66.2k|		eoffset = ms->eoffset;
 2022|  66.2k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 2023|  66.2k|		    offset + o, mode, text, flip, indir_count, name_count,
 2024|  66.2k|		    printed_something, need_separator, firstline, returnval,
 2025|  66.2k|		    &nfound_match);
 2026|  66.2k|		ms->ms_value.q = nfound_match;
 2027|  66.2k|		(*name_count)--;
 2028|  66.2k|		*found_match |= nfound_match;
 2029|       |
 2030|  66.2k|		restore_cont(ms, &c);
 2031|       |
 2032|  66.2k|		if (rv != 1)
  ------------------
  |  Branch (2032:7): [True: 6.10k, False: 60.0k]
  ------------------
 2033|  6.10k|		    *need_separator = oneed_separator;
 2034|  66.2k|		ms->offset = offset;
 2035|  66.2k|		ms->eoffset = eoffset;
 2036|  66.2k|		return rv ? rv : *found_match;
  ------------------
  |  Branch (2036:10): [True: 61.2k, False: 4.93k]
  ------------------
 2037|       |
 2038|  66.2k|	case FILE_NAME:
  ------------------
  |  |  298|  66.2k|#define				FILE_NAME		45
  ------------------
  |  Branch (2038:2): [True: 66.2k, False: 117M]
  ------------------
 2039|  66.2k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  66.2k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  66.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  66.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  66.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  66.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  66.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (2039:7): [True: 0, False: 66.2k]
  ------------------
 2040|      0|			return 1;
 2041|  66.2k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (2041:7): [True: 0, False: 66.2k]
  ------------------
 2042|      0|			return -1;
 2043|  66.2k|		return 1;
 2044|   412k|	case FILE_DER:
  ------------------
  |  |  301|   412k|#define				FILE_DER		48
  ------------------
  |  Branch (2044:2): [True: 412k, False: 117M]
  ------------------
 2045|   425k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  256|   425k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2045:2): [True: 13.1k, False: 117M]
  ------------------
 2046|   429k|	case FILE_CLEAR:
  ------------------
  |  |  300|   429k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2046:2): [True: 3.25k, False: 117M]
  ------------------
 2047|  2.54M|	default:
  ------------------
  |  Branch (2047:2): [True: 2.11M, False: 115M]
  ------------------
 2048|  2.54M|		break;
 2049|   117M|	}
 2050|   100M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (2050:6): [True: 82, False: 100M]
  ------------------
 2051|     82|		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: 117M, False: 842k]
  ------------------
 1387|   117M|		switch (type) {
 1388|   412k|		case FILE_DER:
  ------------------
  |  |  301|   412k|#define				FILE_DER		48
  ------------------
  |  Branch (1388:3): [True: 412k, False: 117M]
  ------------------
 1389|  1.60M|		case FILE_SEARCH:
  ------------------
  |  |  273|  1.60M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1389:3): [True: 1.18M, False: 116M]
  ------------------
 1390|  1.60M|			if (offset > nbytes)
  ------------------
  |  Branch (1390:8): [True: 70.6k, False: 1.53M]
  ------------------
 1391|  70.6k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  460|  70.6k|#define CAST(T, b)	((T)(b))
  ------------------
 1392|  1.60M|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  461|  1.60M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1393|  1.60M|			ms->search.s_len = nbytes - offset;
 1394|  1.60M|			ms->search.offset = offset;
 1395|  1.60M|			return 0;
 1396|       |
 1397|   497k|		case FILE_REGEX: {
  ------------------
  |  |  270|   497k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1397:3): [True: 497k, False: 116M]
  ------------------
 1398|   497k|			const char *b;
 1399|   497k|			const char *c;
 1400|   497k|			const char *last;	/* end of search region */
 1401|   497k|			const char *buf;	/* start of search region */
 1402|   497k|			const char *end;
 1403|   497k|			size_t lines, linecnt, bytecnt;
 1404|       |
 1405|   497k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1405:8): [True: 0, False: 497k]
  |  Branch (1405:21): [True: 1.22k, False: 496k]
  ------------------
 1406|  1.22k|				ms->search.s_len = 0;
 1407|  1.22k|				ms->search.s = NULL;
 1408|  1.22k|				return 0;
 1409|  1.22k|			}
 1410|       |
 1411|   496k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  390|   496k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  417|   496k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  403|   496k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1411:8): [True: 63.8k, False: 432k]
  ------------------
 1412|  63.8k|				linecnt = m->str_range;
  ------------------
  |  |  389|  63.8k|#define str_range _u._s._count
  ------------------
 1413|  63.8k|				bytecnt = linecnt * 80;
 1414|   432k|			} else {
 1415|   432k|				linecnt = 0;
 1416|   432k|				bytecnt = m->str_range;
  ------------------
  |  |  389|   432k|#define str_range _u._s._count
  ------------------
 1417|   432k|			}
 1418|       |
 1419|   496k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1419:8): [True: 226k, False: 269k]
  |  Branch (1419:24): [True: 212k, False: 57.0k]
  ------------------
 1420|   439k|				bytecnt = nbytes - offset;
 1421|   496k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1421:8): [True: 36.6k, False: 459k]
  ------------------
 1422|  36.6k|				bytecnt = ms->regex_max;
 1423|       |
 1424|   496k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  461|   496k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1425|   496k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  461|   496k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1426|       |			/* mget() guarantees buf <= last */
 1427|   723k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1427:35): [True: 289k, False: 434k]
  |  Branch (1427:44): [True: 285k, False: 3.77k]
  ------------------
 1428|   285k|			     ((b = CAST(const char *,
  ------------------
  |  |  460|   285k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1428:10): [True: 110k, False: 175k]
  ------------------
 1429|   285k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1430|   175k|			     || (b = CAST(const char *,
  ------------------
  |  |  460|   175k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1430:12): [True: 117k, False: 57.9k]
  ------------------
 1431|   175k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1432|   496k|			     lines--, b++) {
 1433|   227k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1433:9): [True: 224k, False: 2.89k]
  |  Branch (1433:24): [True: 115k, False: 108k]
  |  Branch (1433:40): [True: 0, False: 115k]
  ------------------
 1434|      0|					b++;
 1435|   227k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1435:9): [True: 224k, False: 2.89k]
  |  Branch (1435:24): [True: 108k, False: 115k]
  ------------------
 1436|   108k|					b++;
 1437|   227k|				last = b;
 1438|   227k|			}
 1439|   496k|			if (lines)
  ------------------
  |  Branch (1439:8): [True: 61.7k, False: 434k]
  ------------------
 1440|  61.7k|				last = end;
 1441|       |
 1442|   496k|			ms->search.s = buf;
 1443|   496k|			ms->search.s_len = last - buf;
 1444|   496k|			ms->search.offset = offset;
 1445|   496k|			ms->search.rm_len = 0;
 1446|   496k|			return 0;
 1447|   497k|		}
 1448|    147|		case FILE_BESTRING16:
  ------------------
  |  |  271|    147|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1448:3): [True: 147, False: 117M]
  ------------------
 1449|  67.6k|		case FILE_LESTRING16: {
  ------------------
  |  |  272|  67.6k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1449:3): [True: 67.5k, False: 117M]
  ------------------
 1450|  67.6k|			const unsigned char *src = s + offset;
 1451|  67.6k|			const unsigned char *esrc = s + nbytes;
 1452|  67.6k|			char *dst = p->s;
 1453|  67.6k|			char *edst = &p->s[sizeof(p->s) - 1];
 1454|       |
 1455|  67.6k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  271|  67.6k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1455:8): [True: 147, False: 67.5k]
  ------------------
 1456|    147|				src++;
 1457|       |
 1458|       |			/* check that offset is within range */
 1459|  67.6k|			if (offset >= nbytes)
  ------------------
  |  Branch (1459:8): [True: 1.67k, False: 65.9k]
  ------------------
 1460|  1.67k|				break;
 1461|  3.56M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1461:20): [True: 3.51M, False: 47.0k]
  ------------------
 1462|  3.51M|				if (dst < edst)
  ------------------
  |  Branch (1462:9): [True: 3.50M, False: 18.9k]
  ------------------
 1463|  3.50M|					*dst = *src;
 1464|  18.9k|				else
 1465|  18.9k|					break;
 1466|  3.50M|				if (*dst == '\0') {
  ------------------
  |  Branch (1466:9): [True: 1.67M, False: 1.83M]
  ------------------
 1467|  1.67M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  271|  1.67M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1467:10): [True: 3.74k, False: 1.66M]
  |  Branch (1467:10): [True: 739k, False: 930k]
  ------------------
 1468|  3.74k|					    *(src - 1) != '\0' :
 1469|  1.67M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1469:11): [True: 1.66M, False: 4.59k]
  ------------------
 1470|  1.66M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1470:10): [True: 739k, False: 922k]
  ------------------
 1471|   739k|						*dst = ' ';
 1472|  1.67M|				}
 1473|  3.50M|			}
 1474|  65.9k|			*edst = '\0';
 1475|  65.9k|			*dst = '\0';
 1476|  65.9k|			return 0;
 1477|  67.6k|		}
 1478|  75.1M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  258|  75.1M|#define				FILE_STRING		5
  ------------------
  |  Branch (1478:3): [True: 75.1M, False: 42.2M]
  ------------------
 1479|  75.1M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  266|  75.1M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1479:3): [True: 35.2k, False: 117M]
  ------------------
 1480|  75.1M|			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  389|  75.1M|#define str_range _u._s._count
  ------------------
              			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  389|  66.4k|#define str_range _u._s._count
  ------------------
  |  Branch (1480:8): [True: 66.4k, False: 75.1M]
  |  Branch (1480:29): [True: 66.4k, False: 0]
  ------------------
 1481|  66.4k|				size = m->str_range;
  ------------------
  |  |  389|  66.4k|#define str_range _u._s._count
  ------------------
 1482|  75.1M|			break;
 1483|  40.0M|		default:
  ------------------
  |  Branch (1483:3): [True: 40.0M, False: 77.3M]
  ------------------
 1484|  40.0M|			break;
 1485|   117M|		}
 1486|   117M|	}
 1487|       |
 1488|   116M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  305|   116M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1488:6): [True: 6.62k, False: 116M]
  ------------------
 1489|  6.62k|		(void)memset(p, '\0', sizeof(*p));
 1490|  6.62k|		p->q = offset;
 1491|  6.62k|		return 0;
 1492|  6.62k|	}
 1493|       |
 1494|   116M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1494:6): [True: 7.62M, False: 108M]
  ------------------
 1495|  7.62M|		(void)memset(p, '\0', sizeof(*p));
 1496|  7.62M|		return 0;
 1497|  7.62M|	}
 1498|   108M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1498:6): [True: 70.2M, False: 38.2M]
  ------------------
 1499|  70.2M|		nbytes = nbytes - offset;
 1500|  38.2M|	else
 1501|  38.2M|		nbytes = size;
 1502|       |
 1503|   108M|	(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|   108M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1509:6): [True: 70.2M, False: 38.1M]
  ------------------
 1510|  70.2M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  461|  70.2M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1511|  70.2M|		    sizeof(*p) - nbytes);
 1512|   108M|	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.48M, False: 108M]
  ------------------
  118|  6.48M|		return 1;
  119|   108M|        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.47k]
  ------------------
 1030|   101M|		return type;
 1031|  8.47k|	switch (type) {
 1032|     46|	case FILE_BESHORT:
  ------------------
  |  |  260|     46|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1032:2): [True: 46, False: 8.42k]
  ------------------
 1033|     46|		return FILE_LESHORT;
  ------------------
  |  |  263|     46|#define				FILE_LESHORT		10
  ------------------
 1034|  2.99k|	case FILE_BELONG:
  ------------------
  |  |  261|  2.99k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1034:2): [True: 2.99k, False: 5.47k]
  ------------------
 1035|  2.99k|		return FILE_LELONG;
  ------------------
  |  |  264|  2.99k|#define				FILE_LELONG		11
  ------------------
 1036|     34|	case FILE_BEDATE:
  ------------------
  |  |  262|     34|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1036:2): [True: 34, False: 8.44k]
  ------------------
 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.47k]
  ------------------
 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.41k]
  ------------------
 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.18k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 1047|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  296|      0|#define				FILE_LEQWDATE		43
  ------------------
 1048|  3.76k|	case FILE_LESHORT:
  ------------------
  |  |  263|  3.76k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1048:2): [True: 3.76k, False: 4.71k]
  ------------------
 1049|  3.76k|		return FILE_BESHORT;
  ------------------
  |  |  260|  3.76k|#define				FILE_BESHORT		7
  ------------------
 1050|    145|	case FILE_LELONG:
  ------------------
  |  |  264|    145|#define				FILE_LELONG		11
  ------------------
  |  Branch (1050:2): [True: 145, False: 8.33k]
  ------------------
 1051|    145|		return FILE_BELONG;
  ------------------
  |  |  261|    145|#define				FILE_BELONG		8
  ------------------
 1052|      0|	case FILE_LEDATE:
  ------------------
  |  |  265|      0|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1052:2): [True: 0, False: 8.47k]
  ------------------
 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.47k]
  ------------------
 1055|      0|		return FILE_BELDATE;
  ------------------
  |  |  268|      0|#define				FILE_BELDATE		15
  ------------------
 1056|     52|	case FILE_LEQUAD:
  ------------------
  |  |  278|     52|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1056:2): [True: 52, False: 8.42k]
  ------------------
 1057|     52|		return FILE_BEQUAD;
  ------------------
  |  |  279|     52|#define				FILE_BEQUAD		26
  ------------------
 1058|      0|	case FILE_LEQDATE:
  ------------------
  |  |  281|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1058:2): [True: 0, False: 8.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 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.47k]
  ------------------
 1079|      0|		return FILE_BEMSDOSTIME;
  ------------------
  |  |  313|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
 1080|  1.09k|	default:
  ------------------
  |  Branch (1080:2): [True: 1.09k, False: 7.38k]
  ------------------
 1081|  1.09k|		return type;
 1082|  8.47k|	}
 1083|  8.47k|}
softmagic.c:do_ops:
 1518|   543k|{
 1519|   543k|	intmax_t offset;
 1520|       |	// On purpose not INTMAX_MAX
 1521|   543k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1521:6): [True: 8.02k, False: 535k]
  |  Branch (1521:25): [True: 157, False: 534k]
  ------------------
 1522|   534k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1522:6): [True: 194, False: 534k]
  |  Branch (1522:25): [True: 0, False: 534k]
  ------------------
 1523|  8.37k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  8.37k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1523:7): [True: 0, False: 8.37k]
  ------------------
 1524|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1525|  8.37k|		return 1;
 1526|  8.37k|	}
 1527|       |	   
 1528|   534k|	if (off) {
  ------------------
  |  Branch (1528:6): [True: 88.9k, False: 445k]
  ------------------
 1529|  88.9k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  360|  88.9k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1529:11): [True: 88.9k, False: 0]
  ------------------
 1530|     34|		case FILE_OPAND:
  ------------------
  |  |  352|     34|#define				FILE_OPAND	0
  ------------------
  |  Branch (1530:3): [True: 34, False: 88.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: 88.9k]
  ------------------
 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: 88.9k]
  ------------------
 1537|      0|			offset = lhs ^ off;
 1538|      0|			break;
 1539|  77.1k|		case FILE_OPADD:
  ------------------
  |  |  355|  77.1k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1539:3): [True: 77.1k, False: 11.8k]
  ------------------
 1540|  77.1k|			offset = lhs + off;
 1541|  77.1k|			break;
 1542|    878|		case FILE_OPMINUS:
  ------------------
  |  |  356|    878|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1542:3): [True: 878, False: 88.1k]
  ------------------
 1543|    878|			offset = lhs - off;
 1544|    878|			break;
 1545|  10.8k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  357|  10.8k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1545:3): [True: 10.8k, False: 78.1k]
  ------------------
 1546|  10.8k|			offset = lhs * off;
 1547|  10.8k|			break;
 1548|     74|		case FILE_OPDIVIDE:
  ------------------
  |  |  358|     74|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1548:3): [True: 74, False: 88.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: 88.9k]
  ------------------
 1552|      0|			offset = lhs % off;
 1553|      0|			break;
 1554|  88.9k|		}
 1555|  88.9k|	} else
 1556|   445k|		offset = lhs;
 1557|   534k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  364|   534k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1557:6): [True: 0, False: 534k]
  ------------------
 1558|      0|		offset = ~offset;
 1559|   534k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1559:6): [True: 498, False: 534k]
  ------------------
 1560|    498|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    498|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1560:7): [True: 0, False: 498]
  ------------------
 1561|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1562|    498|		return 1;
 1563|    498|	}
 1564|   534k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  460|   534k|#define CAST(T, b)	((T)(b))
  ------------------
 1565|   534k|	return 0;
 1566|   534k|}
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|   169k|{
  173|   169k|	const char *ptr;
  174|       |
  175|   169k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (175:6): [True: 112k, False: 56.7k]
  ------------------
  176|   112k|		return desc;
  177|       |
  178|  56.7k|	ptr = fmtcheck(desc, def);
  179|  56.7k|	if (ptr == def)
  ------------------
  |  Branch (179:6): [True: 0, False: 56.7k]
  ------------------
  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|  56.7k|	return ptr;
  184|   169k|}
softmagic.c:save_cont:
 1628|  66.2k|{
 1629|  66.2k|	size_t len;
 1630|  66.2k|	*c = ms->c;
 1631|  66.2k|	len = c->len * sizeof(*c->li);
 1632|  66.2k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  460|  66.2k|#define CAST(T, b)	((T)(b))
  ------------------
 1633|  66.2k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1633:6): [True: 0, False: 66.2k]
  ------------------
 1634|      0|		ms->c = *c;
 1635|      0|		return -1;
 1636|      0|	}
 1637|  66.2k|	memcpy(ms->c.li, c->li, len);
 1638|  66.2k|	return 0;
 1639|  66.2k|}
softmagic.c:restore_cont:
 1643|  66.2k|{
 1644|  66.2k|	free(ms->c.li);
 1645|  66.2k|	ms->c = *c;
 1646|  66.2k|}
softmagic.c:mconvert:
 1205|   100M|{
 1206|   100M|	union VALUETYPE *p = &ms->ms_value;
 1207|       |
 1208|   100M|	switch (cvt_flip(m->type, flip)) {
 1209|  1.80M|	case FILE_BYTE:
  ------------------
  |  |  254|  1.80M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1209:2): [True: 1.80M, False: 98.3M]
  ------------------
 1210|  1.80M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1210:7): [True: 0, False: 1.80M]
  ------------------
 1211|      0|			goto out;
 1212|  1.80M|		return 1;
 1213|  1.84M|	case FILE_SHORT:
  ------------------
  |  |  255|  1.84M|#define				FILE_SHORT		2
  ------------------
  |  Branch (1213:2): [True: 1.84M, False: 98.3M]
  ------------------
 1214|  1.84M|	case FILE_MSDOSDATE:
  ------------------
  |  |  308|  1.84M|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (1214:2): [True: 0, False: 100M]
  ------------------
 1215|  1.84M|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|  1.84M|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (1215:2): [True: 0, False: 100M]
  ------------------
 1216|  1.84M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1216:7): [True: 0, False: 1.84M]
  ------------------
 1217|      0|			goto out;
 1218|  1.84M|		return 1;
 1219|  1.59M|	case FILE_LONG:
  ------------------
  |  |  257|  1.59M|#define				FILE_LONG		4
  ------------------
  |  Branch (1219:2): [True: 1.59M, False: 98.6M]
  ------------------
 1220|  1.59M|	case FILE_DATE:
  ------------------
  |  |  259|  1.59M|#define				FILE_DATE		6
  ------------------
  |  Branch (1220:2): [True: 0, False: 100M]
  ------------------
 1221|  1.59M|	case FILE_LDATE:
  ------------------
  |  |  267|  1.59M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1221:2): [True: 0, False: 100M]
  ------------------
 1222|  1.59M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1222:7): [True: 0, False: 1.59M]
  ------------------
 1223|      0|			goto out;
 1224|  1.59M|		return 1;
 1225|  69.6k|	case FILE_QUAD:
  ------------------
  |  |  277|  69.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1225:2): [True: 69.6k, False: 100M]
  ------------------
 1226|  69.6k|	case FILE_QDATE:
  ------------------
  |  |  280|  69.6k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1226:2): [True: 0, False: 100M]
  ------------------
 1227|  69.6k|	case FILE_QLDATE:
  ------------------
  |  |  283|  69.6k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1227:2): [True: 0, False: 100M]
  ------------------
 1228|  70.0k|	case FILE_QWDATE:
  ------------------
  |  |  295|  70.0k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1228:2): [True: 376, False: 100M]
  ------------------
 1229|  76.6k|	case FILE_OFFSET:
  ------------------
  |  |  305|  76.6k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (1229:2): [True: 6.62k, False: 100M]
  ------------------
 1230|  76.6k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1230:7): [True: 0, False: 76.6k]
  ------------------
 1231|      0|			goto out;
 1232|  76.6k|		return 1;
 1233|  62.0M|	case FILE_STRING:
  ------------------
  |  |  258|  62.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (1233:2): [True: 62.0M, False: 38.1M]
  ------------------
 1234|  62.0M|	case FILE_BESTRING16:
  ------------------
  |  |  271|  62.0M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1234:2): [True: 147, False: 100M]
  ------------------
 1235|  62.1M|	case FILE_LESTRING16:
  ------------------
  |  |  272|  62.1M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1235:2): [True: 67.5k, False: 100M]
  ------------------
 1236|  62.1M|	case FILE_OCTAL: {
  ------------------
  |  |  314|  62.1M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (1236:2): [True: 0, False: 100M]
  ------------------
 1237|       |		/* Null terminate and eat *trailing* return */
 1238|  62.1M|		p->s[sizeof(p->s) - 1] = '\0';
 1239|  62.1M|		return 1;
 1240|  62.1M|	}
 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: 82, False: 26.1k]
  ------------------
 1250|     82|			return 0;
 1251|  26.1k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1252|  26.1k|		if (len >= sz) {
  ------------------
  |  Branch (1252:7): [True: 14.8k, 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.8k|			len = sz;
 1262|  14.8k|		}
 1263|  2.26M|		while (len--)
  ------------------
  |  Branch (1263:10): [True: 2.24M, False: 26.1k]
  ------------------
 1264|  2.24M|			*ptr1++ = *ptr2++;
 1265|  26.1k|		*ptr1 = '\0';
 1266|  26.1k|		return 1;
 1267|  26.2k|	}
 1268|  4.47M|	case FILE_BESHORT:
  ------------------
  |  |  260|  4.47M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1268:2): [True: 4.47M, False: 95.7M]
  ------------------
 1269|  4.47M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|  4.47M|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (1269:2): [True: 0, False: 100M]
  ------------------
 1270|  4.47M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|  4.47M|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (1270:2): [True: 0, False: 100M]
  ------------------
 1271|  4.47M|		p->h = CAST(short, BE16(p->hs));
  ------------------
  |  |  460|  4.47M|#define CAST(T, b)	((T)(b))
  ------------------
 1272|  4.47M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1272:7): [True: 0, False: 4.47M]
  ------------------
 1273|      0|			goto out;
 1274|  4.47M|		return 1;
 1275|  13.3M|	case FILE_BELONG:
  ------------------
  |  |  261|  13.3M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1275:2): [True: 13.3M, False: 86.8M]
  ------------------
 1276|  13.3M|	case FILE_BEDATE:
  ------------------
  |  |  262|  13.3M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1276:2): [True: 376, False: 100M]
  ------------------
 1277|  13.3M|	case FILE_BELDATE:
  ------------------
  |  |  268|  13.3M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1277:2): [True: 299, False: 100M]
  ------------------
 1278|  13.3M|		p->l = CAST(int32_t, BE32(p->hl));
  ------------------
  |  |  460|  13.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1279|  13.3M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1279:7): [True: 0, False: 13.3M]
  ------------------
 1280|      0|			goto out;
 1281|  13.3M|		return 1;
 1282|  1.07M|	case FILE_BEQUAD:
  ------------------
  |  |  279|  1.07M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1282:2): [True: 1.07M, False: 99.1M]
  ------------------
 1283|  1.07M|	case FILE_BEQDATE:
  ------------------
  |  |  282|  1.07M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1283:2): [True: 98, False: 100M]
  ------------------
 1284|  1.07M|	case FILE_BEQLDATE:
  ------------------
  |  |  285|  1.07M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1284:2): [True: 184, 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.41M|	case FILE_LESHORT:
  ------------------
  |  |  263|  4.41M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1290:2): [True: 4.41M, False: 95.7M]
  ------------------
 1291|  4.41M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|  4.41M|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (1291:2): [True: 212, False: 100M]
  ------------------
 1292|  4.41M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|  4.41M|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (1292:2): [True: 212, False: 100M]
  ------------------
 1293|  4.41M|		p->h = CAST(short, LE16(p->hs));
  ------------------
  |  |  460|  4.41M|#define CAST(T, b)	((T)(b))
  ------------------
 1294|  4.41M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1294:7): [True: 0, False: 4.41M]
  ------------------
 1295|      0|			goto out;
 1296|  4.41M|		return 1;
 1297|  6.63M|	case FILE_LELONG:
  ------------------
  |  |  264|  6.63M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1297:2): [True: 6.63M, False: 93.5M]
  ------------------
 1298|  6.63M|	case FILE_LEDATE:
  ------------------
  |  |  265|  6.63M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1298:2): [True: 979, False: 100M]
  ------------------
 1299|  6.63M|	case FILE_LELDATE:
  ------------------
  |  |  269|  6.63M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1299:2): [True: 34, False: 100M]
  ------------------
 1300|  6.63M|		p->l = CAST(int32_t, LE32(p->hl));
  ------------------
  |  |  460|  6.63M|#define CAST(T, b)	((T)(b))
  ------------------
 1301|  6.63M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1301:7): [True: 0, False: 6.63M]
  ------------------
 1302|      0|			goto out;
 1303|  6.63M|		return 1;
 1304|   895k|	case FILE_LEQUAD:
  ------------------
  |  |  278|   895k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1304:2): [True: 895k, False: 99.3M]
  ------------------
 1305|   896k|	case FILE_LEQDATE:
  ------------------
  |  |  281|   896k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1305:2): [True: 286, False: 100M]
  ------------------
 1306|   896k|	case FILE_LEQLDATE:
  ------------------
  |  |  284|   896k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1306:2): [True: 10, False: 100M]
  ------------------
 1307|   897k|	case FILE_LEQWDATE:
  ------------------
  |  |  296|   897k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1307:2): [True: 1.23k, False: 100M]
  ------------------
 1308|   897k|		p->q = CAST(uint64_t, LE64(p->hq));
  ------------------
  |  |  460|   897k|#define CAST(T, b)	((T)(b))
  ------------------
 1309|   897k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1309:7): [True: 0, False: 897k]
  ------------------
 1310|      0|			goto out;
 1311|   897k|		return 1;
 1312|     34|	case FILE_MELONG:
  ------------------
  |  |  276|     34|#define				FILE_MELONG		23
  ------------------
  |  Branch (1312:2): [True: 34, False: 100M]
  ------------------
 1313|     74|	case FILE_MEDATE:
  ------------------
  |  |  274|     74|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1313:2): [True: 40, False: 100M]
  ------------------
 1314|     74|	case FILE_MELDATE:
  ------------------
  |  |  275|     74|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1314:2): [True: 0, False: 100M]
  ------------------
 1315|     74|		p->l = CAST(int32_t, ME32(p->hl));
  ------------------
  |  |  460|     74|#define CAST(T, b)	((T)(b))
  ------------------
 1316|     74|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1316:7): [True: 0, False: 74]
  ------------------
 1317|      0|			goto out;
 1318|     74|		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.29k|	case FILE_LEFLOAT:
  ------------------
  |  |  288|  3.29k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1328:2): [True: 3.29k, False: 100M]
  ------------------
 1329|  3.29k|		p->l = LE32(p->hl);
  ------------------
  |  |   90|  3.29k|#define LE32(p) ( \
  |  |   91|  3.29k|    (CAST(uint32_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  460|  3.29k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   92|  3.29k|    (CAST(uint32_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  460|  3.29k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  3.29k|    (CAST(uint32_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  460|  3.29k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  3.29k|    (CAST(uint32_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  460|  3.29k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1330|  3.29k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1330:7): [True: 0, False: 3.29k]
  ------------------
 1331|      0|			goto out;
 1332|  3.29k|		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|    588|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    588|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1342:2): [True: 588, False: 100M]
  ------------------
 1343|    588|		p->q = LE64(p->hq);
  ------------------
  |  |   81|    588|#define LE64(p) ( \
  |  |   82|    588|    (CAST(uint64_t, (p)[7])<<56)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   83|    588|    (CAST(uint64_t, (p)[6])<<48)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    588|    (CAST(uint64_t, (p)[5])<<40)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    588|    (CAST(uint64_t, (p)[4])<<32)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    588|    (CAST(uint64_t, (p)[3])<<24)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    588|    (CAST(uint64_t, (p)[2])<<16)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    588|    (CAST(uint64_t, (p)[1])<<8)| \
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    588|    (CAST(uint64_t, (p)[0])))
  |  |  ------------------
  |  |  |  |  460|    588|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1344|    588|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1344:7): [True: 0, False: 588]
  ------------------
 1345|      0|			goto out;
 1346|    588|		return 1;
 1347|   496k|	case FILE_REGEX:
  ------------------
  |  |  270|   496k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1347:2): [True: 496k, False: 99.7M]
  ------------------
 1348|  1.20M|	case FILE_SEARCH:
  ------------------
  |  |  273|  1.20M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1348:2): [True: 703k, False: 99.4M]
  ------------------
 1349|  1.21M|	case FILE_DEFAULT:
  ------------------
  |  |  256|  1.21M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1349:2): [True: 13.1k, False: 100M]
  ------------------
 1350|  1.21M|	case FILE_CLEAR:
  ------------------
  |  |  300|  1.21M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1350:2): [True: 3.25k, 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.62M|	case FILE_DER:
  ------------------
  |  |  301|  1.62M|#define				FILE_DER		48
  ------------------
  |  Branch (1353:2): [True: 412k, False: 99.7M]
  ------------------
 1354|  1.81M|	case FILE_GUID:
  ------------------
  |  |  302|  1.81M|#define				FILE_GUID		49
  ------------------
  |  Branch (1354:2): [True: 189k, False: 100M]
  ------------------
 1355|  1.81M|	case FILE_LEGUID:
  ------------------
  |  |  303|  1.81M|#define				FILE_LEGUID		50
  ------------------
  |  Branch (1355:2): [True: 0, False: 100M]
  ------------------
 1356|  1.81M|	case FILE_BEGUID:
  ------------------
  |  |  304|  1.81M|#define				FILE_BEGUID		51
  ------------------
  |  Branch (1356:2): [True: 84, False: 100M]
  ------------------
 1357|  1.81M|		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.80M|{
 1140|  1.80M|	DO_CVT(m, b, 8);
  ------------------
  |  | 1131|  1.80M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  1.80M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 783k, False: 1.02M]
  |  |  ------------------
  |  | 1132|   783k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|   783k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|   783k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 102k, False: 680k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   783k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   102k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 102k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  85.3k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  85.3k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 85.3k, False: 17.0k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  85.3k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  85.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  85.3k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 102k]
  |  |  |  |  ------------------
  |  |  |  | 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: 102k]
  |  |  |  |  ------------------
  |  |  |  | 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: 102k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|  16.0k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  16.0k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 16.0k, False: 86.3k]
  |  |  |  |  ------------------
  |  |  |  | 1109|  16.0k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  16.0k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|  16.0k|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 102k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    495|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    495|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 495, False: 101k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    495|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    495|	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|    495|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 495]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    495|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    495|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    495|		return -1; \
  |  |  |  |  |  | 1090|    495|	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|    495|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 495]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    495|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    495|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    495|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    495|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    495|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 495]
  |  |  |  |  ------------------
  |  |  |  | 1117|    495|				return -1; \
  |  |  |  | 1118|    495|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    495|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    495|			break; \
  |  |  |  | 1120|    495|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|    494|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 494, False: 101k]
  |  |  |  |  ------------------
  |  |  |  | 1121|    494|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    494|	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|    494|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 494]
  |  |  |  |  |  |  |  Branch (1087:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    494|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    494|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    494|		return -1; \
  |  |  |  |  |  | 1090|    494|	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|    494|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 494]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    494|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    494|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    494|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    494|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    494|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 494]
  |  |  |  |  ------------------
  |  |  |  | 1123|    494|				return -1; \
  |  |  |  | 1124|    494|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    494|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    494|			break; \
  |  |  |  | 1126|   102k|		} \
  |  |  |  | 1127|   783k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|   783k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 783k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   783k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  1.02M|	} else { \
  |  | 1134|  1.02M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  1.02M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  1.02M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 46.9k, False: 978k]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.02M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|  46.9k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 46.9k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  38.3k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  38.3k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 38.3k, False: 8.53k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  38.3k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  38.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  38.3k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 46.9k]
  |  |  |  |  ------------------
  |  |  |  | 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: 46.9k]
  |  |  |  |  ------------------
  |  |  |  | 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: 46.9k]
  |  |  |  |  ------------------
  |  |  |  | 1106|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|      0|			break; \
  |  |  |  | 1108|  8.46k|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|  8.46k|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 8.46k, False: 38.4k]
  |  |  |  |  ------------------
  |  |  |  | 1109|  8.46k|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  8.46k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|  8.46k|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 46.9k]
  |  |  |  |  ------------------
  |  |  |  | 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: 46.8k]
  |  |  |  |  ------------------
  |  |  |  | 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: 46.9k]
  |  |  |  |  ------------------
  |  |  |  | 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|  46.9k|		} \
  |  |  |  | 1127|  1.02M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  1.02M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.02M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.02M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  1.02M|	}
  ------------------
 1141|  1.80M|	return 0;
 1142|  1.80M|}
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.39M, False: 9.34M]
  |  |  ------------------
  |  | 1132|  1.39M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|  1.39M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  1.39M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 137k, False: 1.25M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.39M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   137k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 137k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   137k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   137k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 137k, False: 619]
  |  |  |  |  ------------------
  |  |  |  | 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: 137k]
  |  |  |  |  ------------------
  |  |  |  | 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: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     66|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|     66|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 66, False: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     66|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     66|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     66|			break; \
  |  |  |  | 1108|    147|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|    147|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 147, False: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1109|    147|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    147|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|    147|			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: 137k]
  |  |  |  |  ------------------
  |  |  |  | 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|   137k|		} \
  |  |  |  | 1127|  1.39M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  1.39M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.39M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.39M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  9.34M|	} else { \
  |  | 1134|  9.34M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  9.34M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  9.34M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 499k, False: 8.84M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  9.34M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   499k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 499k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   470k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   470k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 470k, False: 28.7k]
  |  |  |  |  ------------------
  |  |  |  | 1097|   470k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   470k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   470k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 499k]
  |  |  |  |  ------------------
  |  |  |  | 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: 499k]
  |  |  |  |  ------------------
  |  |  |  | 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: 499k]
  |  |  |  |  ------------------
  |  |  |  | 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: 499k]
  |  |  |  |  ------------------
  |  |  |  | 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: 499k]
  |  |  |  |  ------------------
  |  |  |  | 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: 499k]
  |  |  |  |  ------------------
  |  |  |  | 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.6k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|  28.6k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 28.6k, False: 471k]
  |  |  |  |  ------------------
  |  |  |  | 1121|  28.6k|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  28.6k|	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.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 28.6k]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|  28.6k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  28.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|  28.6k|		return -1; \
  |  |  |  |  |  | 1090|  28.6k|	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.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 28.6k]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|  28.6k|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|  28.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|  28.6k|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|  28.6k|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  28.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 28.6k]
  |  |  |  |  ------------------
  |  |  |  | 1123|  28.6k|				return -1; \
  |  |  |  | 1124|  28.6k|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  28.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|  28.6k|			break; \
  |  |  |  | 1126|   499k|		} \
  |  |  |  | 1127|  9.34M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  9.34M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 9.34M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  9.34M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  9.34M|	}
  ------------------
 1148|  10.7M|	return 0;
 1149|  10.7M|}
softmagic.c:cvt_32:
 1153|  21.6M|{
 1154|  21.6M|	DO_CVT(m, l, 32);
  ------------------
  |  | 1131|  21.6M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  21.6M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 3.16M, False: 18.4M]
  |  |  ------------------
  |  | 1132|  3.16M|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|  3.16M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  3.16M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 482k, False: 2.68M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  3.16M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   482k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 482k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   481k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   481k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 481k, False: 1.24k]
  |  |  |  |  ------------------
  |  |  |  | 1097|   481k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   481k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   481k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 482k]
  |  |  |  |  ------------------
  |  |  |  | 1100|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1101|      0|			break; \
  |  |  |  | 1102|    105|		case FILE_OPXOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  354|    105|#define				FILE_OPXOR	2
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1102:3): [True: 105, False: 482k]
  |  |  |  |  ------------------
  |  |  |  | 1103|    105|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    105|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|    105|			break; \
  |  |  |  | 1105|    181|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|    181|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 181, False: 482k]
  |  |  |  |  ------------------
  |  |  |  | 1106|    181|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    181|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|    181|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 482k]
  |  |  |  |  ------------------
  |  |  |  | 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: 482k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    603|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    603|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 603, False: 481k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    603|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    603|	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|    603|#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|    603|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    603|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    603|		return -1; \
  |  |  |  |  |  | 1090|    603|	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|    603|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 603]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    603|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    603|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    603|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    603|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    603|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 603]
  |  |  |  |  ------------------
  |  |  |  | 1117|    603|				return -1; \
  |  |  |  | 1118|    603|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    603|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    603|			break; \
  |  |  |  | 1120|    603|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|    360|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 360, False: 481k]
  |  |  |  |  ------------------
  |  |  |  | 1121|    360|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    360|	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|    360|#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|    360|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    360|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    360|		return -1; \
  |  |  |  |  |  | 1090|    360|	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|    360|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 360]
  |  |  |  |  |  |  |  Branch (1090:20): [Folded, False: 0]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    360|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    360|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    360|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    360|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    360|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 360]
  |  |  |  |  ------------------
  |  |  |  | 1123|    360|				return -1; \
  |  |  |  | 1124|    360|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    360|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    360|			break; \
  |  |  |  | 1126|   482k|		} \
  |  |  |  | 1127|  3.16M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  3.16M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 3.16M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  3.16M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  18.4M|	} else { \
  |  | 1134|  18.4M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  18.4M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.4M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 3.26M, False: 15.2M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  18.4M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|  3.26M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 3.26M, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  3.26M|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  3.26M|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 3.26M, False: 417]
  |  |  |  |  ------------------
  |  |  |  | 1097|  3.26M|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  3.26M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  3.26M|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 3.26M]
  |  |  |  |  ------------------
  |  |  |  | 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.26M]
  |  |  |  |  ------------------
  |  |  |  | 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.26M]
  |  |  |  |  ------------------
  |  |  |  | 1106|     34|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     34|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     34|			break; \
  |  |  |  | 1108|    185|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|    185|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 185, False: 3.26M]
  |  |  |  |  ------------------
  |  |  |  | 1109|    185|			p->fld -= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    185|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1110|    185|			break; \
  |  |  |  | 1111|      0|		case FILE_OPMULTIPLY: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define				FILE_OPMULTIPLY	5
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1111:3): [True: 0, False: 3.26M]
  |  |  |  |  ------------------
  |  |  |  | 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.26M]
  |  |  |  |  ------------------
  |  |  |  | 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|    198|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|    198|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 198, False: 3.26M]
  |  |  |  |  ------------------
  |  |  |  | 1121|    198|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    198|	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    198|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 32 && sign && CAST(type, a) == CAST(type, 0x80000000) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    396|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 70, False: 128]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    198|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     70|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    268|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 70]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    198|		return -1; \
  |  |  |  |  |  | 1090|    198|	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|    198|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [Folded, False: 198]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    198|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    198|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    198|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1122|    198|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    198|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:8): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  |  | 1123|    198|				return -1; \
  |  |  |  | 1124|    198|			p->fld %= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    198|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1125|    198|			break; \
  |  |  |  | 1126|  3.26M|		} \
  |  |  |  | 1127|  18.4M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  18.4M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 18.4M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  18.4M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  18.4M|	}
  ------------------
 1155|  21.6M|	return 0;
 1156|  21.6M|}
softmagic.c:cvt_64:
 1160|  2.04M|{
 1161|  2.04M|	DO_CVT(m, q, 64);
  ------------------
  |  | 1131|  2.04M|	if ((m)->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  2.04M|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (1131:6): [True: 774k, False: 1.27M]
  |  |  ------------------
  |  | 1132|   774k|		DO_CVT1(fld, uint##size##_t, size, 0); \
  |  |  ------------------
  |  |  |  | 1094|   774k|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|   774k|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 234k, False: 539k]
  |  |  |  |  ------------------
  |  |  |  | 1095|   774k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|   234k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 234k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|   234k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|   234k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 234k, False: 38]
  |  |  |  |  ------------------
  |  |  |  | 1097|   234k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|   234k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|   234k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 234k]
  |  |  |  |  ------------------
  |  |  |  | 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: 234k]
  |  |  |  |  ------------------
  |  |  |  | 1103|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1104|      0|			break; \
  |  |  |  | 1105|     38|		case FILE_OPADD: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  355|     38|#define				FILE_OPADD	3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1105:3): [True: 38, False: 234k]
  |  |  |  |  ------------------
  |  |  |  | 1106|     38|			p->fld += CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|     38|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1107|     38|			break; \
  |  |  |  | 1108|      0|		case FILE_OPMINUS: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  356|      0|#define				FILE_OPMINUS	4
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1108:3): [True: 0, False: 234k]
  |  |  |  |  ------------------
  |  |  |  | 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: 234k]
  |  |  |  |  ------------------
  |  |  |  | 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: 234k]
  |  |  |  |  ------------------
  |  |  |  | 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: 234k]
  |  |  |  |  ------------------
  |  |  |  | 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|   234k|		} \
  |  |  |  | 1127|   774k|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|   774k|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 774k]
  |  |  |  |  ------------------
  |  |  |  | 1128|   774k|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1133|  1.27M|	} else { \
  |  | 1134|  1.27M|		DO_CVT1(s##fld, int##size##_t, size, 1); \
  |  |  ------------------
  |  |  |  | 1094|  1.27M|	if (m->num_mask) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  1.27M|#define num_mask _u._mask
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1094:6): [True: 35.1k, False: 1.23M]
  |  |  |  |  ------------------
  |  |  |  | 1095|  1.27M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  360|  35.1k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1095:11): [True: 35.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1096|  33.3k|		case FILE_OPAND: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  352|  33.3k|#define				FILE_OPAND	0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1096:3): [True: 33.3k, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  | 1097|  33.3k|			p->fld &= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|  33.3k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1098|  33.3k|			break; \
  |  |  |  | 1099|      0|		case FILE_OPOR: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  353|      0|#define				FILE_OPOR	1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1099:3): [True: 0, False: 35.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: 35.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: 35.1k]
  |  |  |  |  ------------------
  |  |  |  | 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.1k]
  |  |  |  |  ------------------
  |  |  |  | 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.1k]
  |  |  |  |  ------------------
  |  |  |  | 1112|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1113|      0|			break; \
  |  |  |  | 1114|    184|		case FILE_OPDIVIDE: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  358|    184|#define				FILE_OPDIVIDE	6
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1114:3): [True: 184, False: 34.9k]
  |  |  |  |  ------------------
  |  |  |  | 1115|    184|			CHECKOVFL(type, p->fld, m->num_mask, size, sign); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|    184|	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|    184|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1087:6): [Folded, False: 184]
  |  |  |  |  |  |  |  Branch (1087:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1087:28): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1088|    184|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|      0|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1088:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1089|    184|		return -1; \
  |  |  |  |  |  | 1090|    184|	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	if (size == 64 && sign && CAST(type, a) == CAST(type, 0x8000000000000000LL) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    368|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1090:6): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:20): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (1090:28): [True: 18, False: 166]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1091|    184|	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|     18|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               	    && CAST(type, b) == CAST(type, -1)) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  460|    202|#define CAST(T, b)	((T)(b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (1091:9): [True: 0, False: 18]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1092|    184|		return -1
  |  |  |  |  ------------------
  |  |  |  | 1116|    184|			if (CAST(type, m->num_mask) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1116:8): [True: 0, False: 184]
  |  |  |  |  ------------------
  |  |  |  | 1117|    184|				return -1; \
  |  |  |  | 1118|    184|			p->fld /= CAST(type, m->num_mask); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  460|    184|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  | 1119|    184|			break; \
  |  |  |  | 1120|  1.63k|		case FILE_OPMODULO: \
  |  |  |  |  ------------------
  |  |  |  |  |  |  359|  1.63k|#define				FILE_OPMODULO	7
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:3): [True: 1.63k, False: 33.4k]
  |  |  |  |  ------------------
  |  |  |  | 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.1k|		} \
  |  |  |  | 1127|  1.27M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  364|  1.27M|#define				FILE_OPINVERSE	0x40
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1127:6): [True: 0, False: 1.27M]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.27M|		p->fld = ~p->fld \
  |  |  ------------------
  |  | 1135|  1.27M|	}
  ------------------
 1162|  2.04M|	return 0;
 1163|  2.04M|}
softmagic.c:cvt_float:
 1186|  3.29k|{
 1187|  3.29k|	DO_CVT2(f, float);
  ------------------
  |  | 1166|  3.29k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  388|  3.29k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1166:6): [True: 0, False: 3.29k]
  |  |  ------------------
  |  | 1167|  3.29k|		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.29k|	return 0;
 1189|  3.29k|}
softmagic.c:cvt_double:
 1193|    722|{
 1194|    722|	DO_CVT2(d, double);
  ------------------
  |  | 1166|    722|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  388|    722|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1166:6): [True: 0, False: 722]
  |  |  ------------------
  |  | 1167|    722|		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|    722|	return 0;
 1196|    722|}
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.80M|	case FILE_BYTE:
  ------------------
  |  |  254|  1.80M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2177:2): [True: 1.80M, False: 98.5M]
  ------------------
 2178|  1.80M|		v = p->b;
 2179|  1.80M|		break;
 2180|       |
 2181|  1.84M|	case FILE_SHORT:
  ------------------
  |  |  255|  1.84M|#define				FILE_SHORT		2
  ------------------
  |  Branch (2181:2): [True: 1.84M, False: 98.5M]
  ------------------
 2182|  6.31M|	case FILE_BESHORT:
  ------------------
  |  |  260|  6.31M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2182:2): [True: 4.47M, False: 95.8M]
  ------------------
 2183|  10.7M|	case FILE_LESHORT:
  ------------------
  |  |  263|  10.7M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2183:2): [True: 4.42M, False: 95.9M]
  ------------------
 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: 212, 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: 212, 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.59M|	case FILE_LONG:
  ------------------
  |  |  257|  1.59M|#define				FILE_LONG		4
  ------------------
  |  Branch (2193:2): [True: 1.59M, False: 98.7M]
  ------------------
 2194|  14.9M|	case FILE_BELONG:
  ------------------
  |  |  261|  14.9M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2194:2): [True: 13.3M, False: 86.9M]
  ------------------
 2195|  21.6M|	case FILE_LELONG:
  ------------------
  |  |  264|  21.6M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2195:2): [True: 6.63M, False: 93.7M]
  ------------------
 2196|  21.6M|	case FILE_MELONG:
  ------------------
  |  |  276|  21.6M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2196:2): [True: 34, False: 100M]
  ------------------
 2197|  21.6M|	case FILE_DATE:
  ------------------
  |  |  259|  21.6M|#define				FILE_DATE		6
  ------------------
  |  Branch (2197:2): [True: 0, False: 100M]
  ------------------
 2198|  21.6M|	case FILE_BEDATE:
  ------------------
  |  |  262|  21.6M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2198:2): [True: 410, False: 100M]
  ------------------
 2199|  21.6M|	case FILE_LEDATE:
  ------------------
  |  |  265|  21.6M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2199:2): [True: 945, False: 100M]
  ------------------
 2200|  21.6M|	case FILE_MEDATE:
  ------------------
  |  |  274|  21.6M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2200:2): [True: 40, False: 100M]
  ------------------
 2201|  21.6M|	case FILE_LDATE:
  ------------------
  |  |  267|  21.6M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2201:2): [True: 0, False: 100M]
  ------------------
 2202|  21.6M|	case FILE_BELDATE:
  ------------------
  |  |  268|  21.6M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2202:2): [True: 299, False: 100M]
  ------------------
 2203|  21.6M|	case FILE_LELDATE:
  ------------------
  |  |  269|  21.6M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2203:2): [True: 34, False: 100M]
  ------------------
 2204|  21.6M|	case FILE_MELDATE:
  ------------------
  |  |  275|  21.6M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2204:2): [True: 0, False: 100M]
  ------------------
 2205|  21.6M|		v = p->l;
 2206|  21.6M|		break;
 2207|       |
 2208|  69.6k|	case FILE_QUAD:
  ------------------
  |  |  277|  69.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2208:2): [True: 69.6k, False: 100M]
  ------------------
 2209|   965k|	case FILE_LEQUAD:
  ------------------
  |  |  278|   965k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2209:2): [True: 895k, False: 99.4M]
  ------------------
 2210|  2.03M|	case FILE_BEQUAD:
  ------------------
  |  |  279|  2.03M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2210:2): [True: 1.07M, False: 99.2M]
  ------------------
 2211|  2.03M|	case FILE_QDATE:
  ------------------
  |  |  280|  2.03M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2211:2): [True: 0, False: 100M]
  ------------------
 2212|  2.03M|	case FILE_BEQDATE:
  ------------------
  |  |  282|  2.03M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2212:2): [True: 384, False: 100M]
  ------------------
 2213|  2.03M|	case FILE_LEQDATE:
  ------------------
  |  |  281|  2.03M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2213:2): [True: 0, False: 100M]
  ------------------
 2214|  2.03M|	case FILE_QLDATE:
  ------------------
  |  |  283|  2.03M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2214:2): [True: 0, False: 100M]
  ------------------
 2215|  2.03M|	case FILE_BEQLDATE:
  ------------------
  |  |  285|  2.03M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2215:2): [True: 184, False: 100M]
  ------------------
 2216|  2.03M|	case FILE_LEQLDATE:
  ------------------
  |  |  284|  2.03M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2216:2): [True: 10, False: 100M]
  ------------------
 2217|  2.03M|	case FILE_QWDATE:
  ------------------
  |  |  295|  2.03M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2217:2): [True: 376, False: 100M]
  ------------------
 2218|  2.03M|	case FILE_BEQWDATE:
  ------------------
  |  |  297|  2.03M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2218:2): [True: 0, False: 100M]
  ------------------
 2219|  2.04M|	case FILE_LEQWDATE:
  ------------------
  |  |  296|  2.04M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2219:2): [True: 1.23k, False: 100M]
  ------------------
 2220|  2.04M|	case FILE_OFFSET:
  ------------------
  |  |  305|  2.04M|#define				FILE_OFFSET		52
  ------------------
  |  Branch (2220:2): [True: 6.62k, False: 100M]
  ------------------
 2221|  2.04M|		v = p->q;
 2222|  2.04M|		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.29k|	case FILE_LEFLOAT:
  ------------------
  |  |  288|  3.29k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2226:2): [True: 3.29k, False: 100M]
  ------------------
 2227|  3.29k|		fl = m->value.f;
 2228|  3.29k|		fv = p->f;
 2229|  3.29k|		switch (m->reln) {
 2230|    402|		case 'x':
  ------------------
  |  Branch (2230:3): [True: 402, False: 2.89k]
  ------------------
 2231|    402|			matched = 1;
 2232|    402|			break;
 2233|       |
 2234|      0|		case '!':
  ------------------
  |  Branch (2234:3): [True: 0, False: 3.29k]
  ------------------
 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.29k]
  ------------------
 2239|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
  ------------------
  |  Branch (2239:14): [True: 0, False: 0]
  ------------------
 2240|      0|			break;
 2241|       |
 2242|  2.89k|		case '>':
  ------------------
  |  Branch (2242:3): [True: 2.89k, False: 402]
  ------------------
 2243|  2.89k|			matched = isgreater(fv, fl);
 2244|  2.89k|			break;
 2245|       |
 2246|      0|		case '<':
  ------------------
  |  Branch (2246:3): [True: 0, False: 3.29k]
  ------------------
 2247|      0|			matched = isless(fv, fl);
 2248|      0|			break;
 2249|       |
 2250|      0|		default:
  ------------------
  |  Branch (2250:3): [True: 0, False: 3.29k]
  ------------------
 2251|      0|			file_magerror(ms, "cannot happen with float: "
 2252|      0|			    "invalid relation `%c'", m->reln);
 2253|      0|			return -1;
 2254|  3.29k|		}
 2255|  3.29k|		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|    722|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    722|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2259:2): [True: 588, False: 100M]
  ------------------
 2260|    722|		dl = m->value.d;
 2261|    722|		dv = p->d;
 2262|    722|		switch (m->reln) {
 2263|    524|		case 'x':
  ------------------
  |  Branch (2263:3): [True: 524, False: 198]
  ------------------
 2264|    524|			matched = 1;
 2265|    524|			break;
 2266|       |
 2267|      0|		case '!':
  ------------------
  |  Branch (2267:3): [True: 0, False: 722]
  ------------------
 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: 524]
  ------------------
 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: 722]
  ------------------
 2276|      0|			matched = isgreater(dv, dl);
 2277|      0|			break;
 2278|       |
 2279|      0|		case '<':
  ------------------
  |  Branch (2279:3): [True: 0, False: 722]
  ------------------
 2280|      0|			matched = isless(dv, dl);
 2281|      0|			break;
 2282|       |
 2283|      0|		default:
  ------------------
  |  Branch (2283:3): [True: 0, False: 722]
  ------------------
 2284|      0|			file_magerror(ms, "cannot happen with double: "
 2285|      0|			    "invalid relation `%c'", m->reln);
 2286|      0|			return -1;
 2287|    722|		}
 2288|    722|		return matched;
 2289|       |
 2290|  13.1k|	case FILE_DEFAULT:
  ------------------
  |  |  256|  13.1k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2290:2): [True: 13.1k, False: 100M]
  ------------------
 2291|  16.3k|	case FILE_CLEAR:
  ------------------
  |  |  300|  16.3k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2291:2): [True: 3.25k, False: 100M]
  ------------------
 2292|  16.3k|		l = 0;
 2293|  16.3k|		v = 0;
 2294|  16.3k|		break;
 2295|       |
 2296|  62.0M|	case FILE_STRING:
  ------------------
  |  |  258|  62.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (2296:2): [True: 62.0M, False: 38.2M]
  ------------------
 2297|  62.0M|	case FILE_PSTRING:
  ------------------
  |  |  266|  62.0M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2297:2): [True: 26.1k, False: 100M]
  ------------------
 2298|  62.0M|	case FILE_OCTAL:
  ------------------
  |  |  314|  62.0M|#define				FILE_OCTAL		61
  ------------------
  |  Branch (2298:2): [True: 0, False: 100M]
  ------------------
 2299|  62.0M|		l = 0;
 2300|  62.0M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  460|  62.0M|#define CAST(T, b)	((T)(b))
  ------------------
 2301|  62.0M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  390|  62.0M|#define str_flags _u._s._flags
  ------------------
 2302|  62.0M|		break;
 2303|       |
 2304|    147|	case FILE_BESTRING16:
  ------------------
  |  |  271|    147|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2304:2): [True: 147, False: 100M]
  ------------------
 2305|  67.6k|	case FILE_LESTRING16:
  ------------------
  |  |  272|  67.6k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2305:2): [True: 67.5k, False: 100M]
  ------------------
 2306|  67.6k|		l = 0;
 2307|  67.6k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  460|  67.6k|#define CAST(T, b)	((T)(b))
  ------------------
 2308|  67.6k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  390|  67.6k|#define str_flags _u._s._flags
  ------------------
 2309|  67.6k|		break;
 2310|       |
 2311|   703k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  273|   703k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2311:2): [True: 703k, False: 99.6M]
  ------------------
 2312|   703k|		size_t slen;
 2313|   703k|		size_t idx;
 2314|       |
 2315|   703k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2315:7): [True: 0, False: 703k]
  ------------------
 2316|      0|			return 0;
 2317|       |
 2318|   703k|		slen = MIN(m->vallen, sizeof(m->value.s));
  ------------------
  |  Branch (2318:10): [True: 703k, False: 0]
  ------------------
 2319|   703k|		l = 0;
 2320|   703k|		v = 0;
 2321|   703k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   703k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2321:7): [True: 0, False: 703k]
  ------------------
 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|   703k|#ifdef HAVE_MEMMEM
 2332|   703k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  390|   703k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2332:7): [True: 703k, False: 0]
  |  Branch (2332:19): [True: 331k, False: 372k]
  ------------------
 2333|   331k|			const char *found;
 2334|   331k|			idx = m->str_range + slen;
  ------------------
  |  |  389|   331k|#define str_range _u._s._count
  ------------------
 2335|   331k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  389|   331k|#define str_range _u._s._count
  ------------------
  |  Branch (2335:8): [True: 4.45k, False: 326k]
  |  Branch (2335:29): [True: 111k, False: 215k]
  ------------------
 2336|   115k|				idx = ms->search.s_len;
 2337|   331k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  460|   331k|#define CAST(T, b)	((T)(b))
  ------------------
 2338|   331k|			    m->value.s, slen));
 2339|   331k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   331k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2339:8): [True: 0, False: 331k]
  ------------------
 2340|      0|				fprintf(stderr, "] %sfound\n",
 2341|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2341:9): [True: 0, False: 0]
  ------------------
 2342|      0|			}
 2343|   331k|			if (!found) {
  ------------------
  |  Branch (2343:8): [True: 328k, False: 2.33k]
  ------------------
 2344|   328k|				v = 1;
 2345|   328k|				break;
 2346|   328k|			}
 2347|  2.33k|			idx = found - ms->search.s;
 2348|  2.33k|			ms->search.offset += idx;
 2349|  2.33k|			ms->search.rm_len = ms->search.s_len - idx;
 2350|  2.33k|			break;
 2351|   331k|		}
 2352|   372k|#endif
 2353|       |
 2354|  5.55G|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  389|  5.55G|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  389|  5.55G|#define str_range _u._s._count
  ------------------
  |  Branch (2354:17): [True: 0, False: 5.55G]
  |  Branch (2354:38): [True: 5.55G, False: 193k]
  ------------------
 2355|  5.55G|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2355:8): [True: 178k, False: 5.55G]
  ------------------
 2356|   178k|				v = 1;
 2357|   178k|				break;
 2358|   178k|			}
 2359|       |
 2360|  5.55G|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2361|  5.55G|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  390|  5.55G|#define str_flags _u._s._flags
  ------------------
 2362|  5.55G|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2362:8): [True: 686, False: 5.55G]
  ------------------
 2363|    686|				ms->search.offset += idx;
 2364|    686|				ms->search.rm_len = ms->search.s_len - idx;
 2365|    686|				break;
 2366|    686|			}
 2367|  5.55G|		}
 2368|   372k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   372k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2368:7): [True: 0, False: 372k]
  ------------------
 2369|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2369:35): [True: 0, False: 0]
  ------------------
 2370|      0|		}
 2371|   372k|		break;
 2372|   703k|	}
 2373|   496k|	case FILE_REGEX: {
  ------------------
  |  |  270|   496k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2373:2): [True: 496k, False: 99.8M]
  ------------------
 2374|   496k|		int rc;
 2375|   496k|		file_regex_t *rx = *m_cache;
 2376|   496k|		const char *search;
 2377|   496k|		regmatch_t pmatch;
 2378|   496k|		size_t slen = ms->search.s_len;
 2379|   496k|		char *copy;
 2380|       |
 2381|   496k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2381:7): [True: 34, False: 496k]
  ------------------
 2382|     34|			return 0;
 2383|       |
 2384|   496k|		if (rx == NULL) {
  ------------------
  |  Branch (2384:7): [True: 168, False: 496k]
  ------------------
 2385|    168|			rx = *m_cache = alloc_regex(ms, m);
 2386|    168|			if (rx == NULL)
  ------------------
  |  Branch (2386:8): [True: 0, False: 168]
  ------------------
 2387|      0|				return -1;
 2388|    168|		}
 2389|   496k|		l = 0;
 2390|   496k|		if (slen != 0) {
  ------------------
  |  Branch (2390:7): [True: 492k, False: 4.06k]
  ------------------
 2391|   492k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  460|   492k|#define CAST(T, b)	((T)(b))
  ------------------
 2392|   492k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2392:11): [True: 0, False: 492k]
  ------------------
 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|   492k|		    memcpy(copy, ms->search.s, slen);
 2399|   492k|		    copy[--slen] = '\0';
 2400|   492k|		    search = copy;
 2401|   492k|		} else {
 2402|  4.06k|		    search = CCAST(char *, "");
  ------------------
  |  |  462|  4.06k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2403|  4.06k|		    copy = NULL;
 2404|  4.06k|		}
 2405|   496k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  461|   496k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2406|   496k|		    1, &pmatch, 0);
 2407|   496k|		free(copy);
 2408|   496k|		switch (rc) {
 2409|  3.47k|		case 0:
  ------------------
  |  Branch (2409:3): [True: 3.47k, False: 492k]
  ------------------
 2410|  3.47k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  460|  3.47k|#define CAST(T, b)	((T)(b))
  ------------------
 2411|  3.47k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  460|  3.47k|#define CAST(T, b)	((T)(b))
  ------------------
 2412|  3.47k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  460|  3.47k|#define CAST(T, b)	((T)(b))
  ------------------
 2413|  3.47k|			    pmatch.rm_eo - pmatch.rm_so);
 2414|  3.47k|			v = 0;
 2415|  3.47k|			break;
 2416|       |
 2417|   492k|		case REG_NOMATCH:
  ------------------
  |  Branch (2417:3): [True: 492k, False: 3.47k]
  ------------------
 2418|   492k|			v = 1;
 2419|   492k|			break;
 2420|       |
 2421|      0|		default:
  ------------------
  |  Branch (2421:3): [True: 0, False: 496k]
  ------------------
 2422|      0|			return -1;
 2423|   496k|		}
 2424|   496k|		break;
 2425|   496k|	}
 2426|   496k|	case FILE_USE:
  ------------------
  |  |  299|  60.0k|#define				FILE_USE		46
  ------------------
  |  Branch (2426:2): [True: 60.0k, False: 100M]
  ------------------
 2427|  60.0k|		return ms->ms_value.q != 0;
 2428|  66.2k|	case FILE_NAME:
  ------------------
  |  |  298|  66.2k|#define				FILE_NAME		45
  ------------------
  |  Branch (2428:2): [True: 66.2k, False: 100M]
  ------------------
 2429|  79.9k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  79.9k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2429:2): [True: 13.7k, False: 100M]
  ------------------
 2430|  79.9k|		return 1;
 2431|   412k|	case FILE_DER:
  ------------------
  |  |  301|   412k|#define				FILE_DER		48
  ------------------
  |  Branch (2431:2): [True: 412k, False: 99.9M]
  ------------------
 2432|   412k|		matched = der_cmp(ms, m);
 2433|   412k|		if (matched == -1) {
  ------------------
  |  Branch (2433:7): [True: 145k, False: 267k]
  ------------------
 2434|   145k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   145k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2434:8): [True: 0, False: 145k]
  ------------------
 2435|      0|				(void) fprintf(stderr,
 2436|      0|				    "EOF comparing DER entries\n");
 2437|      0|			}
 2438|   145k|			return 0;
 2439|   145k|		}
 2440|   267k|		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|   189k|	case FILE_GUID:
  ------------------
  |  |  302|   189k|#define				FILE_GUID		49
  ------------------
  |  Branch (2443:2): [True: 189k, False: 100M]
  ------------------
 2444|   189k|		l = 0;
 2445|   189k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2446|   189k|		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|  99.7M|	v = file_signextend(ms, m, v);
 2453|       |
 2454|  99.7M|	switch (m->reln) {
 2455|   113k|	case 'x':
  ------------------
  |  Branch (2455:2): [True: 113k, False: 99.6M]
  ------------------
 2456|   113k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   113k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2456:7): [True: 0, False: 113k]
  ------------------
 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|   113k|		matched = 1;
 2460|   113k|		break;
 2461|       |
 2462|  70.0k|	case '!':
  ------------------
  |  Branch (2462:2): [True: 70.0k, False: 99.7M]
  ------------------
 2463|  70.0k|		matched = v != l;
 2464|  70.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  70.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2464:7): [True: 0, False: 70.0k]
  ------------------
 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.0k|		break;
 2470|       |
 2471|  98.9M|	case '=':
  ------------------
  |  Branch (2471:2): [True: 98.9M, False: 844k]
  ------------------
 2472|  98.9M|		matched = v == l;
 2473|  98.9M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  98.9M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2473:7): [True: 0, False: 98.9M]
  ------------------
 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|  98.9M|		break;
 2479|       |
 2480|   274k|	case '>':
  ------------------
  |  Branch (2480:2): [True: 274k, False: 99.5M]
  ------------------
 2481|   274k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  237|   274k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2481:7): [True: 197k, False: 76.6k]
  ------------------
 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.6k|		else {
 2490|  76.6k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  460|  76.6k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  460|  76.6k|#define CAST(T, b)	((T)(b))
  ------------------
 2491|  76.6k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  76.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2491:8): [True: 0, False: 76.6k]
  ------------------
 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.6k|		}
 2497|   274k|		break;
 2498|       |
 2499|   342k|	case '<':
  ------------------
  |  Branch (2499:2): [True: 342k, False: 99.4M]
  ------------------
 2500|   342k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  237|   342k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2500:7): [True: 290k, False: 52.8k]
  ------------------
 2501|   290k|			matched = v < l;
 2502|   290k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   290k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2502:8): [True: 0, False: 290k]
  ------------------
 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|   290k|		}
 2508|  52.8k|		else {
 2509|  52.8k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  460|  52.8k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  460|  52.8k|#define CAST(T, b)	((T)(b))
  ------------------
 2510|  52.8k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  52.8k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2510:8): [True: 0, False: 52.8k]
  ------------------
 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.8k|		}
 2516|   342k|		break;
 2517|       |
 2518|  40.7k|	case '&':
  ------------------
  |  Branch (2518:2): [True: 40.7k, False: 99.7M]
  ------------------
 2519|  40.7k|		matched = (v & l) == l;
 2520|  40.7k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  40.7k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2520:7): [True: 0, False: 40.7k]
  ------------------
 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|  40.7k|		break;
 2528|       |
 2529|  3.60k|	case '^':
  ------------------
  |  Branch (2529:2): [True: 3.60k, False: 99.7M]
  ------------------
 2530|  3.60k|		matched = (v & l) != l;
 2531|  3.60k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  3.60k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2531:7): [True: 0, False: 3.60k]
  ------------------
 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|  3.60k|		break;
 2538|       |
 2539|      0|	default:
  ------------------
  |  Branch (2539:2): [True: 0, False: 99.7M]
  ------------------
 2540|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2541|      0|		    m->reln);
 2542|      0|		return -1;
 2543|  99.7M|	}
 2544|  99.7M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  99.7M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2544:6): [True: 0, False: 99.7M]
  ------------------
 2545|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2546|      0|		    file_magic_strength(m, 1));
 2547|      0|	}
 2548|       |
 2549|  99.7M|	return matched;
 2550|  99.7M|}
softmagic.c:file_strncmp:
 2058|  5.61G|{
 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.61G|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  461|  5.61G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2066|  5.61G|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  461|  5.61G|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2067|  5.61G|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  404|  5.61G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  403|  5.61G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2068|  5.61G|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  405|  5.61G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  403|  5.61G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 2069|  5.61G|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (2069:33): [True: 57.2M, False: 5.55G]
  ------------------
 2070|  5.61G|	uint64_t v;
 2071|       |
 2072|       |	/*
 2073|       |	 * What we want here is v = strncmp(s1, s2, len),
 2074|       |	 * but ignoring any nulls.
 2075|       |	 */
 2076|  5.61G|	v = 0;
 2077|  5.61G|	len++;
 2078|  5.61G|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2078:6): [True: 58.8M, False: 5.55G]
  ------------------
 2079|  59.8M|		while (--len > 0)
  ------------------
  |  Branch (2079:10): [True: 59.8M, False: 50.3k]
  ------------------
 2080|  59.8M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2080:8): [True: 58.8M, False: 955k]
  ------------------
 2081|  58.8M|				break;
 2082|  58.8M|	}
 2083|  5.55G|	else { /* combine the others */
 2084|  5.55G|		while (--len > 0) {
  ------------------
  |  Branch (2084:10): [True: 5.55G, False: 34.4k]
  ------------------
 2085|  5.55G|			if (b >= eb) {
  ------------------
  |  Branch (2085:8): [True: 263k, False: 5.55G]
  ------------------
 2086|   263k|				v = 1;
 2087|   263k|				break;
 2088|   263k|			}
 2089|  5.55G|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  406|  5.55G|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  403|  5.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2089:8): [True: 57.3M, False: 5.50G]
  ------------------
 2090|  5.55G|			    islower(*a)) {
  ------------------
  |  Branch (2090:8): [True: 3.33M, False: 53.9M]
  ------------------
 2091|  3.33M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2091:9): [True: 3.30M, False: 31.5k]
  |  Branch (2091:14): [True: 0, False: 0]
  |  Branch (2091:14): [Folded, False: 0]
  |  Branch (2091:14): [Folded, False: 3.33M]
  ------------------
 2092|  3.30M|					break;
 2093|  3.33M|			}
 2094|  5.55G|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  407|  5.55G|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  403|  5.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2094:13): [True: 17.0k, False: 5.55G]
  ------------------
 2095|  5.55G|			    isupper(*a)) {
  ------------------
  |  Branch (2095:8): [True: 15.7k, False: 1.26k]
  ------------------
 2096|  15.7k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2096:9): [True: 15.6k, False: 160]
  |  Branch (2096:14): [True: 0, False: 0]
  |  Branch (2096:14): [Folded, False: 0]
  |  Branch (2096:14): [Folded, False: 15.7k]
  ------------------
 2097|  15.6k|					break;
 2098|  15.7k|			}
 2099|  5.55G|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  404|  5.55G|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  403|  5.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2099:13): [True: 43.7M, False: 5.51G]
  ------------------
 2100|  5.55G|			    isspace(*a)) {
  ------------------
  |  Branch (2100:8): [True: 1.54M, False: 42.1M]
  ------------------
 2101|  1.54M|				a++;
 2102|  1.54M|				if (isspace(*b)) {
  ------------------
  |  Branch (2102:9): [True: 274k, False: 1.26M]
  ------------------
 2103|   274k|					b++;
 2104|   274k|					if (!isspace(*a))
  ------------------
  |  Branch (2104:10): [True: 274k, False: 0]
  ------------------
 2105|  11.8G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2105:14): [True: 11.8G, False: 263k]
  |  Branch (2105:24): [True: 11.8G, False: 10.7k]
  ------------------
 2106|  11.8G|							b++;
 2107|   274k|				}
 2108|  1.26M|				else {
 2109|  1.26M|					v = 1;
 2110|  1.26M|					break;
 2111|  1.26M|				}
 2112|  1.54M|			}
 2113|  5.55G|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  405|  5.55G|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  403|  5.55G|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2113:13): [True: 13.7M, False: 5.53G]
  ------------------
 2114|  5.55G|			    isspace(*a)) {
  ------------------
  |  Branch (2114:8): [True: 2.28k, False: 13.7M]
  ------------------
 2115|  2.28k|				a++;
 2116|  9.99k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2116:12): [True: 9.92k, False: 75]
  |  Branch (2116:22): [True: 7.71k, False: 2.20k]
  ------------------
 2117|  7.71k|					b++;
 2118|  2.28k|			}
 2119|  5.55G|			else {
 2120|  5.55G|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2120:9): [True: 5.55G, False: 1.60M]
  ------------------
 2121|  5.55G|					break;
 2122|  5.55G|			}
 2123|  5.55G|		}
 2124|  5.55G|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  422|  34.4k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  403|  34.4k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2124:7): [True: 34.4k, False: 5.55G]
  |  Branch (2124:19): [True: 34.4k, False: 0]
  |  Branch (2124:29): [True: 102, False: 34.3k]
  ------------------
 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.55G|	}
 2129|  5.61G|	return v;
 2130|  5.61G|}
softmagic.c:file_strncmp16:
 2135|  67.6k|{
 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|  67.6k|	flags = 0;
 2142|  67.6k|	return file_strncmp(a, b, len, maxlen, flags);
 2143|  67.6k|}
softmagic.c:alloc_regex:
 2147|    168|{
 2148|    168|	int rc;
 2149|    168|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  460|    168|#define CAST(T, b)	((T)(b))
  ------------------
 2150|       |
 2151|    168|	if (rx == NULL) {
  ------------------
  |  Branch (2151:6): [True: 0, False: 168]
  ------------------
 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|    168|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2158|    168|	    REGEX_ICASE(m));
  ------------------
  |  |  440|    168|#define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  390|    168|#define str_flags _u._s._flags
  |  |  ------------------
  |  |               #define	REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
  |  |  ------------------
  |  |  |  |  439|    168|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  406|    168|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  403|    168|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  407|    168|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  403|    168|#define BIT(A)   (1 << (A))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (440:25): [True: 19, False: 149]
  |  |  ------------------
  ------------------
 2159|    168|	if (rc == 0)
  ------------------
  |  Branch (2159:6): [True: 168, False: 0]
  ------------------
 2160|    168|		return rx;
 2161|       |
 2162|      0|	free(rx);
 2163|       |	return NULL;
 2164|    168|}
softmagic.c:handle_annotation:
 2554|   879k|{
 2555|   879k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   879k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2555:6): [True: 0, False: 879k]
  |  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|   879k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   879k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2564:6): [True: 0, False: 879k]
  |  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|   879k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   879k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2573:6): [True: 0, False: 879k]
  |  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|   879k|	return 0;
 2589|   879k|}
softmagic.c:varexpand:
  549|   167k|{
  550|   167k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  551|   167k|	size_t l;
  552|       |
  553|   168k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (553:19): [True: 475, False: 167k]
  ------------------
  554|    475|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  460|    475|#define CAST(T, b)	((T)(b))
  ------------------
  555|    475|		if (l >= len)
  ------------------
  |  Branch (555:7): [True: 0, False: 475]
  ------------------
  556|      0|			return -1;
  557|    475|		memcpy(buf, sptr, l);
  558|    475|		buf += l;
  559|    475|		len -= l;
  560|    475|		ptr += 2;
  561|    475|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (561:7): [True: 0, False: 475]
  |  Branch (561:16): [True: 0, False: 475]
  ------------------
  562|      0|			return -1;
  563|  7.12k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (563:26): [True: 7.12k, False: 0]
  |  Branch (563:33): [True: 6.65k, False: 475]
  ------------------
  564|  6.65k|			continue;
  565|    475|		if (*et != ':')
  ------------------
  |  Branch (565:7): [True: 0, False: 475]
  ------------------
  566|      0|			return -1;
  567|  6.65k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (567:25): [True: 6.65k, False: 0]
  |  Branch (567:32): [True: 6.17k, False: 475]
  ------------------
  568|  6.17k|			continue;
  569|    475|		if (*ee != '}')
  ------------------
  |  Branch (569:7): [True: 0, False: 475]
  ------------------
  570|      0|			return -1;
  571|    475|		switch (*ptr) {
  572|    475|		case 'x':
  ------------------
  |  Branch (572:3): [True: 475, False: 0]
  ------------------
  573|    475|			if (ms->mode & 0111) {
  ------------------
  |  Branch (573:8): [True: 1, False: 474]
  ------------------
  574|      1|				ptr = t;
  575|      1|				l = et - t;
  576|    474|			} else {
  577|    474|				ptr = e;
  578|    474|				l = ee - e;
  579|    474|			}
  580|    475|			break;
  581|      0|		default:
  ------------------
  |  Branch (581:3): [True: 0, False: 475]
  ------------------
  582|      0|			return -1;
  583|    475|		}
  584|    475|		if (l >= len)
  ------------------
  |  Branch (584:7): [True: 0, False: 475]
  ------------------
  585|      0|			return -1;
  586|    475|		memcpy(buf, ptr, l);
  587|    475|		buf += l;
  588|    475|		len -= l;
  589|    475|		sptr = ee + 1;
  590|    475|	}
  591|       |
  592|   167k|	l = strlen(sptr);
  593|   167k|	if (l >= len)
  ------------------
  |  Branch (593:6): [True: 0, False: 167k]
  ------------------
  594|      0|		return -1;
  595|       |
  596|   167k|	memcpy(buf, sptr, l);
  597|   167k|	buf[l] = '\0';
  598|   167k|	return 0;
  599|   167k|}
softmagic.c:print_sep:
 2593|  55.7k|{
 2594|  55.7k|	if (firstline)
  ------------------
  |  Branch (2594:6): [True: 13.9k, False: 41.7k]
  ------------------
 2595|  13.9k|		return 0;
 2596|       |	/*
 2597|       |	 * we found another match
 2598|       |	 * put a newline and '-' to do some simple formatting
 2599|       |	 */
 2600|  41.7k|	return file_separator(ms);
 2601|  55.7k|}
softmagic.c:mprint:
  604|   167k|{
  605|   167k|	uint64_t v;
  606|   167k|	float vf;
  607|   167k|	double vd;
  608|   167k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  609|   167k|	const char *desc;
  610|   167k|	union VALUETYPE *p = &ms->ms_value;
  611|       |
  612|   167k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (612:6): [True: 0, False: 167k]
  ------------------
  613|      0|		desc = m->desc;
  614|   167k|	else
  615|   167k|		desc = ebuf;
  616|       |
  617|   167k|#define	PRINTER(value, format, stype, utype)	\
  618|   167k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  619|   167k|	switch (check_fmt(ms, desc)) { \
  620|   167k|	case -1: \
  621|   167k|		return -1; \
  622|   167k|	case 1: \
  623|   167k|		if (m->flag & UNSIGNED) { \
  624|   167k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  625|   167k|			    CAST(utype, v)); \
  626|   167k|		} else { \
  627|   167k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  628|   167k|			    CAST(stype, v)); \
  629|   167k|		} \
  630|   167k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  631|   167k|			return -1; \
  632|   167k|		break; \
  633|   167k|	default: \
  634|   167k|		if (m->flag & UNSIGNED) { \
  635|   167k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  636|   167k|			   CAST(utype, v)) == -1) \
  637|   167k|			   return -1; \
  638|   167k|		} else { \
  639|   167k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  640|   167k|			   CAST(stype, v)) == -1) \
  641|   167k|			   return -1; \
  642|   167k|		} \
  643|   167k|		break; \
  644|   167k|	} \
  645|   167k|	break
  646|       |
  647|   167k|  	switch (m->type) {
  648|  26.4k|  	case FILE_BYTE:
  ------------------
  |  |  254|  26.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (648:4): [True: 26.4k, False: 141k]
  ------------------
  649|  26.4k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  618|  26.4k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  26.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  26.4k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 26.4k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 26.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|  26.4k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 26.4k, False: 0]
  |  |  ------------------
  |  |  634|  26.4k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  26.4k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 11.3k, False: 15.1k]
  |  |  ------------------
  |  |  635|  11.3k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  11.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  636|  11.3k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  11.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  11.3k|			   return -1; \
  |  |  638|  15.1k|		} else { \
  |  |  639|  15.1k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  15.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 15.1k]
  |  |  ------------------
  |  |  640|  15.1k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  15.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  15.1k|			   return -1; \
  |  |  642|  15.1k|		} \
  |  |  643|  26.4k|		break; \
  |  |  644|  26.4k|	} \
  |  |  645|  26.4k|	break
  ------------------
  650|       |
  651|  26.4k|  	case FILE_SHORT:
  ------------------
  |  |  255|  1.94k|#define				FILE_SHORT		2
  ------------------
  |  Branch (651:4): [True: 1.94k, False: 165k]
  ------------------
  652|  15.4k|  	case FILE_BESHORT:
  ------------------
  |  |  260|  15.4k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (652:4): [True: 13.5k, False: 154k]
  ------------------
  653|  37.9k|  	case FILE_LESHORT:
  ------------------
  |  |  263|  37.9k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (653:4): [True: 22.4k, False: 145k]
  ------------------
  654|  37.9k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  618|  37.9k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  37.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  37.9k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 37.9k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 37.9k]
  |  |  ------------------
  |  |  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.9k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 37.9k, False: 0]
  |  |  ------------------
  |  |  634|  37.9k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  37.9k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 24.1k, False: 13.7k]
  |  |  ------------------
  |  |  635|  24.1k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  24.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 24.1k]
  |  |  ------------------
  |  |  636|  24.1k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  24.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  24.1k|			   return -1; \
  |  |  638|  24.1k|		} else { \
  |  |  639|  13.7k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  13.7k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 13.7k]
  |  |  ------------------
  |  |  640|  13.7k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  13.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  13.7k|			   return -1; \
  |  |  642|  13.7k|		} \
  |  |  643|  37.9k|		break; \
  |  |  644|  37.9k|	} \
  |  |  645|  37.9k|	break
  ------------------
  655|       |
  656|  37.9k|  	case FILE_LONG:
  ------------------
  |  |  257|    352|#define				FILE_LONG		4
  ------------------
  |  Branch (656:4): [True: 352, False: 167k]
  ------------------
  657|  23.7k|  	case FILE_BELONG:
  ------------------
  |  |  261|  23.7k|#define				FILE_BELONG		8
  ------------------
  |  Branch (657:4): [True: 23.4k, False: 144k]
  ------------------
  658|  34.8k|  	case FILE_LELONG:
  ------------------
  |  |  264|  34.8k|#define				FILE_LELONG		11
  ------------------
  |  Branch (658:4): [True: 11.0k, False: 156k]
  ------------------
  659|  34.8k|  	case FILE_MELONG:
  ------------------
  |  |  276|  34.8k|#define				FILE_MELONG		23
  ------------------
  |  Branch (659:4): [True: 34, False: 167k]
  ------------------
  660|  34.8k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  618|  34.8k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  34.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  34.8k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 34.8k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 34.8k]
  |  |  ------------------
  |  |  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|  34.8k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 34.8k, False: 0]
  |  |  ------------------
  |  |  634|  34.8k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  34.8k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 9.65k, False: 25.1k]
  |  |  ------------------
  |  |  635|  9.65k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  9.65k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 9.65k]
  |  |  ------------------
  |  |  636|  9.65k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  9.65k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  9.65k|			   return -1; \
  |  |  638|  25.1k|		} else { \
  |  |  639|  25.1k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  25.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 25.1k]
  |  |  ------------------
  |  |  640|  25.1k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  25.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  25.1k|			   return -1; \
  |  |  642|  25.1k|		} \
  |  |  643|  34.8k|		break; \
  |  |  644|  34.8k|	} \
  |  |  645|  34.8k|	break
  ------------------
  661|       |
  662|  34.8k|  	case FILE_QUAD:
  ------------------
  |  |  277|    253|#define				FILE_QUAD		24
  ------------------
  |  Branch (662:4): [True: 253, False: 167k]
  ------------------
  663|  1.89k|  	case FILE_BEQUAD:
  ------------------
  |  |  279|  1.89k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (663:4): [True: 1.63k, False: 166k]
  ------------------
  664|  2.11k|  	case FILE_LEQUAD:
  ------------------
  |  |  278|  2.11k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (664:4): [True: 227, False: 167k]
  ------------------
  665|  2.89k|	case FILE_OFFSET:
  ------------------
  |  |  305|  2.89k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (665:2): [True: 774, False: 166k]
  ------------------
  666|  2.89k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  618|  2.89k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  460|  2.89k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  619|  2.89k|	switch (check_fmt(ms, desc)) { \
  |  |  620|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (620:2): [True: 0, False: 2.89k]
  |  |  ------------------
  |  |  621|      0|		return -1; \
  |  |  622|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (622:2): [True: 0, False: 2.89k]
  |  |  ------------------
  |  |  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.89k|	default: \
  |  |  ------------------
  |  |  |  Branch (633:2): [True: 2.89k, False: 0]
  |  |  ------------------
  |  |  634|  2.89k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  237|  2.89k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (634:7): [True: 1.69k, False: 1.19k]
  |  |  ------------------
  |  |  635|  1.69k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  167|  1.69k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (635:14): [True: 0, False: 1.69k]
  |  |  ------------------
  |  |  636|  1.69k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  1.69k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  637|  1.69k|			   return -1; \
  |  |  638|  1.69k|		} else { \
  |  |  639|  1.19k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  167|  1.19k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (639:14): [True: 0, False: 1.19k]
  |  |  ------------------
  |  |  640|  1.19k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  460|  1.19k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  641|  1.19k|			   return -1; \
  |  |  642|  1.19k|		} \
  |  |  643|  2.89k|		break; \
  |  |  644|  2.89k|	} \
  |  |  645|  2.89k|	break
  ------------------
  667|       |
  668|  44.6k|  	case FILE_STRING:
  ------------------
  |  |  258|  44.6k|#define				FILE_STRING		5
  ------------------
  |  Branch (668:4): [True: 44.6k, False: 123k]
  ------------------
  669|  46.5k|  	case FILE_PSTRING:
  ------------------
  |  |  266|  46.5k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (669:4): [True: 1.81k, False: 165k]
  ------------------
  670|  46.6k|  	case FILE_BESTRING16:
  ------------------
  |  |  271|  46.6k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (670:4): [True: 147, False: 167k]
  ------------------
  671|  47.2k|  	case FILE_LESTRING16:
  ------------------
  |  |  272|  47.2k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (671:4): [True: 562, False: 167k]
  ------------------
  672|  47.2k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (672:7): [True: 23.5k, False: 23.7k]
  |  Branch (672:25): [True: 284, False: 23.4k]
  ------------------
  673|  23.8k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  23.8k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (673:8): [True: 0, False: 23.8k]
  ------------------
  674|  23.8k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  675|  23.8k|			    sizeof(m->value.s))) == -1)
  676|      0|				return -1;
  677|  23.8k|		}
  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: 100]
  ------------------
  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: 365, False: 23.0k]
  ------------------
  687|    365|				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.81k, False: 21.5k]
  ------------------
  695|  1.81k|				size_t l = file_pstring_length_size(ms, m);
  696|  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 (696:9): [True: 0, False: 1.81k]
  ------------------
  697|      0|					return -1;
  698|  1.81k|			}
  699|  23.4k|		}
  700|  47.2k|		break;
  701|       |
  702|  47.2k|	case FILE_DATE:
  ------------------
  |  |  259|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (702:2): [True: 0, False: 167k]
  ------------------
  703|    324|	case FILE_BEDATE:
  ------------------
  |  |  262|    324|#define				FILE_BEDATE		9
  ------------------
  |  Branch (703:2): [True: 324, False: 167k]
  ------------------
  704|  1.00k|	case FILE_LEDATE:
  ------------------
  |  |  265|  1.00k|#define				FILE_LEDATE		12
  ------------------
  |  Branch (704:2): [True: 682, False: 167k]
  ------------------
  705|  1.04k|	case FILE_MEDATE:
  ------------------
  |  |  274|  1.04k|#define				FILE_MEDATE		21
  ------------------
  |  Branch (705:2): [True: 40, False: 167k]
  ------------------
  706|  1.04k|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  1.04k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (706:7): [True: 0, False: 1.04k]
  ------------------
  707|  1.04k|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  708|      0|			return -1;
  709|  1.04k|		break;
  710|       |
  711|  1.04k|	case FILE_LDATE:
  ------------------
  |  |  267|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (711:2): [True: 0, False: 167k]
  ------------------
  712|    299|	case FILE_BELDATE:
  ------------------
  |  |  268|    299|#define				FILE_BELDATE		15
  ------------------
  |  Branch (712:2): [True: 299, False: 167k]
  ------------------
  713|    333|	case FILE_LELDATE:
  ------------------
  |  |  269|    333|#define				FILE_LELDATE		16
  ------------------
  |  Branch (713:2): [True: 34, False: 167k]
  ------------------
  714|    333|	case FILE_MELDATE:
  ------------------
  |  |  275|    333|#define				FILE_MELDATE		22
  ------------------
  |  Branch (714:2): [True: 0, False: 167k]
  ------------------
  715|    333|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    333|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (715:7): [True: 0, False: 333]
  ------------------
  716|    333|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  548|    333|#define FILE_T_LOCAL	1
  ------------------
  717|    333|			== -1)
  718|      0|			return -1;
  719|    333|		break;
  720|       |
  721|    333|	case FILE_QDATE:
  ------------------
  |  |  280|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (721:2): [True: 0, False: 167k]
  ------------------
  722|    384|	case FILE_BEQDATE:
  ------------------
  |  |  282|    384|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (722:2): [True: 384, False: 167k]
  ------------------
  723|    384|	case FILE_LEQDATE:
  ------------------
  |  |  281|    384|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (723:2): [True: 0, False: 167k]
  ------------------
  724|    384|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    384|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (724:7): [True: 0, False: 384]
  ------------------
  725|    384|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  726|      0|			return -1;
  727|    384|		break;
  728|       |
  729|    384|	case FILE_QLDATE:
  ------------------
  |  |  283|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (729:2): [True: 0, False: 167k]
  ------------------
  730|    184|	case FILE_BEQLDATE:
  ------------------
  |  |  285|    184|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (730:2): [True: 184, False: 167k]
  ------------------
  731|    194|	case FILE_LEQLDATE:
  ------------------
  |  |  284|    194|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (731:2): [True: 10, False: 167k]
  ------------------
  732|    194|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    194|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (732:7): [True: 0, False: 194]
  ------------------
  733|    194|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  548|    194|#define FILE_T_LOCAL	1
  ------------------
  734|      0|			return -1;
  735|    194|		break;
  736|       |
  737|    376|	case FILE_QWDATE:
  ------------------
  |  |  295|    376|#define				FILE_QWDATE		42
  ------------------
  |  Branch (737:2): [True: 376, False: 167k]
  ------------------
  738|    376|	case FILE_BEQWDATE:
  ------------------
  |  |  297|    376|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (738:2): [True: 0, False: 167k]
  ------------------
  739|  1.29k|	case FILE_LEQWDATE:
  ------------------
  |  |  296|  1.29k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (739:2): [True: 919, False: 166k]
  ------------------
  740|  1.29k|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|  1.29k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (740:7): [True: 0, False: 1.29k]
  ------------------
  741|  1.29k|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  549|  1.29k|#define FILE_T_WINDOWS	2
  ------------------
  742|  1.29k|		    == -1)
  743|      0|			return -1;
  744|  1.29k|		break;
  745|       |
  746|  1.29k|	case FILE_FLOAT:
  ------------------
  |  |  286|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (746:2): [True: 0, False: 167k]
  ------------------
  747|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (747:2): [True: 0, False: 167k]
  ------------------
  748|    536|	case FILE_LEFLOAT:
  ------------------
  |  |  288|    536|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (748:2): [True: 536, False: 167k]
  ------------------
  749|    536|		vf = p->f;
  750|    536|		switch (check_fmt(ms, desc)) {
  751|      0|		case -1:
  ------------------
  |  Branch (751:3): [True: 0, False: 536]
  ------------------
  752|      0|			return -1;
  753|      0|		case 1:
  ------------------
  |  Branch (753:3): [True: 0, False: 536]
  ------------------
  754|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  755|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  167|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (755:8): [True: 0, False: 0]
  ------------------
  756|      0|				return -1;
  757|      0|			break;
  758|    536|		default:
  ------------------
  |  Branch (758:3): [True: 536, False: 0]
  ------------------
  759|    536|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  167|    536|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (759:8): [True: 0, False: 536]
  ------------------
  760|      0|				return -1;
  761|    536|			break;
  762|    536|		}
  763|    536|  		break;
  764|       |
  765|    536|	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (765:2): [True: 0, False: 167k]
  ------------------
  766|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  290|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (766:2): [True: 0, False: 167k]
  ------------------
  767|    524|	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    524|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (767:2): [True: 524, False: 167k]
  ------------------
  768|    524|		vd = p->d;
  769|    524|		switch (check_fmt(ms, desc)) {
  770|      0|		case -1:
  ------------------
  |  Branch (770:3): [True: 0, False: 524]
  ------------------
  771|      0|			return -1;
  772|      0|		case 1:
  ------------------
  |  Branch (772:3): [True: 0, False: 524]
  ------------------
  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|    524|		default:
  ------------------
  |  Branch (777:3): [True: 524, False: 0]
  ------------------
  778|    524|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  167|    524|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (778:8): [True: 0, False: 524]
  ------------------
  779|      0|				return -1;
  780|    524|			break;
  781|    524|		}
  782|    524|  		break;
  783|       |
  784|    524|	case FILE_SEARCH:
  ------------------
  |  |  273|    280|#define				FILE_SEARCH		20
  ------------------
  |  Branch (784:2): [True: 280, False: 167k]
  ------------------
  785|    775|	case FILE_REGEX: {
  ------------------
  |  |  270|    775|#define				FILE_REGEX		17
  ------------------
  |  Branch (785:2): [True: 495, False: 167k]
  ------------------
  786|    775|		char *cp, *scp;
  787|    775|		int rval;
  788|       |
  789|    775|		if (ms->search.s == NULL)
  ------------------
  |  Branch (789:7): [True: 0, False: 775]
  ------------------
  790|      0|			break;
  791|       |
  792|    775|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  461|    775|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  793|    775|		    ms->search.rm_len);
  794|    775|		if (cp == NULL) {
  ------------------
  |  Branch (794:7): [True: 0, False: 775]
  ------------------
  795|      0|			file_oomem(ms, ms->search.rm_len);
  796|      0|			return -1;
  797|      0|		}
  798|    775|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  390|    775|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  421|    775|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  403|    775|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (798:9): [True: 34, False: 741]
  ------------------
  799|       |
  800|    775|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  167|    775|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  801|    775|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  802|    775|		free(cp);
  803|       |
  804|    775|		if (rval == -1)
  ------------------
  |  Branch (804:7): [True: 0, False: 775]
  ------------------
  805|      0|			return -1;
  806|    775|		break;
  807|    775|	}
  808|       |
  809|  1.72k|	case FILE_DEFAULT:
  ------------------
  |  |  256|  1.72k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (809:2): [True: 1.72k, False: 165k]
  ------------------
  810|  2.13k|	case FILE_CLEAR:
  ------------------
  |  |  300|  2.13k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (810:2): [True: 411, False: 167k]
  ------------------
  811|  2.13k|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (811:9): [True: 0, False: 2.13k]
  ------------------
  812|      0|			return -1;
  813|  2.13k|		break;
  814|       |
  815|  3.52k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  3.52k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (815:2): [True: 3.52k, False: 164k]
  ------------------
  816|  3.61k|	case FILE_USE:
  ------------------
  |  |  299|  3.61k|#define				FILE_USE		46
  ------------------
  |  Branch (816:2): [True: 88, False: 167k]
  ------------------
  817|  10.0k|	case FILE_NAME:
  ------------------
  |  |  298|  10.0k|#define				FILE_NAME		45
  ------------------
  |  Branch (817:2): [True: 6.44k, False: 161k]
  ------------------
  818|  10.0k|		break;
  819|    248|	case FILE_DER:
  ------------------
  |  |  301|    248|#define				FILE_DER		48
  ------------------
  |  Branch (819:2): [True: 248, False: 167k]
  ------------------
  820|    248|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    248|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (820:7): [True: 0, False: 248]
  ------------------
  821|    248|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  822|    248|			sizeof(ms->ms_value.s))) == -1)
  823|      0|			return -1;
  824|    248|		break;
  825|    312|	case FILE_GUID:
  ------------------
  |  |  302|    312|#define				FILE_GUID		49
  ------------------
  |  Branch (825:2): [True: 312, False: 167k]
  ------------------
  826|    312|	case FILE_LEGUID:
  ------------------
  |  |  303|    312|#define				FILE_LEGUID		50
  ------------------
  |  Branch (826:2): [True: 0, False: 167k]
  ------------------
  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: 167k]
  ------------------
  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: 167k]
  ------------------
  837|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|      0|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (837:2): [True: 0, False: 167k]
  ------------------
  838|    212|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|    212|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (838:2): [True: 212, False: 167k]
  ------------------
  839|    212|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    212|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (839:7): [True: 0, False: 212]
  ------------------
  840|    212|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  841|      0|			return -1;
  842|    212|		break;
  843|    212|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|      0|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (843:2): [True: 0, False: 167k]
  ------------------
  844|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|      0|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (844:2): [True: 0, False: 167k]
  ------------------
  845|    212|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|    212|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (845:2): [True: 212, False: 167k]
  ------------------
  846|    212|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  167|    212|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (846:7): [True: 0, False: 212]
  ------------------
  847|    212|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  848|      0|			return -1;
  849|    212|		break;
  850|    212|	case FILE_OCTAL:
  ------------------
  |  |  314|      0|#define				FILE_OCTAL		61
  ------------------
  |  Branch (850:2): [True: 0, False: 167k]
  ------------------
  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: 167k]
  ------------------
  856|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  857|      0|		return -1;
  858|   167k|	}
  859|   167k|	return 0;
  860|   167k|}
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: 62.4k, False: 40.7k]
  ------------------
  515|  62.4k|		return 0;
  516|       |
  517|  40.7k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  518|  40.7k|	if (rc != 0)
  ------------------
  |  Branch (518:6): [True: 0, False: 40.7k]
  ------------------
  519|      0|		return -1;
  520|  40.7k|	rc = !file_regexec(ms, &rx, fmt, 0, 0, 0);
  521|  40.7k|	file_regfree(&rx);
  522|  40.7k|	return rc;
  523|  40.7k|}
softmagic.c:moffset:
  865|   879k|{
  866|   879k|	int32_t o;
  867|   879k|	size_t vlen;
  868|       |
  869|   879k|  	switch (m->type) {
  870|   266k|  	case FILE_BYTE:
  ------------------
  |  |  254|   266k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (870:4): [True: 266k, False: 613k]
  ------------------
  871|   266k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  460|   266k|#define CAST(T, b)	((T)(b))
  ------------------
  872|   266k|		break;
  873|       |
  874|  18.0k|  	case FILE_SHORT:
  ------------------
  |  |  255|  18.0k|#define				FILE_SHORT		2
  ------------------
  |  Branch (874:4): [True: 18.0k, False: 861k]
  ------------------
  875|  81.5k|  	case FILE_BESHORT:
  ------------------
  |  |  260|  81.5k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (875:4): [True: 63.4k, False: 816k]
  ------------------
  876|   158k|  	case FILE_LESHORT:
  ------------------
  |  |  263|   158k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (876:4): [True: 76.7k, False: 803k]
  ------------------
  877|   158k|	case FILE_MSDOSDATE:
  ------------------
  |  |  308|   158k|#define				FILE_MSDOSDATE		55
  ------------------
  |  Branch (877:2): [True: 0, False: 879k]
  ------------------
  878|   158k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  309|   158k|#define				FILE_LEMSDOSDATE	56
  ------------------
  |  Branch (878:2): [True: 212, False: 879k]
  ------------------
  879|   158k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  310|   158k|#define				FILE_BEMSDOSDATE	57
  ------------------
  |  Branch (879:2): [True: 0, False: 879k]
  ------------------
  880|   158k|	case FILE_MSDOSTIME:
  ------------------
  |  |  311|   158k|#define				FILE_MSDOSTIME		58
  ------------------
  |  Branch (880:2): [True: 0, False: 879k]
  ------------------
  881|   158k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  312|   158k|#define				FILE_LEMSDOSTIME	59
  ------------------
  |  Branch (881:2): [True: 212, False: 879k]
  ------------------
  882|   158k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  313|   158k|#define				FILE_BEMSDOSTIME	60
  ------------------
  |  Branch (882:2): [True: 0, False: 879k]
  ------------------
  883|   158k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  460|   158k|#define CAST(T, b)	((T)(b))
  ------------------
  884|   158k|		break;
  885|       |
  886|  4.61k|  	case FILE_LONG:
  ------------------
  |  |  257|  4.61k|#define				FILE_LONG		4
  ------------------
  |  Branch (886:4): [True: 4.61k, False: 875k]
  ------------------
  887|  98.7k|  	case FILE_BELONG:
  ------------------
  |  |  261|  98.7k|#define				FILE_BELONG		8
  ------------------
  |  Branch (887:4): [True: 94.1k, False: 785k]
  ------------------
  888|   142k|  	case FILE_LELONG:
  ------------------
  |  |  264|   142k|#define				FILE_LELONG		11
  ------------------
  |  Branch (888:4): [True: 43.4k, False: 836k]
  ------------------
  889|   142k|  	case FILE_MELONG:
  ------------------
  |  |  276|   142k|#define				FILE_MELONG		23
  ------------------
  |  Branch (889:4): [True: 34, False: 879k]
  ------------------
  890|   142k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  460|   142k|#define CAST(T, b)	((T)(b))
  ------------------
  891|   142k|		break;
  892|       |
  893|  30.1k|  	case FILE_QUAD:
  ------------------
  |  |  277|  30.1k|#define				FILE_QUAD		24
  ------------------
  |  Branch (893:4): [True: 30.1k, False: 849k]
  ------------------
  894|  39.2k|  	case FILE_BEQUAD:
  ------------------
  |  |  279|  39.2k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (894:4): [True: 9.12k, False: 870k]
  ------------------
  895|  40.2k|  	case FILE_LEQUAD:
  ------------------
  |  |  278|  40.2k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (895:4): [True: 967, False: 878k]
  ------------------
  896|  40.2k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  460|  40.2k|#define CAST(T, b)	((T)(b))
  ------------------
  897|  40.2k|		break;
  898|       |
  899|  95.2k|  	case FILE_STRING:
  ------------------
  |  |  258|  95.2k|#define				FILE_STRING		5
  ------------------
  |  Branch (899:4): [True: 95.2k, False: 784k]
  ------------------
  900|  97.0k|  	case FILE_PSTRING:
  ------------------
  |  |  266|  97.0k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (900:4): [True: 1.82k, False: 878k]
  ------------------
  901|  97.2k|  	case FILE_BESTRING16:
  ------------------
  |  |  271|  97.2k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (901:4): [True: 147, False: 879k]
  ------------------
  902|  97.7k|  	case FILE_LESTRING16:
  ------------------
  |  |  272|  97.7k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (902:4): [True: 562, False: 879k]
  ------------------
  903|  97.7k|	case FILE_OCTAL:
  ------------------
  |  |  314|  97.7k|#define				FILE_OCTAL		61
  ------------------
  |  Branch (903:2): [True: 0, False: 879k]
  ------------------
  904|  97.7k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (904:7): [True: 33.9k, False: 63.8k]
  |  Branch (904:25): [True: 1.70k, False: 62.1k]
  ------------------
  905|  35.6k|			o = ms->offset + m->vallen;
  906|  62.1k|		} else {
  907|  62.1k|			union VALUETYPE *p = &ms->ms_value;
  908|       |
  909|  62.1k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (909:8): [True: 52.3k, False: 9.75k]
  ------------------
  910|  52.3k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  911|  62.1k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  460|  62.1k|#define CAST(T, b)	((T)(b))
  ------------------
  912|  62.1k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  266|  62.1k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (912:8): [True: 1.82k, False: 60.2k]
  ------------------
  913|  1.82k|				size_t l = file_pstring_length_size(ms, m);
  914|  1.82k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  183|  1.82k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  460|  1.82k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (914:9): [True: 0, False: 1.82k]
  ------------------
  915|      0|					return -1;
  916|  1.82k|				o += CAST(uint32_t, l);
  ------------------
  |  |  460|  1.82k|#define CAST(T, b)	((T)(b))
  ------------------
  917|  1.82k|			}
  918|  62.1k|		}
  919|  97.7k|		break;
  920|       |
  921|  97.7k|	case FILE_DATE:
  ------------------
  |  |  259|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (921:2): [True: 0, False: 879k]
  ------------------
  922|    324|	case FILE_BEDATE:
  ------------------
  |  |  262|    324|#define				FILE_BEDATE		9
  ------------------
  |  Branch (922:2): [True: 324, False: 879k]
  ------------------
  923|  1.00k|	case FILE_LEDATE:
  ------------------
  |  |  265|  1.00k|#define				FILE_LEDATE		12
  ------------------
  |  Branch (923:2): [True: 682, False: 879k]
  ------------------
  924|  1.04k|	case FILE_MEDATE:
  ------------------
  |  |  274|  1.04k|#define				FILE_MEDATE		21
  ------------------
  |  Branch (924:2): [True: 40, False: 879k]
  ------------------
  925|  1.04k|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  460|  1.04k|#define CAST(T, b)	((T)(b))
  ------------------
  926|  1.04k|		break;
  927|       |
  928|      0|	case FILE_LDATE:
  ------------------
  |  |  267|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (928:2): [True: 0, False: 879k]
  ------------------
  929|    299|	case FILE_BELDATE:
  ------------------
  |  |  268|    299|#define				FILE_BELDATE		15
  ------------------
  |  Branch (929:2): [True: 299, False: 879k]
  ------------------
  930|    333|	case FILE_LELDATE:
  ------------------
  |  |  269|    333|#define				FILE_LELDATE		16
  ------------------
  |  Branch (930:2): [True: 34, False: 879k]
  ------------------
  931|    333|	case FILE_MELDATE:
  ------------------
  |  |  275|    333|#define				FILE_MELDATE		22
  ------------------
  |  Branch (931:2): [True: 0, False: 879k]
  ------------------
  932|    333|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  460|    333|#define CAST(T, b)	((T)(b))
  ------------------
  933|    333|		break;
  934|       |
  935|      0|	case FILE_QDATE:
  ------------------
  |  |  280|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (935:2): [True: 0, False: 879k]
  ------------------
  936|    384|	case FILE_BEQDATE:
  ------------------
  |  |  282|    384|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (936:2): [True: 384, False: 879k]
  ------------------
  937|    384|	case FILE_LEQDATE:
  ------------------
  |  |  281|    384|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (937:2): [True: 0, False: 879k]
  ------------------
  938|    384|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  460|    384|#define CAST(T, b)	((T)(b))
  ------------------
  939|    384|		break;
  940|       |
  941|      0|	case FILE_QLDATE:
  ------------------
  |  |  283|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (941:2): [True: 0, False: 879k]
  ------------------
  942|    184|	case FILE_BEQLDATE:
  ------------------
  |  |  285|    184|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (942:2): [True: 184, False: 879k]
  ------------------
  943|    194|	case FILE_LEQLDATE:
  ------------------
  |  |  284|    194|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (943:2): [True: 10, False: 879k]
  ------------------
  944|    194|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  460|    194|#define CAST(T, b)	((T)(b))
  ------------------
  945|    194|		break;
  946|       |
  947|      0|  	case FILE_FLOAT:
  ------------------
  |  |  286|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (947:4): [True: 0, False: 879k]
  ------------------
  948|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  287|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (948:4): [True: 0, False: 879k]
  ------------------
  949|    536|  	case FILE_LEFLOAT:
  ------------------
  |  |  288|    536|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (949:4): [True: 536, False: 879k]
  ------------------
  950|    536|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  460|    536|#define CAST(T, b)	((T)(b))
  ------------------
  951|    536|		break;
  952|       |
  953|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  289|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (953:4): [True: 0, False: 879k]
  ------------------
  954|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  290|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (954:4): [True: 0, False: 879k]
  ------------------
  955|    524|  	case FILE_LEDOUBLE:
  ------------------
  |  |  291|    524|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (955:4): [True: 524, False: 879k]
  ------------------
  956|    524|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  460|    524|#define CAST(T, b)	((T)(b))
  ------------------
  957|    524|		break;
  958|       |
  959|  1.27k|	case FILE_REGEX:
  ------------------
  |  |  270|  1.27k|#define				FILE_REGEX		17
  ------------------
  |  Branch (959:2): [True: 1.27k, False: 878k]
  ------------------
  960|       |		/* Why is regex and search different? */
  961|  1.27k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  390|  1.27k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
  ------------------
  |  |  408|  1.27k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  403|  1.27k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (961:10): [True: 1.20k, False: 73]
  ------------------
  962|  1.20k|		    ms->search.rm_len : 0;
  963|  1.27k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  460|  1.27k|#define CAST(T, b)	((T)(b))
  ------------------
  964|  1.27k|		break;
  965|       |
  966|  7.87k|	case FILE_SEARCH:
  ------------------
  |  |  273|  7.87k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (966:2): [True: 7.87k, False: 872k]
  ------------------
  967|  7.87k|		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  390|  7.87k|#define str_flags _u._s._flags
  ------------------
              		vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
  ------------------
  |  |  408|  7.87k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  403|  7.87k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (967:10): [True: 7.62k, False: 257]
  ------------------
  968|  7.87k|		o = CAST(int32_t, ms->search.offset + vlen - offset);
  ------------------
  |  |  460|  7.87k|#define CAST(T, b)	((T)(b))
  ------------------
  969|  7.87k|		break;
  970|       |
  971|  3.25k|	case FILE_CLEAR:
  ------------------
  |  |  300|  3.25k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (971:2): [True: 3.25k, False: 876k]
  ------------------
  972|  13.5k|	case FILE_DEFAULT:
  ------------------
  |  |  256|  13.5k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (972:2): [True: 10.2k, False: 869k]
  ------------------
  973|  27.3k|	case FILE_INDIRECT:
  ------------------
  |  |  294|  27.3k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (973:2): [True: 13.7k, False: 866k]
  ------------------
  974|  28.1k|	case FILE_OFFSET:
  ------------------
  |  |  305|  28.1k|#define				FILE_OFFSET		52
  ------------------
  |  Branch (974:2): [True: 877, False: 879k]
  ------------------
  975|  66.8k|	case FILE_USE:
  ------------------
  |  |  299|  66.8k|#define				FILE_USE		46
  ------------------
  |  Branch (975:2): [True: 38.6k, False: 841k]
  ------------------
  976|  66.8k|		o = ms->offset;
  977|  66.8k|		break;
  978|       |
  979|  27.1k|	case FILE_DER:
  ------------------
  |  |  301|  27.1k|#define				FILE_DER		48
  ------------------
  |  Branch (979:2): [True: 27.1k, False: 852k]
  ------------------
  980|  27.1k|		o = der_offs(ms, m, nbytes);
  981|  27.1k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  460|  27.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (981:7): [True: 0, False: 27.1k]
  |  Branch (981:18): [True: 0, False: 27.1k]
  ------------------
  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.1k|		break;
  991|       |
  992|  27.1k|	case FILE_BEGUID:
  ------------------
  |  |  304|     84|#define				FILE_BEGUID		51
  ------------------
  |  Branch (992:2): [True: 84, False: 879k]
  ------------------
  993|     84|	case FILE_LEGUID:
  ------------------
  |  |  303|     84|#define				FILE_LEGUID		50
  ------------------
  |  Branch (993:2): [True: 0, False: 879k]
  ------------------
  994|    396|	case FILE_GUID:
  ------------------
  |  |  302|    396|#define				FILE_GUID		49
  ------------------
  |  Branch (994:2): [True: 312, False: 879k]
  ------------------
  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|  67.4k|	default:
  ------------------
  |  Branch (998:2): [True: 67.4k, False: 812k]
  ------------------
  999|  67.4k|		o = 0;
 1000|  67.4k|		break;
 1001|   879k|	}
 1002|       |
 1003|   879k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  460|   879k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1003:6): [True: 32.0k, False: 847k]
  ------------------
 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.0k|		return -1;
 1009|  32.0k|	}
 1010|   847k|	*op = o;
 1011|   847k|	return 1;
 1012|   879k|}

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

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

