file_ms_alloc:
  551|      2|{
  552|      2|	struct magic_set *ms;
  553|      2|	size_t i, len;
  554|       |
  555|      2|	if ((ms = CAST(struct magic_set *, calloc(CAST(size_t, 1u),
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (555:6): [True: 0, False: 2]
  ------------------
  556|      2|	    sizeof(*ms)))) == NULL)
  557|      0|		return NULL;
  558|       |
  559|      2|	if (magic_setflags(ms, flags) == -1) {
  ------------------
  |  Branch (559:6): [True: 0, False: 2]
  ------------------
  560|      0|		errno = EINVAL;
  561|      0|		goto free;
  562|      0|	}
  563|       |
  564|      2|	ms->o.buf = ms->o.pbuf = NULL;
  565|      2|	ms->o.blen = 0;
  566|      2|	len = (ms->c.len = 10) * sizeof(*ms->c.li);
  567|       |
  568|      2|	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (568:6): [True: 0, False: 2]
  ------------------
  569|      0|		goto free;
  570|       |
  571|      2|	ms->event_flags = 0;
  572|      2|	ms->error = -1;
  573|      6|	for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (573:14): [True: 4, False: 2]
  ------------------
  574|      4|		ms->mlist[i] = NULL;
  575|      2|	ms->file = "unknown";
  576|      2|	ms->line = 0;
  577|      2|	ms->indir_max = FILE_INDIR_MAX;
  ------------------
  |  |  511|      2|#define	FILE_INDIR_MAX			50
  ------------------
  578|      2|	ms->name_max = FILE_NAME_MAX;
  ------------------
  |  |  512|      2|#define	FILE_NAME_MAX			50
  ------------------
  579|      2|	ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
  ------------------
  |  |  509|      2|#define	FILE_ELF_SHNUM_MAX		32768
  ------------------
  580|      2|	ms->elf_shsize_max = FILE_ELF_SHSIZE_MAX;
  ------------------
  |  |  510|      2|#define	FILE_ELF_SHSIZE_MAX		(128 * 1024 * 1024)
  ------------------
  581|      2|	ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
  ------------------
  |  |  508|      2|#define	FILE_ELF_PHNUM_MAX		2048
  ------------------
  582|      2|	ms->elf_notes_max = FILE_ELF_NOTES_MAX;
  ------------------
  |  |  507|      2|#define	FILE_ELF_NOTES_MAX		256
  ------------------
  583|      2|	ms->regex_max = FILE_REGEX_MAX;
  ------------------
  |  |  513|      2|#define	FILE_REGEX_MAX			8192
  ------------------
  584|      2|	ms->bytes_max = FILE_BYTES_MAX;
  ------------------
  |  |  505|      2|# define FILE_BYTES_MAX (7 * 1024 * 1024)/* how much of the file to look at */
  ------------------
  585|      2|	ms->encoding_max = FILE_ENCODING_MAX;
  ------------------
  |  |  514|      2|#define	FILE_ENCODING_MAX		(64 * 1024)
  ------------------
  586|      2|#ifdef USE_C_LOCALE
  587|      2|	ms->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
  588|      2|	assert(ms->c_lc_ctype != NULL);
  589|      2|#endif
  590|      2|	return ms;
  591|      0|free:
  592|      0|	free(ms);
  593|      0|	return NULL;
  594|      2|}
file_apprentice:
  735|      2|{
  736|      2|	char *p, *mfn;
  737|      2|	int fileerr, errs = -1;
  738|      2|	size_t i, j;
  739|       |
  740|      2|	(void)file_reset(ms, 0);
  741|       |
  742|      2|	if ((fn = magic_getpath(fn, action)) == NULL)
  ------------------
  |  Branch (742:6): [True: 0, False: 2]
  ------------------
  743|      0|		return -1;
  744|       |
  745|      2|	init_file_tables();
  746|       |
  747|      2|	if ((mfn = strdup(fn)) == NULL) {
  ------------------
  |  Branch (747:6): [True: 0, False: 2]
  ------------------
  748|      0|		file_oomem(ms, strlen(fn));
  749|      0|		return -1;
  750|      0|	}
  751|       |
  752|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (752:14): [True: 4, False: 2]
  ------------------
  753|      4|		mlist_free(ms->mlist[i]);
  754|      4|		if ((ms->mlist[i] = mlist_alloc()) == NULL) {
  ------------------
  |  Branch (754:7): [True: 0, False: 4]
  ------------------
  755|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  756|      0|			for (j = 0; j < i; j++) {
  ------------------
  |  Branch (756:16): [True: 0, False: 0]
  ------------------
  757|      0|				mlist_free(ms->mlist[j]);
  758|      0|				ms->mlist[j] = NULL;
  759|      0|			}
  760|      0|			free(mfn);
  761|      0|			return -1;
  762|      0|		}
  763|      4|	}
  764|      2|	fn = mfn;
  765|       |
  766|      4|	while (fn) {
  ------------------
  |  Branch (766:9): [True: 2, False: 2]
  ------------------
  767|      2|		p = CCAST(char *, strchr(fn, PATHSEP));
  ------------------
  |  |  446|      2|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  768|      2|		if (p)
  ------------------
  |  Branch (768:7): [True: 0, False: 2]
  ------------------
  769|      0|			*p++ = '\0';
  770|      2|		if (*fn == '\0')
  ------------------
  |  Branch (770:7): [True: 0, False: 2]
  ------------------
  771|      0|			break;
  772|      2|		fileerr = apprentice_1(ms, fn, action);
  773|      2|		errs = MAX(errs, fileerr);
  774|      2|		fn = p;
  775|      2|	}
  776|       |
  777|      2|	free(mfn);
  778|       |
  779|      2|	if (errs == -1) {
  ------------------
  |  Branch (779:6): [True: 0, False: 2]
  ------------------
  780|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (780:15): [True: 0, False: 0]
  ------------------
  781|      0|			mlist_free(ms->mlist[i]);
  782|      0|			ms->mlist[i] = NULL;
  783|      0|		}
  784|      0|		file_error(ms, 0, "could not find any valid magic files!");
  785|      0|		return -1;
  786|      0|	}
  787|       |
  788|       |#if 0
  789|       |	/*
  790|       |	 * Always leave the database loaded
  791|       |	 */
  792|       |	if (action == FILE_LOAD)
  793|       |		return 0;
  794|       |
  795|       |	for (i = 0; i < MAGIC_SETS; i++) {
  796|       |		mlist_free(ms->mlist[i]);
  797|       |		ms->mlist[i] = NULL;
  798|       |	}
  799|       |#endif
  800|       |
  801|      2|	switch (action) {
  802|      2|	case FILE_LOAD:
  ------------------
  |  |  187|      2|#define	FILE_LOAD	0
  ------------------
  |  Branch (802:2): [True: 2, False: 0]
  ------------------
  803|      2|	case FILE_COMPILE:
  ------------------
  |  |  189|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (803:2): [True: 0, False: 2]
  ------------------
  804|      2|	case FILE_CHECK:
  ------------------
  |  |  188|      2|#define FILE_CHECK	1
  ------------------
  |  Branch (804:2): [True: 0, False: 2]
  ------------------
  805|      2|	case FILE_LIST:
  ------------------
  |  |  190|      2|#define FILE_LIST	3
  ------------------
  |  Branch (805:2): [True: 0, False: 2]
  ------------------
  806|      2|		return 0;
  807|      0|	default:
  ------------------
  |  Branch (807:2): [True: 0, False: 2]
  ------------------
  808|      0|		file_error(ms, 0, "Invalid action %d", action);
  809|      0|		return -1;
  810|      2|	}
  811|      2|}
file_signextend:
 1631|  71.4M|{
 1632|  71.4M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  226|  71.4M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1632:6): [True: 67.3M, False: 4.11M]
  ------------------
 1633|  67.3M|		switch(m->type) {
 1634|       |		/*
 1635|       |		 * Do not remove the casts below.  They are
 1636|       |		 * vital.  When later compared with the data,
 1637|       |		 * the sign extension must have happened.
 1638|       |		 */
 1639|   607k|		case FILE_BYTE:
  ------------------
  |  |  241|   607k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1639:3): [True: 607k, False: 66.7M]
  ------------------
 1640|   607k|			v = CAST(signed char,  v);
  ------------------
  |  |  444|   607k|#define CAST(T, b)	((T)(b))
  ------------------
 1641|   607k|			break;
 1642|   809k|		case FILE_SHORT:
  ------------------
  |  |  242|   809k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1642:3): [True: 809k, False: 66.5M]
  ------------------
 1643|  4.01M|		case FILE_BESHORT:
  ------------------
  |  |  247|  4.01M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1643:3): [True: 3.20M, False: 64.1M]
  ------------------
 1644|  6.00M|		case FILE_LESHORT:
  ------------------
  |  |  250|  6.00M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1644:3): [True: 1.98M, False: 65.3M]
  ------------------
 1645|  6.00M|			v = CAST(short, v);
  ------------------
  |  |  444|  6.00M|#define CAST(T, b)	((T)(b))
  ------------------
 1646|  6.00M|			break;
 1647|      0|		case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1647:3): [True: 0, False: 67.3M]
  ------------------
 1648|    168|		case FILE_BEDATE:
  ------------------
  |  |  249|    168|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1648:3): [True: 168, False: 67.3M]
  ------------------
 1649|    517|		case FILE_LEDATE:
  ------------------
  |  |  252|    517|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1649:3): [True: 349, False: 67.3M]
  ------------------
 1650|    585|		case FILE_MEDATE:
  ------------------
  |  |  261|    585|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1650:3): [True: 68, False: 67.3M]
  ------------------
 1651|    585|		case FILE_LDATE:
  ------------------
  |  |  254|    585|#define				FILE_LDATE		14
  ------------------
  |  Branch (1651:3): [True: 0, False: 67.3M]
  ------------------
 1652|  1.15k|		case FILE_BELDATE:
  ------------------
  |  |  255|  1.15k|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1652:3): [True: 574, False: 67.3M]
  ------------------
 1653|  1.19k|		case FILE_LELDATE:
  ------------------
  |  |  256|  1.19k|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1653:3): [True: 34, False: 67.3M]
  ------------------
 1654|  1.19k|		case FILE_MELDATE:
  ------------------
  |  |  262|  1.19k|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1654:3): [True: 0, False: 67.3M]
  ------------------
 1655|  1.21M|		case FILE_LONG:
  ------------------
  |  |  244|  1.21M|#define				FILE_LONG		4
  ------------------
  |  Branch (1655:3): [True: 1.21M, False: 66.1M]
  ------------------
 1656|  10.7M|		case FILE_BELONG:
  ------------------
  |  |  248|  10.7M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1656:3): [True: 9.57M, False: 57.7M]
  ------------------
 1657|  14.1M|		case FILE_LELONG:
  ------------------
  |  |  251|  14.1M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1657:3): [True: 3.30M, False: 64.0M]
  ------------------
 1658|  14.1M|		case FILE_MELONG:
  ------------------
  |  |  263|  14.1M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1658:3): [True: 68, False: 67.3M]
  ------------------
 1659|  14.1M|		case FILE_FLOAT:
  ------------------
  |  |  273|  14.1M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1659:3): [True: 0, False: 67.3M]
  ------------------
 1660|  14.1M|		case FILE_BEFLOAT:
  ------------------
  |  |  274|  14.1M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1660:3): [True: 0, False: 67.3M]
  ------------------
 1661|  14.1M|		case FILE_LEFLOAT:
  ------------------
  |  |  275|  14.1M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1661:3): [True: 0, False: 67.3M]
  ------------------
 1662|  14.1M|		case FILE_MSDOSDATE:
  ------------------
  |  |  293|  14.1M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1662:3): [True: 0, False: 67.3M]
  ------------------
 1663|  14.1M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  14.1M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1663:3): [True: 0, False: 67.3M]
  ------------------
 1664|  14.1M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  14.1M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1664:3): [True: 67, False: 67.3M]
  ------------------
 1665|  14.1M|		case FILE_MSDOSTIME:
  ------------------
  |  |  296|  14.1M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1665:3): [True: 0, False: 67.3M]
  ------------------
 1666|  14.1M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  14.1M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1666:3): [True: 0, False: 67.3M]
  ------------------
 1667|  14.1M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  14.1M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1667:3): [True: 67, False: 67.3M]
  ------------------
 1668|  14.1M|			v = CAST(int32_t, v);
  ------------------
  |  |  444|  14.1M|#define CAST(T, b)	((T)(b))
  ------------------
 1669|  14.1M|			break;
 1670|  56.0k|		case FILE_QUAD:
  ------------------
  |  |  264|  56.0k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1670:3): [True: 56.0k, False: 67.2M]
  ------------------
 1671|   602k|		case FILE_BEQUAD:
  ------------------
  |  |  266|   602k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1671:3): [True: 545k, False: 66.7M]
  ------------------
 1672|   875k|		case FILE_LEQUAD:
  ------------------
  |  |  265|   875k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1672:3): [True: 273k, False: 67.0M]
  ------------------
 1673|   875k|		case FILE_QDATE:
  ------------------
  |  |  267|   875k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1673:3): [True: 0, False: 67.3M]
  ------------------
 1674|   875k|		case FILE_QLDATE:
  ------------------
  |  |  270|   875k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1674:3): [True: 0, False: 67.3M]
  ------------------
 1675|   875k|		case FILE_QWDATE:
  ------------------
  |  |  282|   875k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1675:3): [True: 175, False: 67.3M]
  ------------------
 1676|   876k|		case FILE_BEQDATE:
  ------------------
  |  |  269|   876k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1676:3): [True: 194, False: 67.3M]
  ------------------
 1677|   876k|		case FILE_BEQLDATE:
  ------------------
  |  |  272|   876k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1677:3): [True: 0, False: 67.3M]
  ------------------
 1678|   876k|		case FILE_BEQWDATE:
  ------------------
  |  |  284|   876k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1678:3): [True: 0, False: 67.3M]
  ------------------
 1679|   876k|		case FILE_LEQDATE:
  ------------------
  |  |  268|   876k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1679:3): [True: 107, False: 67.3M]
  ------------------
 1680|   876k|		case FILE_LEQLDATE:
  ------------------
  |  |  271|   876k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1680:3): [True: 36, False: 67.3M]
  ------------------
 1681|   877k|		case FILE_LEQWDATE:
  ------------------
  |  |  283|   877k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1681:3): [True: 1.29k, False: 67.3M]
  ------------------
 1682|   877k|		case FILE_DOUBLE:
  ------------------
  |  |  276|   877k|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1682:3): [True: 0, False: 67.3M]
  ------------------
 1683|   877k|		case FILE_BEDOUBLE:
  ------------------
  |  |  277|   877k|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1683:3): [True: 0, False: 67.3M]
  ------------------
 1684|   877k|		case FILE_LEDOUBLE:
  ------------------
  |  |  278|   877k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1684:3): [True: 0, False: 67.3M]
  ------------------
 1685|   877k|		case FILE_OFFSET:
  ------------------
  |  |  290|   877k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1685:3): [True: 0, False: 67.3M]
  ------------------
 1686|   877k|		case FILE_BEVARINT:
  ------------------
  |  |  291|   877k|#define				FILE_BEVARINT		51
  ------------------
  |  Branch (1686:3): [True: 0, False: 67.3M]
  ------------------
 1687|   877k|		case FILE_LEVARINT:
  ------------------
  |  |  292|   877k|#define				FILE_LEVARINT		52
  ------------------
  |  Branch (1687:3): [True: 0, False: 67.3M]
  ------------------
 1688|   877k|			v = CAST(int64_t, v);
  ------------------
  |  |  444|   877k|#define CAST(T, b)	((T)(b))
  ------------------
 1689|   877k|			break;
 1690|  44.8M|		case FILE_STRING:
  ------------------
  |  |  245|  44.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (1690:3): [True: 44.8M, False: 22.5M]
  ------------------
 1691|  44.8M|		case FILE_PSTRING:
  ------------------
  |  |  253|  44.8M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1691:3): [True: 19.6k, False: 67.3M]
  ------------------
 1692|  44.8M|		case FILE_BESTRING16:
  ------------------
  |  |  258|  44.8M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1692:3): [True: 98, False: 67.3M]
  ------------------
 1693|  44.9M|		case FILE_LESTRING16:
  ------------------
  |  |  259|  44.9M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1693:3): [True: 54.7k, False: 67.2M]
  ------------------
 1694|  45.1M|		case FILE_REGEX:
  ------------------
  |  |  257|  45.1M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1694:3): [True: 214k, False: 67.1M]
  ------------------
 1695|  45.5M|		case FILE_SEARCH:
  ------------------
  |  |  260|  45.5M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1695:3): [True: 480k, False: 66.8M]
  ------------------
 1696|  45.6M|		case FILE_DEFAULT:
  ------------------
  |  |  243|  45.6M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1696:3): [True: 6.89k, False: 67.3M]
  ------------------
 1697|  45.6M|		case FILE_INDIRECT:
  ------------------
  |  |  281|  45.6M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1697:3): [True: 0, False: 67.3M]
  ------------------
 1698|  45.6M|		case FILE_NAME:
  ------------------
  |  |  285|  45.6M|#define				FILE_NAME		45
  ------------------
  |  Branch (1698:3): [True: 0, False: 67.3M]
  ------------------
 1699|  45.6M|		case FILE_USE:
  ------------------
  |  |  286|  45.6M|#define				FILE_USE		46
  ------------------
  |  Branch (1699:3): [True: 0, False: 67.3M]
  ------------------
 1700|  45.6M|		case FILE_CLEAR:
  ------------------
  |  |  287|  45.6M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1700:3): [True: 460, False: 67.3M]
  ------------------
 1701|  45.6M|		case FILE_DER:
  ------------------
  |  |  288|  45.6M|#define				FILE_DER		48
  ------------------
  |  Branch (1701:3): [True: 0, False: 67.3M]
  ------------------
 1702|  45.7M|		case FILE_GUID:
  ------------------
  |  |  289|  45.7M|#define				FILE_GUID		49
  ------------------
  |  Branch (1702:3): [True: 137k, False: 67.1M]
  ------------------
 1703|  45.7M|		case FILE_OCTAL:
  ------------------
  |  |  299|  45.7M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1703:3): [True: 0, False: 67.3M]
  ------------------
 1704|  45.7M|			break;
 1705|      0|		default:
  ------------------
  |  Branch (1705:3): [True: 0, False: 67.3M]
  ------------------
 1706|      0|			if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (1706:8): [True: 0, False: 0]
  ------------------
 1707|      0|			    file_magwarn(ms, "cannot happen: m->type=%d\n",
 1708|      0|				    m->type);
 1709|      0|			return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1710|  67.3M|		}
 1711|  67.3M|	}
 1712|  71.4M|	return v;
 1713|  71.4M|}
file_pstring_length_size:
 3635|  24.1k|{
 3636|  24.1k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  375|  24.1k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  404|  24.1k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|  24.1k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  24.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|  24.1k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  24.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|  24.1k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  24.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|  24.1k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  24.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|  24.1k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  24.1k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3637|  18.8k|	case PSTRING_1_LE:
  ------------------
  |  |  397|  18.8k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  388|  18.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3637:2): [True: 18.8k, False: 5.25k]
  ------------------
 3638|  18.8k|		return 1;
 3639|    354|	case PSTRING_2_LE:
  ------------------
  |  |  399|    354|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  388|    354|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3639:2): [True: 354, False: 23.7k]
  ------------------
 3640|  4.48k|	case PSTRING_2_BE:
  ------------------
  |  |  398|  4.48k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  388|  4.48k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3640:2): [True: 4.13k, False: 19.9k]
  ------------------
 3641|  4.48k|		return 2;
 3642|    492|	case PSTRING_4_LE:
  ------------------
  |  |  401|    492|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  388|    492|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3642:2): [True: 492, False: 23.6k]
  ------------------
 3643|    765|	case PSTRING_4_BE:
  ------------------
  |  |  400|    765|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  388|    765|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3643:2): [True: 273, False: 23.8k]
  ------------------
 3644|    765|		return 4;
 3645|      0|	default:
  ------------------
  |  Branch (3645:2): [True: 0, False: 24.1k]
  ------------------
 3646|      0|		file_error(ms, 0, "corrupt magic file "
 3647|      0|		    "(bad pascal string length %d)",
 3648|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  375|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  404|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3649|      0|		return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3650|  24.1k|	}
 3651|  24.1k|}
file_pstring_get_length:
 3655|  19.6k|{
 3656|  19.6k|	size_t len = 0;
 3657|  19.6k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  445|  19.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3658|  19.6k|	unsigned int s3, s2, s1, s0;
 3659|       |
 3660|  19.6k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  375|  19.6k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  404|  19.6k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|  19.6k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|  19.6k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|  19.6k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|  19.6k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|  19.6k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3661|  18.2k|	case PSTRING_1_LE:
  ------------------
  |  |  397|  18.2k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  388|  18.2k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3661:2): [True: 18.2k, False: 1.47k]
  ------------------
 3662|  18.2k|		len = *s;
 3663|  18.2k|		break;
 3664|    118|	case PSTRING_2_LE:
  ------------------
  |  |  399|    118|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  388|    118|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3664:2): [True: 118, False: 19.5k]
  ------------------
 3665|    118|		s0 = s[0];
 3666|    118|		s1 = s[1];
 3667|    118|		len = (s1 << 8) | s0;
 3668|    118|		break;
 3669|  1.10k|	case PSTRING_2_BE:
  ------------------
  |  |  398|  1.10k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  388|  1.10k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3669:2): [True: 1.10k, False: 18.5k]
  ------------------
 3670|  1.10k|		s0 = s[0];
 3671|  1.10k|		s1 = s[1];
 3672|  1.10k|		len = (s0 << 8) | s1;
 3673|  1.10k|		break;
 3674|    164|	case PSTRING_4_LE:
  ------------------
  |  |  401|    164|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  388|    164|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3674:2): [True: 164, False: 19.5k]
  ------------------
 3675|    164|		s0 = s[0];
 3676|    164|		s1 = s[1];
 3677|    164|		s2 = s[2];
 3678|    164|		s3 = s[3];
 3679|    164|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3680|    164|		break;
 3681|     91|	case PSTRING_4_BE:
  ------------------
  |  |  400|     91|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  388|     91|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3681:2): [True: 91, False: 19.5k]
  ------------------
 3682|     91|		s0 = s[0];
 3683|     91|		s1 = s[1];
 3684|     91|		s2 = s[2];
 3685|     91|		s3 = s[3];
 3686|     91|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3687|     91|		break;
 3688|      0|	default:
  ------------------
  |  Branch (3688:2): [True: 0, False: 19.6k]
  ------------------
 3689|      0|		file_error(ms, 0, "corrupt magic file "
 3690|      0|		    "(bad pascal string length %d)",
 3691|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  375|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  404|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3692|      0|		return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3693|  19.6k|	}
 3694|       |
 3695|  19.6k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  375|  19.6k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  405|  19.6k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  388|  19.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3695:6): [True: 970, False: 18.7k]
  ------------------
 3696|    970|		size_t l = file_pstring_length_size(ms, m);
 3697|    970|		if (l == FILE_BADSIZE)
  ------------------
  |  |  175|    970|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|    970|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3697:7): [True: 0, False: 970]
  ------------------
 3698|      0|			return l;
 3699|    970|		len -= l;
 3700|    970|	}
 3701|       |
 3702|  19.6k|	return len;
 3703|  19.6k|}
file_magicfind:
 3707|  59.2k|{
 3708|  59.2k|	uint32_t i, j;
 3709|  59.2k|	struct mlist *mlist, *ml;
 3710|       |
 3711|  59.2k|	mlist = ms->mlist[1];
 3712|       |
 3713|  59.2k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3713:25): [True: 59.2k, False: 0]
  ------------------
 3714|  59.2k|		struct magic *ma = ml->magic;
 3715|   221M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3715:15): [True: 221M, False: 0]
  ------------------
 3716|   221M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  285|   221M|#define				FILE_NAME		45
  ------------------
  |  Branch (3716:8): [True: 211M, False: 9.68M]
  ------------------
 3717|   211M|				continue;
 3718|  9.68M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3718:8): [True: 59.2k, False: 9.62M]
  ------------------
 3719|  59.2k|				v->magic = &ma[i];
 3720|  59.2k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3721|  2.85M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3721:21): [True: 2.85M, False: 68]
  ------------------
 3722|  2.85M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3722:13): [True: 59.2k, False: 2.79M]
  ------------------
 3723|  59.2k|					    break;
 3724|  59.2k|				v->nmagic = j - i;
 3725|  59.2k|				return 0;
 3726|  59.2k|			}
 3727|  9.68M|		}
 3728|  59.2k|	}
 3729|      0|	return -1;
 3730|  59.2k|}
apprentice.c:mlist_free:
  674|      4|{
  675|      4|	struct mlist *ml, *next;
  676|       |
  677|      4|	if (mlist == NULL)
  ------------------
  |  Branch (677:6): [True: 4, False: 0]
  ------------------
  678|      4|		return;
  679|       |
  680|      0|	for (ml = mlist->next; ml != mlist;) {
  ------------------
  |  Branch (680:25): [True: 0, False: 0]
  ------------------
  681|      0|		next = ml->next;
  682|      0|		mlist_free_one(ml);
  683|      0|		ml = next;
  684|      0|	}
  685|      0|	mlist_free_one(mlist);
  686|      0|}
apprentice.c:init_file_tables:
  426|      2|{
  427|      2|	static int done = 0;
  428|      2|	const struct type_tbl_s *p;
  429|       |
  430|      2|	if (done)
  ------------------
  |  Branch (430:6): [True: 0, False: 2]
  ------------------
  431|      0|		return;
  432|      2|	done++;
  433|       |
  434|    122|	for (p = type_tbl; p->len; p++) {
  ------------------
  |  Branch (434:21): [True: 120, False: 2]
  ------------------
  435|    120|		assert(p->type < FILE_NAMES_SIZE);
  436|    120|		file_names[p->type] = p->name;
  437|    120|		file_formats[p->type] = p->format;
  438|    120|	}
  439|      2|	assert(p - type_tbl == FILE_NAMES_SIZE);
  440|      2|}
apprentice.c:mlist_alloc:
  632|      4|{
  633|      4|	struct mlist *mlist;
  634|      4|	if ((mlist = CAST(struct mlist *, calloc(1, sizeof(*mlist)))) == NULL) {
  ------------------
  |  |  444|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (634:6): [True: 0, False: 4]
  ------------------
  635|      0|		return NULL;
  636|      0|	}
  637|      4|	mlist->next = mlist->prev = mlist;
  638|      4|	return mlist;
  639|      4|}
apprentice.c:add_mlist:
  444|      4|{
  445|      4|	struct mlist *ml;
  446|       |
  447|      4|	mlp->map = NULL;
  448|      4|	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
  ------------------
  |  |  444|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (448:6): [True: 0, False: 4]
  ------------------
  449|      0|		return -1;
  450|       |
  451|      4|	ml->map = idx == 0 ? map : NULL;
  ------------------
  |  Branch (451:12): [True: 2, False: 2]
  ------------------
  452|      4|	ml->magic = map->magic[idx];
  453|      4|	ml->nmagic = map->nmagic[idx];
  454|      4|	if (ml->nmagic) {
  ------------------
  |  Branch (454:6): [True: 4, False: 0]
  ------------------
  455|      4|		ml->magic_rxcomp = CAST(file_regex_t **,
  ------------------
  |  |  444|      4|#define CAST(T, b)	((T)(b))
  ------------------
  456|      4|		    calloc(ml->nmagic, sizeof(*ml->magic_rxcomp)));
  457|      4|		if (ml->magic_rxcomp == NULL) {
  ------------------
  |  Branch (457:7): [True: 0, False: 4]
  ------------------
  458|      0|			free(ml);
  459|      0|			return -1;
  460|      0|		}
  461|      4|	} else
  462|      0|		ml->magic_rxcomp = NULL;
  463|      4|	mlp->prev->next = ml;
  464|      4|	ml->prev = mlp->prev;
  465|      4|	ml->next = mlp;
  466|      4|	mlp->prev = ml;
  467|      4|	return 0;
  468|      4|}
apprentice.c:apprentice_1:
  475|      2|{
  476|      2|	struct magic_map *map;
  477|      2|#ifndef COMPILE_ONLY
  478|      2|	size_t i;
  479|      2|#endif
  480|       |
  481|      2|	if (magicsize != FILE_MAGICSIZE) {
  ------------------
  |  |  183|      2|#define FILE_MAGICSIZE	432
  ------------------
  |  Branch (481:6): [True: 0, False: 2]
  ------------------
  482|      0|		file_error(ms, 0, "magic element size %lu != %lu",
  483|      0|		    CAST(unsigned long, sizeof(*map->magic[0])),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  484|      0|		    CAST(unsigned long, FILE_MAGICSIZE));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  485|      0|		return -1;
  486|      0|	}
  487|       |
  488|      2|	if (action == FILE_COMPILE) {
  ------------------
  |  |  189|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (488:6): [True: 0, False: 2]
  ------------------
  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|		return apprentice_compile(ms, map, fn);
  493|      0|	}
  494|       |
  495|      2|#ifndef COMPILE_ONLY
  496|      2|	map = apprentice_map(ms, fn);
  497|      2|	if (map == NULL) {
  ------------------
  |  Branch (497:6): [True: 0, False: 2]
  ------------------
  498|      0|		if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (498:7): [True: 0, False: 0]
  ------------------
  499|      0|			file_magwarn(NULL, "using regular magic file `%s'", fn);
  500|      0|		map = apprentice_load(ms, fn, action);
  501|      0|		if (map == NULL)
  ------------------
  |  Branch (501:7): [True: 0, False: 0]
  ------------------
  502|      0|			return -1;
  503|      0|	}
  504|       |
  505|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (505:14): [True: 4, False: 2]
  ------------------
  506|      4|		if (add_mlist(ms->mlist[i], map, i) == -1) {
  ------------------
  |  Branch (506:7): [True: 0, False: 4]
  ------------------
  507|       |			/* failed to add to any list, free explicitly */
  508|      0|			if (i == 0)
  ------------------
  |  Branch (508:8): [True: 0, False: 0]
  ------------------
  509|      0|				apprentice_unmap(map);
  510|      0|			else
  511|      0|				mlist_free_all(ms);
  512|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  513|      0|			return -1;
  514|      0|		}
  515|      4|	}
  516|       |
  517|      2|	if (action == FILE_LIST) {
  ------------------
  |  |  190|      2|#define FILE_LIST	3
  ------------------
  |  Branch (517:6): [True: 0, False: 2]
  ------------------
  518|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (518:15): [True: 0, False: 0]
  ------------------
  519|      0|			printf("Set %" SIZE_T_FORMAT "u:\nBinary patterns:\n",
  520|      0|			    i);
  521|      0|			apprentice_list(ms->mlist[i], BINTEST);
  ------------------
  |  |  228|      0|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  522|      0|			printf("Text patterns:\n");
  523|      0|			apprentice_list(ms->mlist[i], TEXTTEST);
  ------------------
  |  |  230|      0|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  524|      0|		}
  525|      0|	}
  526|      2|	return 0;
  527|       |#else
  528|       |	return 0;
  529|       |#endif /* COMPILE_ONLY */
  530|      2|}
apprentice.c:mkdbname:
 3467|      2|{
 3468|      2|	const char *p, *q;
 3469|      2|	char *buf;
 3470|       |
 3471|      2|	if (strip) {
  ------------------
  |  Branch (3471:6): [True: 0, False: 2]
  ------------------
 3472|      0|		if ((p = strrchr(fn, '/')) != NULL)
  ------------------
  |  Branch (3472:7): [True: 0, False: 0]
  ------------------
 3473|      0|			fn = ++p;
 3474|      0|	}
 3475|       |
 3476|     94|	for (q = fn; *q; q++)
  ------------------
  |  Branch (3476:15): [True: 92, False: 2]
  ------------------
 3477|     92|		continue;
 3478|       |	/* Look for .mgc */
 3479|      6|	for (p = ext + sizeof(ext) - 1; p >= ext && q >= fn; p--, q--)
  ------------------
  |  Branch (3479:34): [True: 6, False: 0]
  |  Branch (3479:46): [True: 6, False: 0]
  ------------------
 3480|      6|		if (*p != *q)
  ------------------
  |  Branch (3480:7): [True: 2, False: 4]
  ------------------
 3481|      2|			break;
 3482|       |
 3483|       |	/* Did not find .mgc, restore q */
 3484|      2|	if (p >= ext)
  ------------------
  |  Branch (3484:6): [True: 2, False: 0]
  ------------------
 3485|      6|		while (*q)
  ------------------
  |  Branch (3485:10): [True: 4, False: 2]
  ------------------
 3486|      4|			q++;
 3487|       |
 3488|      2|	q++;
 3489|       |	/* Compatibility with old code that looked in .mime */
 3490|      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 (3490:6): [True: 0, False: 2]
  ------------------
 3491|      0|		if (asprintf(&buf, "%.*s.mime%s", CAST(int, q - fn), fn, ext)
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3491:7): [True: 0, False: 0]
  ------------------
 3492|      0|		    < 0)
 3493|      0|			return NULL;
 3494|      0|		if (access(buf, R_OK) != -1) {
  ------------------
  |  Branch (3494:7): [True: 0, False: 0]
  ------------------
 3495|      0|			ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3496|      0|			return buf;
 3497|      0|		}
 3498|      0|		free(buf);
 3499|      0|	}
 3500|      2|	if (asprintf(&buf, "%.*s%s", CAST(int, q - fn), fn, ext) < 0)
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3500:6): [True: 0, False: 2]
  ------------------
 3501|      0|		return NULL;
 3502|       |
 3503|       |	/* Compatibility with old code that looked in .mime */
 3504|      2|	if (strstr(fn, ".mime") != NULL)
  ------------------
  |  Branch (3504:6): [True: 0, False: 2]
  ------------------
 3505|      0|		ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3506|      2|	return buf;
 3507|      2|}
apprentice.c:apprentice_map:
 3275|      2|{
 3276|      2|	int fd;
 3277|      2|	struct stat st;
 3278|      2|	char *dbname = NULL;
 3279|      2|	struct magic_map *map;
 3280|      2|	struct magic_map *rv = NULL;
 3281|       |
 3282|      2|	fd = -1;
 3283|      2|	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3283:6): [True: 0, False: 2]
  ------------------
 3284|      0|		file_oomem(ms, sizeof(*map));
 3285|      0|		goto error;
 3286|      0|	}
 3287|      2|	map->type = MAP_TYPE_USER;	/* unspecified */
  ------------------
  |  |   86|      2|#define MAP_TYPE_USER	0
  ------------------
 3288|       |
 3289|      2|	dbname = mkdbname(ms, fn, 0);
 3290|      2|	if (dbname == NULL)
  ------------------
  |  Branch (3290:6): [True: 0, False: 2]
  ------------------
 3291|      0|		goto error;
 3292|       |
 3293|      2|	if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1)
  ------------------
  |  |  716|      2|#define O_BINARY	0
  ------------------
  |  Branch (3293:6): [True: 0, False: 2]
  ------------------
 3294|      0|		goto error;
 3295|       |
 3296|      2|	if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (3296:6): [True: 0, False: 2]
  ------------------
 3297|      0|		file_error(ms, errno, "cannot stat `%s'", dbname);
 3298|      0|		goto error;
 3299|      0|	}
 3300|      2|	if (st.st_size < 8 || st.st_size > maxoff_t()) {
  ------------------
  |  Branch (3300:6): [True: 0, False: 2]
  |  Branch (3300:24): [True: 0, False: 2]
  ------------------
 3301|      0|		file_error(ms, 0, "file `%s' is too %s", dbname,
 3302|      0|		    st.st_size < 8 ? "small" : "large");
  ------------------
  |  Branch (3302:7): [True: 0, False: 0]
  ------------------
 3303|      0|		goto error;
 3304|      0|	}
 3305|       |
 3306|      2|	map->len = CAST(size_t, st.st_size);
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3307|      2|#ifdef QUICK
 3308|      2|	map->type = MAP_TYPE_MMAP;
  ------------------
  |  |   88|      2|#define MAP_TYPE_MMAP	2
  ------------------
 3309|      2|	if ((map->p = mmap(0, CAST(size_t, st.st_size), PROT_READ|PROT_WRITE,
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3309:6): [True: 0, False: 2]
  ------------------
 3310|      2|	    MAP_PRIVATE|MAP_FILE, fd, CAST(off_t, 0))) == MAP_FAILED) {
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3311|      0|		file_error(ms, errno, "cannot map `%s'", dbname);
 3312|      0|		goto error;
 3313|      0|	}
 3314|       |#else
 3315|       |	map->type = MAP_TYPE_MALLOC;
 3316|       |	if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
 3317|       |		file_oomem(ms, map->len);
 3318|       |		goto error;
 3319|       |	}
 3320|       |	if (read(fd, map->p, map->len) != (ssize_t)map->len) {
 3321|       |		file_badread(ms);
 3322|       |		goto error;
 3323|       |	}
 3324|       |#endif
 3325|      2|	(void)close(fd);
 3326|      2|	fd = -1;
 3327|       |
 3328|      2|	if (check_buffer(ms, map, dbname) != 0) {
  ------------------
  |  Branch (3328:6): [True: 0, False: 2]
  ------------------
 3329|      0|		goto error;
 3330|      0|	}
 3331|      2|#ifdef QUICK
 3332|      2|	if (mprotect(map->p, CAST(size_t, st.st_size), PROT_READ) == -1) {
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3332:6): [True: 0, False: 2]
  ------------------
 3333|      0|		file_error(ms, errno, "cannot mprotect `%s'", dbname);
 3334|      0|		goto error;
 3335|      0|	}
 3336|      2|#endif
 3337|       |
 3338|      2|	free(dbname);
 3339|      2|	return map;
 3340|       |
 3341|      0|error:
 3342|      0|	if (fd != -1)
  ------------------
  |  Branch (3342:6): [True: 0, False: 0]
  ------------------
 3343|      0|		(void)close(fd);
 3344|      0|	apprentice_unmap(map);
 3345|      0|	free(dbname);
 3346|      0|	return rv;
 3347|      2|}
apprentice.c:maxoff_t:
  331|      2|maxoff_t(void) {
  332|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(int))
  ------------------
  |  Branch (332:19): [Folded - Ignored]
  ------------------
  333|      0|		return CAST(off_t, INT_MAX);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  334|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(long))
  ------------------
  |  Branch (334:19): [Folded - Ignored]
  ------------------
  335|      2|		return CAST(off_t, LONG_MAX);
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  336|      0|	return 0x7fffffff;
  337|      2|}
apprentice.c:check_buffer:
 3351|      2|{
 3352|      2|	uint32_t *ptr;
 3353|      2|	uint32_t entries, nentries;
 3354|      2|	uint32_t version;
 3355|      2|	int i, needsbyteswap;
 3356|       |
 3357|      2|	ptr = CAST(uint32_t *, map->p);
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3358|      2|	if (*ptr != MAGICNO) {
  ------------------
  |  |  181|      2|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3358:6): [True: 0, False: 2]
  ------------------
 3359|      0|		if (swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  136|      0|#define swap4(x)	bswap_32(x)
  ------------------
              		if (swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  181|      0|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3359:7): [True: 0, False: 0]
  ------------------
 3360|      0|			file_error(ms, 0, "bad magic in `%s'", dbname);
 3361|      0|			return -1;
 3362|      0|		}
 3363|      0|		needsbyteswap = 1;
 3364|      0|	} else
 3365|      2|		needsbyteswap = 0;
 3366|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3366:6): [True: 0, False: 2]
  ------------------
 3367|      0|		version = swap4(ptr[1]);
  ------------------
  |  |  136|      0|#define swap4(x)	bswap_32(x)
  ------------------
 3368|      2|	else
 3369|      2|		version = ptr[1];
 3370|      2|	if (version != VERSIONNO) {
  ------------------
  |  |  182|      2|#define VERSIONNO	19
  ------------------
  |  Branch (3370:6): [True: 0, False: 2]
  ------------------
 3371|      0|		file_error(ms, 0, "File %s supports only version %d magic "
 3372|      0|		    "files. `%s' is version %d", VERSION,
  ------------------
  |  |  356|      0|#define VERSION "5.45"
  ------------------
 3373|      0|		    VERSIONNO, dbname, version);
  ------------------
  |  |  182|      0|#define VERSIONNO	19
  ------------------
 3374|      0|		return -1;
 3375|      0|	}
 3376|      2|	entries = CAST(uint32_t, map->len / sizeof(struct magic));
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3377|      2|	if ((entries * sizeof(struct magic)) != map->len) {
  ------------------
  |  Branch (3377:6): [True: 0, False: 2]
  ------------------
 3378|      0|		file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not "
 3379|      0|		    "a multiple of %" SIZE_T_FORMAT "u",
 3380|      0|		    dbname, map->len, sizeof(struct magic));
 3381|      0|		return -1;
 3382|      0|	}
 3383|      2|	map->magic[0] = CAST(struct magic *, map->p) + 1;
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3384|      2|	nentries = 0;
 3385|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (3385:14): [True: 4, False: 2]
  ------------------
 3386|      4|		if (needsbyteswap)
  ------------------
  |  Branch (3386:7): [True: 0, False: 4]
  ------------------
 3387|      0|			map->nmagic[i] = swap4(ptr[i + 2]);
  ------------------
  |  |  136|      0|#define swap4(x)	bswap_32(x)
  ------------------
 3388|      4|		else
 3389|      4|			map->nmagic[i] = ptr[i + 2];
 3390|      4|		if (i != MAGIC_SETS - 1)
  ------------------
  |  |  463|      4|#define MAGIC_SETS	2
  ------------------
  |  Branch (3390:7): [True: 2, False: 2]
  ------------------
 3391|      2|			map->magic[i + 1] = map->magic[i] + map->nmagic[i];
 3392|      4|		nentries += map->nmagic[i];
 3393|      4|	}
 3394|      2|	if (entries != nentries + 1) {
  ------------------
  |  Branch (3394:6): [True: 0, False: 2]
  ------------------
 3395|      0|		file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
 3396|      0|		    dbname, entries, nentries + 1);
 3397|      0|		return -1;
 3398|      0|	}
 3399|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3399:6): [True: 0, False: 2]
  ------------------
 3400|      0|		for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  463|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (3400:15): [True: 0, False: 0]
  ------------------
 3401|      0|			byteswap(map->magic[i], map->nmagic[i]);
 3402|      2|	return 0;
 3403|      2|}

file_ascmagic:
   72|  10.2k|{
   73|  10.2k|	file_unichar_t *ubuf = NULL;
   74|  10.2k|	size_t ulen = 0;
   75|  10.2k|	int rv = 1;
   76|  10.2k|	struct buffer bb;
   77|       |
   78|  10.2k|	const char *code = NULL;
   79|  10.2k|	const char *code_mime = NULL;
   80|  10.2k|	const char *type = NULL;
   81|       |
   82|  10.2k|	bb = *b;
   83|  10.2k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  444|  10.2k|#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|  10.2k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 4.50k, False: 5.76k]
  |  Branch (88:23): [True: 952, False: 3.55k]
  ------------------
   89|    952|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  10.2k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 8.04k, False: 2.21k]
  ------------------
   93|  10.2k|	    &type) == 0)
   94|  8.04k|		rv = 0;
   95|  2.21k|        else
   96|  2.21k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  2.21k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  10.2k|	free(ubuf);
  100|       |
  101|  10.2k|	return rv;
  102|  10.2k|}
file_ascmagic_with_encoding:
  108|  2.21k|{
  109|  2.21k|	struct buffer bb;
  110|  2.21k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  2.21k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  2.21k|	size_t nbytes = b->flen;
  112|  2.21k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  2.21k|	size_t mlen, i, len;
  114|  2.21k|	int rv = -1;
  115|  2.21k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  2.21k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.21k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.21k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  2.21k|	int need_separator = 0;
  117|       |
  118|  2.21k|	const char *subtype = NULL;
  119|       |
  120|  2.21k|	int has_escapes = 0;
  121|  2.21k|	int has_backspace = 0;
  122|  2.21k|	int seen_cr = 0;
  123|       |
  124|  2.21k|	size_t n_crlf = 0;
  125|  2.21k|	size_t n_lf = 0;
  126|  2.21k|	size_t n_cr = 0;
  127|  2.21k|	size_t n_nel = 0;
  128|  2.21k|	int executable = 0;
  129|       |
  130|  2.21k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  444|  2.21k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  2.21k|	size_t has_long_lines = 0;
  132|       |
  133|  2.21k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  2.21k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 16, False: 2.20k]
  ------------------
  137|     16|		rv = 0;
  138|     16|		goto done;
  139|     16|	}
  140|       |
  141|  2.20k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  2.13k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 2.13k, False: 71]
  |  Branch (141:18): [True: 2.13k, 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.13k|		mlen = ulen * 6;
  146|  2.13k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  444|  2.13k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (146:7): [True: 0, False: 2.13k]
  ------------------
  147|      0|			file_oomem(ms, mlen);
  148|      0|			goto done;
  149|      0|		}
  150|  2.13k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (150:7): [True: 44, False: 2.08k]
  ------------------
  151|  2.13k|		    == NULL) {
  152|     44|			rv = 0;
  153|     44|			goto done;
  154|     44|		}
  155|  2.08k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  156|  2.08k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  444|  2.08k|#define CAST(T, b)	((T)(b))
  ------------------
  157|       |
  158|  2.08k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (158:7): [True: 1.98k, False: 100]
  ------------------
  159|  2.08k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  230|  2.08k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  160|  1.98k|			rv = -1;
  161|    100|		else
  162|    100|			need_separator = 1;
  163|  2.08k|		buffer_fini(&bb);
  164|  2.08k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.08k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.08k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (164:7): [True: 0, False: 2.08k]
  ------------------
  165|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (165:9): [True: 0, False: 0]
  ------------------
  166|      0|			goto done;
  167|      0|		}
  168|  2.08k|	}
  169|       |
  170|  2.15k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.15k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.15k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (170:6): [True: 0, False: 2.15k]
  ------------------
  171|      0|		rv = 0;
  172|      0|		goto done;
  173|      0|	}
  174|       |
  175|       |	/* Now try to discover other details about the file. */
  176|  12.2M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (176:14): [True: 12.2M, False: 2.15k]
  ------------------
  177|  12.2M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (177:7): [True: 2.01M, False: 10.2M]
  ------------------
  178|  2.01M|			if (seen_cr)
  ------------------
  |  Branch (178:8): [True: 181k, False: 1.83M]
  ------------------
  179|   181k|				n_crlf++;
  180|  1.83M|			else
  181|  1.83M|				n_lf++;
  182|  2.01M|			last_line_end = i;
  183|  10.2M|		} else if (seen_cr)
  ------------------
  |  Branch (183:14): [True: 871k, False: 9.34M]
  ------------------
  184|   871k|			n_cr++;
  185|       |
  186|  12.2M|		seen_cr = (ubuf[i] == '\r');
  187|  12.2M|		if (seen_cr)
  ------------------
  |  Branch (187:7): [True: 1.05M, False: 11.1M]
  ------------------
  188|  1.05M|			last_line_end = i;
  189|       |
  190|  12.2M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (190:7): [True: 994k, False: 11.2M]
  ------------------
  191|   994k|			n_nel++;
  192|   994k|			last_line_end = i;
  193|   994k|		}
  194|       |
  195|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  196|  12.2M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  12.2M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (196:7): [True: 7.94M, False: 4.28M]
  ------------------
  197|  7.94M|			size_t ll = i - last_line_end;
  198|  7.94M|			if (ll > has_long_lines)
  ------------------
  |  Branch (198:8): [True: 7.74M, False: 204k]
  ------------------
  199|  7.74M|				has_long_lines = ll;
  200|  7.94M|		}
  201|       |
  202|  12.2M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (202:7): [True: 50.3k, False: 12.1M]
  ------------------
  203|  50.3k|			has_escapes = 1;
  204|  12.2M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (204:7): [True: 96.7k, False: 12.1M]
  ------------------
  205|  96.7k|			has_backspace = 1;
  206|  12.2M|	}
  207|       |
  208|  2.15k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (208:6): [True: 0, False: 2.15k]
  ------------------
  209|      0|		rv = 0;
  210|      0|		goto done;
  211|      0|	}
  212|  2.15k|	len = file_printedlen(ms);
  213|  2.15k|	if (mime) {
  ------------------
  |  Branch (213:6): [True: 0, False: 2.15k]
  ------------------
  214|      0|		if ((mime & MAGIC_MIME_TYPE) != 0) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (214:7): [True: 0, False: 0]
  ------------------
  215|      0|			if (len) {
  ------------------
  |  Branch (215:8): [True: 0, False: 0]
  ------------------
  216|       |				/*
  217|       |				 * Softmagic printed something, we
  218|       |				 * are either done, or we need a separator
  219|       |				 */
  220|      0|				if ((ms->flags & MAGIC_CONTINUE) == 0) {
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (220:9): [True: 0, False: 0]
  ------------------
  221|      0|					rv = 1;
  222|      0|					goto done;
  223|      0|				}
  224|      0|				if (need_separator && file_separator(ms) == -1)
  ------------------
  |  Branch (224:9): [True: 0, False: 0]
  |  Branch (224:27): [True: 0, False: 0]
  ------------------
  225|      0|					goto done;
  226|      0|			}
  227|      0|			if (file_printf(ms, "text/plain") == -1)
  ------------------
  |  Branch (227:8): [True: 0, False: 0]
  ------------------
  228|      0|				goto done;
  229|      0|		}
  230|  2.15k|	} else {
  231|  2.15k|		if (len) {
  ------------------
  |  Branch (231:7): [True: 699, False: 1.46k]
  ------------------
  232|    699|			switch (file_replace(ms, " text$", ", ")) {
  233|    671|			case 0:
  ------------------
  |  Branch (233:4): [True: 671, False: 28]
  ------------------
  234|    671|				switch (file_replace(ms, " text executable$",
  235|    671|				    ", ")) {
  236|    611|				case 0:
  ------------------
  |  Branch (236:5): [True: 611, False: 60]
  ------------------
  237|    611|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (237:10): [True: 0, False: 611]
  ------------------
  238|      0|						goto done;
  239|    611|					break;
  240|    611|				case -1:
  ------------------
  |  Branch (240:5): [True: 0, False: 671]
  ------------------
  241|      0|					goto done;
  242|     60|				default:
  ------------------
  |  Branch (242:5): [True: 60, False: 611]
  ------------------
  243|     60|					executable = 1;
  244|     60|					break;
  245|    671|				}
  246|    671|				break;
  247|    671|			case -1:
  ------------------
  |  Branch (247:4): [True: 0, False: 699]
  ------------------
  248|      0|				goto done;
  249|     28|			default:
  ------------------
  |  Branch (249:4): [True: 28, False: 671]
  ------------------
  250|     28|				break;
  251|    699|			}
  252|    699|		}
  253|       |
  254|  2.15k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (254:7): [True: 0, False: 2.15k]
  ------------------
  255|      0|			goto done;
  256|       |
  257|  2.15k|		if (subtype) {
  ------------------
  |  Branch (257:7): [True: 0, False: 2.15k]
  ------------------
  258|      0|			if (file_printf(ms, " %s", subtype) == -1)
  ------------------
  |  Branch (258:8): [True: 0, False: 0]
  ------------------
  259|      0|				goto done;
  260|      0|		}
  261|       |
  262|  2.15k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (262:7): [True: 0, False: 2.15k]
  ------------------
  263|      0|			goto done;
  264|       |
  265|  2.15k|		if (executable)
  ------------------
  |  Branch (265:7): [True: 60, False: 2.09k]
  ------------------
  266|     60|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (266:8): [True: 0, False: 60]
  ------------------
  267|      0|				goto done;
  268|       |
  269|  2.15k|		if (has_long_lines)
  ------------------
  |  Branch (269:7): [True: 219, False: 1.94k]
  ------------------
  270|    219|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (270:8): [True: 0, False: 219]
  ------------------
  271|    219|			    SIZE_T_FORMAT "u)", has_long_lines) == -1)
  272|      0|				goto done;
  273|       |
  274|       |		/*
  275|       |		 * Only report line terminators if we find one other than LF,
  276|       |		 * or if we find none at all.
  277|       |		 */
  278|  2.15k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (278:8): [True: 2.11k, False: 46]
  |  Branch (278:23): [True: 2.02k, False: 86]
  |  Branch (278:36): [True: 1.96k, False: 58]
  |  Branch (278:50): [True: 1.81k, False: 151]
  ------------------
  279|  2.15k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (279:8): [True: 46, False: 295]
  |  Branch (279:23): [True: 86, False: 209]
  |  Branch (279:36): [True: 58, False: 151]
  ------------------
  280|  2.00k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (280:8): [True: 0, False: 2.00k]
  ------------------
  281|      0|				goto done;
  282|       |
  283|  2.00k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (283:8): [True: 1.96k, False: 46]
  |  Branch (283:23): [True: 1.87k, False: 86]
  ------------------
  284|  2.00k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (284:8): [True: 1.81k, False: 58]
  |  Branch (284:22): [True: 1.81k, False: 0]
  ------------------
  285|  1.81k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (285:9): [True: 0, False: 1.81k]
  ------------------
  286|      0|					goto done;
  287|  1.81k|			} else {
  288|    190|				if (n_crlf) {
  ------------------
  |  Branch (288:9): [True: 46, False: 144]
  ------------------
  289|     46|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (289:10): [True: 0, False: 46]
  ------------------
  290|      0|						goto done;
  291|     46|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (291:10): [True: 21, False: 25]
  |  Branch (291:18): [True: 13, False: 12]
  |  Branch (291:26): [True: 3, False: 9]
  ------------------
  292|     37|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (292:11): [True: 0, False: 37]
  ------------------
  293|      0|							goto done;
  294|     46|				}
  295|    190|				if (n_cr) {
  ------------------
  |  Branch (295:9): [True: 107, False: 83]
  ------------------
  296|    107|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (296:10): [True: 0, False: 107]
  ------------------
  297|      0|						goto done;
  298|    107|					if (n_lf || n_nel)
  ------------------
  |  Branch (298:10): [True: 34, False: 73]
  |  Branch (298:18): [True: 19, False: 54]
  ------------------
  299|     53|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (299:11): [True: 0, False: 53]
  ------------------
  300|      0|							goto done;
  301|    107|				}
  302|    190|				if (n_lf) {
  ------------------
  |  Branch (302:9): [True: 63, False: 127]
  ------------------
  303|     63|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (303:10): [True: 0, False: 63]
  ------------------
  304|      0|						goto done;
  305|     63|					if (n_nel)
  ------------------
  |  Branch (305:10): [True: 17, False: 46]
  ------------------
  306|     17|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (306:11): [True: 0, False: 17]
  ------------------
  307|      0|							goto done;
  308|     63|				}
  309|    190|				if (n_nel)
  ------------------
  |  Branch (309:9): [True: 81, False: 109]
  ------------------
  310|     81|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (310:10): [True: 0, False: 81]
  ------------------
  311|      0|						goto done;
  312|    190|			}
  313|       |
  314|  2.00k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (314:8): [True: 0, False: 2.00k]
  ------------------
  315|      0|				goto done;
  316|  2.00k|		}
  317|       |
  318|  2.15k|		if (has_escapes)
  ------------------
  |  Branch (318:7): [True: 32, False: 2.12k]
  ------------------
  319|     32|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (319:8): [True: 0, False: 32]
  ------------------
  320|      0|				goto done;
  321|  2.15k|		if (has_backspace)
  ------------------
  |  Branch (321:7): [True: 47, False: 2.11k]
  ------------------
  322|     47|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (322:8): [True: 0, False: 47]
  ------------------
  323|      0|				goto done;
  324|  2.15k|	}
  325|  2.15k|	rv = 1;
  326|  2.21k|done:
  327|  2.21k|	free(utf8_buf);
  328|       |
  329|  2.21k|	return rv;
  330|  2.15k|}
ascmagic.c:trim_nuls:
   63|  12.4k|{
   64|   158M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 158M, False: 196]
  |  Branch (64:23): [True: 158M, False: 12.2k]
  ------------------
   65|   158M|		nbytes--;
   66|       |
   67|  12.4k|	return nbytes;
   68|  12.4k|}
ascmagic.c:encode_utf8:
  338|  2.13k|{
  339|  2.13k|	size_t i;
  340|  2.13k|	unsigned char *end = buf + len;
  341|       |
  342|  12.2M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (342:14): [True: 12.2M, False: 2.08k]
  ------------------
  343|  12.2M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (343:7): [True: 9.15M, False: 3.07M]
  ------------------
  344|  9.15M|			if (end - buf < 1)
  ------------------
  |  Branch (344:8): [True: 0, False: 9.15M]
  ------------------
  345|      0|				return NULL;
  346|  9.15M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  444|  9.15M|#define CAST(T, b)	((T)(b))
  ------------------
  347|  9.15M|			continue;
  348|  9.15M|		} 
  349|  3.07M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (349:7): [True: 2.77M, False: 307k]
  ------------------
  350|  2.77M|			if (end - buf < 2)
  ------------------
  |  Branch (350:8): [True: 0, False: 2.77M]
  ------------------
  351|      0|				return NULL;
  352|  2.77M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  444|  2.77M|#define CAST(T, b)	((T)(b))
  ------------------
  353|  2.77M|			goto out1;
  354|  2.77M|		}
  355|   307k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (355:7): [True: 188k, False: 118k]
  ------------------
  356|   188k|			if (end - buf < 3)
  ------------------
  |  Branch (356:8): [True: 0, False: 188k]
  ------------------
  357|      0|				return NULL;
  358|   188k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  444|   188k|#define CAST(T, b)	((T)(b))
  ------------------
  359|   188k|			goto out2;
  360|   188k|		}
  361|   118k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (361:7): [True: 4.18k, False: 114k]
  ------------------
  362|  4.18k|			if (end - buf < 4)
  ------------------
  |  Branch (362:8): [True: 0, False: 4.18k]
  ------------------
  363|      0|				return NULL;
  364|  4.18k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  444|  4.18k|#define CAST(T, b)	((T)(b))
  ------------------
  365|  4.18k|			goto out3;
  366|  4.18k|		}
  367|   114k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (367:7): [True: 25.7k, False: 89.0k]
  ------------------
  368|  25.7k|			if (end - buf < 5)
  ------------------
  |  Branch (368:8): [True: 0, False: 25.7k]
  ------------------
  369|      0|				return NULL;
  370|  25.7k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  444|  25.7k|#define CAST(T, b)	((T)(b))
  ------------------
  371|  25.7k|			goto out4;
  372|  25.7k|		} 
  373|  89.0k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (373:7): [True: 88.9k, False: 44]
  ------------------
  374|  88.9k|			if (end - buf < 6)
  ------------------
  |  Branch (374:8): [True: 0, False: 88.9k]
  ------------------
  375|      0|				return NULL;
  376|  88.9k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  444|  88.9k|#define CAST(T, b)	((T)(b))
  ------------------
  377|  88.9k|			goto out5;
  378|  88.9k|		} 
  379|       |		/* Invalid character */
  380|     44|		return NULL;
  381|  88.9k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  444|  88.9k|#define CAST(T, b)	((T)(b))
  ------------------
  382|   114k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  444|   114k|#define CAST(T, b)	((T)(b))
  ------------------
  383|   118k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  444|   118k|#define CAST(T, b)	((T)(b))
  ------------------
  384|   307k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  444|   307k|#define CAST(T, b)	((T)(b))
  ------------------
  385|  3.07M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  444|  3.07M|#define CAST(T, b)	((T)(b))
  ------------------
  386|  3.07M|	}
  387|       |
  388|  2.08k|	return buf;
  389|  2.13k|}

buffer_init:
   42|  87.2M|{
   43|  87.2M|	b->fd = fd;
   44|  87.2M|	if (st)
  ------------------
  |  Branch (44:6): [True: 2.08k, False: 87.2M]
  ------------------
   45|  2.08k|		memcpy(&b->st, st, sizeof(b->st));
   46|  87.2M|	else if (b->fd == -1 || fstat(b->fd, &b->st) == -1)
  ------------------
  |  Branch (46:11): [True: 87.2M, False: 0]
  |  Branch (46:26): [True: 0, False: 0]
  ------------------
   47|  87.2M|		memset(&b->st, 0, sizeof(b->st));
   48|  87.2M|	b->fbuf = data;
   49|  87.2M|	b->flen = len;
   50|  87.2M|	b->eoff = 0;
   51|  87.2M|	b->ebuf = NULL;
   52|  87.2M|	b->elen = 0;
   53|  87.2M|}
buffer_fini:
   57|  32.1k|{
   58|  32.1k|	free(b->ebuf);
   59|  32.1k|	b->ebuf = NULL;
   60|  32.1k|	b->elen = 0;
   61|  32.1k|}
buffer_fill:
   65|   217k|{
   66|   217k|	struct buffer *b = CCAST(struct buffer *, bb);
  ------------------
  |  |  446|   217k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
   67|       |
   68|   217k|	if (b->elen != 0)
  ------------------
  |  Branch (68:6): [True: 190k, False: 27.2k]
  ------------------
   69|   190k|		return b->elen == FILE_BADSIZE ? -1 : 0;
  ------------------
  |  |  175|   190k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|   190k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (69:10): [True: 190k, False: 0]
  ------------------
   70|       |
   71|  27.2k|	if (!S_ISREG(b->st.st_mode))
  ------------------
  |  Branch (71:6): [True: 27.2k, False: 0]
  ------------------
   72|  27.2k|		goto out;
   73|       |
   74|      0|	b->elen = CAST(size_t, b->st.st_size) < b->flen ?
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (74:12): [True: 0, False: 0]
  ------------------
   75|      0|	    CAST(size_t, b->st.st_size) : b->flen;
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
   76|      0|	if (b->elen == 0) {
  ------------------
  |  Branch (76:6): [True: 0, False: 0]
  ------------------
   77|      0|		free(b->ebuf);
   78|      0|		b->ebuf = NULL;
   79|      0|		return 0;
   80|      0|	}
   81|      0|	if ((b->ebuf = malloc(b->elen)) == NULL)
  ------------------
  |  Branch (81:6): [True: 0, False: 0]
  ------------------
   82|      0|		goto out;
   83|       |
   84|      0|	b->eoff = b->st.st_size - b->elen;
   85|      0|	if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
  ------------------
  |  Branch (85:6): [True: 0, False: 0]
  ------------------
   86|      0|		free(b->ebuf);
   87|      0|		b->ebuf = NULL;
   88|      0|		goto out;
   89|      0|	}
   90|       |
   91|      0|	return 0;
   92|  27.2k|out:
   93|  27.2k|	b->elen = FILE_BADSIZE;
  ------------------
  |  |  175|  27.2k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  27.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
   94|  27.2k|	return -1;
   95|      0|}

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

cdf_timestamp_to_timespec:
  100|  1.06k|{
  101|  1.06k|	struct tm tm;
  102|  1.06k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  103|  1.06k|	static char UTC[] = "UTC";
  104|  1.06k|#endif
  105|  1.06k|	int rdays;
  106|       |
  107|       |	/* Unit is 100's of nanoseconds */
  108|  1.06k|	ts->tv_nsec = (t % CDF_TIME_PREC) * 100;
  ------------------
  |  |   90|  1.06k|#define CDF_TIME_PREC	10000000
  ------------------
  109|       |
  110|  1.06k|	t /= CDF_TIME_PREC;
  ------------------
  |  |   90|  1.06k|#define CDF_TIME_PREC	10000000
  ------------------
  111|  1.06k|	tm.tm_sec = CAST(int, t % 60);
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  112|  1.06k|	t /= 60;
  113|       |
  114|  1.06k|	tm.tm_min = CAST(int, t % 60);
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  115|  1.06k|	t /= 60;
  116|       |
  117|  1.06k|	tm.tm_hour = CAST(int, t % 24);
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  118|  1.06k|	t /= 24;
  119|       |
  120|       |	/* XXX: Approx */
  121|  1.06k|	tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  1.06k|	rdays = cdf_getdays(tm.tm_year);
  124|  1.06k|	t -= rdays - 1;
  125|  1.06k|	tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  126|  1.06k|	tm.tm_mon = cdf_getmonth(tm.tm_year, CAST(int, t));
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
  127|  1.06k|	tm.tm_wday = 0;
  128|  1.06k|	tm.tm_yday = 0;
  129|  1.06k|	tm.tm_isdst = 0;
  130|  1.06k|#ifdef HAVE_STRUCT_TM_TM_GMTOFF
  131|  1.06k|	tm.tm_gmtoff = 0;
  132|  1.06k|#endif
  133|  1.06k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  134|  1.06k|	tm.tm_zone = UTC;
  135|  1.06k|#endif
  136|  1.06k|	tm.tm_year -= 1900;
  137|  1.06k|	ts->tv_sec = mktime(&tm);
  138|  1.06k|	if (ts->tv_sec == -1) {
  ------------------
  |  Branch (138:6): [True: 19, False: 1.05k]
  ------------------
  139|     19|		errno = EINVAL;
  140|     19|		return -1;
  141|     19|	}
  142|  1.05k|	return 0;
  143|  1.06k|}
cdf_ctime:
  170|    157|{
  171|    157|	char *ptr = *sec > MAX_CTIME ? NULL : ctime_r(sec, buf);
  ------------------
  |  |  173|    157|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  444|    314|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (171:14): [True: 57, False: 100]
  ------------------
  172|    157|	if (ptr != NULL)
  ------------------
  |  Branch (172:6): [True: 100, False: 57]
  ------------------
  173|    100|		return buf;
  174|       |#ifdef WIN32
  175|       |	(void)snprintf(buf, 26, "*Bad* 0x%16.16I64x\n",
  176|       |	    CAST(long long, *sec));
  177|       |#else
  178|     57|	(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
  179|     57|	    CAST(long long, *sec));
  ------------------
  |  |  444|     57|#define CAST(T, b)	((T)(b))
  ------------------
  180|     57|#endif
  181|     57|	return buf;
  182|    157|}
cdf_time.c:cdf_getdays:
   53|  1.06k|{
   54|  1.06k|	int days = 0;
   55|  1.06k|	int y;
   56|       |
   57|  3.98M|	for (y = CDF_BASE_YEAR; y < year; y++)
  ------------------
  |  |   89|  1.06k|#define CDF_BASE_YEAR	1601
  ------------------
  |  Branch (57:26): [True: 3.98M, False: 1.06k]
  ------------------
   58|  3.98M|		days += isleap(y) + 365;
  ------------------
  |  |   41|  3.98M|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 995k, False: 2.98M]
  |  |  ------------------
  |  |   42|  3.98M|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 956k, False: 39.4k]
  |  |  |  Branch (42:28): [True: 9.61k, False: 29.8k]
  |  |  ------------------
  ------------------
   59|       |
   60|  1.06k|	return days;
   61|  1.06k|}
cdf_time.c:cdf_getday:
   68|  1.06k|{
   69|  1.06k|	size_t m;
   70|       |
   71|  3.96k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  130|  3.96k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (71:14): [True: 3.93k, False: 34]
  ------------------
   72|  3.93k|		int sub = mdays[m] + (m == 1 && isleap(year));
  ------------------
  |  |   41|    485|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 227, False: 258]
  |  |  ------------------
  |  |   42|    485|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 157, False: 70]
  |  |  |  Branch (42:28): [True: 34, False: 36]
  |  |  ------------------
  ------------------
  |  Branch (72:25): [True: 485, False: 3.44k]
  ------------------
   73|  3.93k|		if (days < sub)
  ------------------
  |  Branch (73:7): [True: 1.03k, False: 2.89k]
  ------------------
   74|  1.03k|			return days;
   75|  2.89k|		days -= sub;
   76|  2.89k|	}
   77|     34|	return days;
   78|  1.06k|}
cdf_time.c:cdf_getmonth:
   85|  1.06k|{
   86|  1.06k|	size_t m;
   87|       |
   88|  3.89k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  130|  3.89k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (88:14): [True: 3.89k, False: 0]
  ------------------
   89|  3.89k|		days -= mdays[m];
   90|  3.89k|		if (m == 1 && isleap(year))
  ------------------
  |  |   41|    450|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 227, False: 223]
  |  |  ------------------
  |  |   42|    450|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 157, False: 70]
  |  |  |  Branch (42:28): [True: 34, False: 36]
  |  |  ------------------
  ------------------
  |  Branch (90:7): [True: 450, False: 3.44k]
  ------------------
   91|    191|			days--;
   92|  3.89k|		if (days <= 0)
  ------------------
  |  Branch (92:7): [True: 1.06k, False: 2.82k]
  ------------------
   93|  1.06k|			return CAST(int, m);
  ------------------
  |  |  444|  1.06k|#define CAST(T, b)	((T)(b))
  ------------------
   94|  3.89k|	}
   95|      0|	return CAST(int, m);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
   96|  1.06k|}

file_zmagic:
  270|  12.7k|{
  271|  12.7k|	unsigned char *newbuf = NULL;
  272|  12.7k|	size_t i, nsz;
  273|  12.7k|	char *rbuf;
  274|  12.7k|	file_pushbuf_t *pb;
  275|  12.7k|	int urv, prv, rv = 0;
  276|  12.7k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  12.7k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  12.7k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  12.7k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  277|  12.7k|	int fd = b->fd;
  278|  12.7k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  12.7k|#define CAST(T, b)	((T)(b))
  ------------------
  279|  12.7k|	size_t nbytes = b->flen;
  280|  12.7k|	int sa_saved = 0;
  281|  12.7k|	struct sigaction sig_act;
  282|       |
  283|  12.7k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  12.7k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (283:6): [True: 5.25k, False: 7.48k]
  ------------------
  284|  5.25k|		return 0;
  285|       |
  286|   119k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (286:14): [True: 112k, False: 7.48k]
  ------------------
  287|   112k|		int zm;
  288|   112k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  444|   112k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (288:7): [True: 6.91k, False: 105k]
  ------------------
  289|  6.91k|			continue;
  290|   105k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (290:7): [True: 12.0k, False: 93.2k]
  ------------------
  291|  12.0k|			zm = (*compr[i].u.func)(buf);
  292|  93.2k|		} else {
  293|  93.2k|			zm = memcmp(buf, compr[i].u.magic,
  294|  93.2k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  444|  93.2k|#define CAST(T, b)	((T)(b))
  ------------------
  295|  93.2k|		}
  296|       |
  297|   105k|		if (!zm)
  ------------------
  |  Branch (297:7): [True: 102k, False: 2.76k]
  ------------------
  298|   102k|			continue;
  299|       |
  300|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  301|  2.76k|		if (!sa_saved) {
  ------------------
  |  Branch (301:7): [True: 2.47k, False: 291]
  ------------------
  302|       |			//We can use sig_act for both new and old, but
  303|  2.47k|			struct sigaction new_act;
  304|  2.47k|			memset(&new_act, 0, sizeof(new_act));
  305|  2.47k|			new_act.sa_handler = SIG_IGN;
  306|  2.47k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  307|  2.47k|		}
  308|       |
  309|  2.76k|		nsz = nbytes;
  310|  2.76k|		free(newbuf);
  311|  2.76k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  312|  2.76k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  2.76k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  313|  2.76k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  314|  2.76k|		    (char *)newbuf, nsz);
  315|  2.76k|		switch (urv) {
  316|  2.52k|		case OKDATA:
  ------------------
  |  |  215|  2.52k|#define OKDATA 	0
  ------------------
  |  Branch (316:3): [True: 2.52k, False: 242]
  ------------------
  317|  2.76k|		case ERRDATA:
  ------------------
  |  |  217|  2.76k|#define ERRDATA	2
  ------------------
  |  Branch (317:3): [True: 242, False: 2.52k]
  ------------------
  318|  2.76k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  2.76k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  319|  2.76k|			if (urv == ERRDATA)
  ------------------
  |  |  217|  2.76k|#define ERRDATA	2
  ------------------
  |  Branch (319:8): [True: 242, False: 2.52k]
  ------------------
  320|    242|				prv = format_decompression_error(ms, i, newbuf);
  321|  2.52k|			else
  322|  2.52k|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  323|  2.52k|				    nsz);
  324|  2.76k|			if (prv == -1)
  ------------------
  |  Branch (324:8): [True: 0, False: 2.76k]
  ------------------
  325|      0|				goto error;
  326|  2.76k|			rv = 1;
  327|  2.76k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  2.76k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (327:8): [True: 0, False: 2.76k]
  ------------------
  328|      0|				goto out;
  329|  2.76k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  5.53k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.76k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.76k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (329:8): [True: 2.76k, False: 0]
  |  Branch (329:30): [True: 0, False: 2.76k]
  ------------------
  330|      0|				goto out;
  331|  2.76k|			if ((file_printf(ms,
  ------------------
  |  Branch (331:8): [True: 0, False: 2.76k]
  ------------------
  332|  2.76k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (332:8): [True: 0, False: 2.76k]
  ------------------
  333|      0|				goto error;
  334|  2.76k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (334:8): [True: 16, False: 2.74k]
  ------------------
  335|     16|				goto error;
  336|       |			/*
  337|       |			 * XXX: If file_buffer fails here, we overwrite
  338|       |			 * the compressed text. FIXME.
  339|       |			 */
  340|  2.74k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (340:8): [True: 0, False: 2.74k]
  ------------------
  341|      0|			{
  342|      0|				if (file_pop_buffer(ms, pb) != NULL)
  ------------------
  |  Branch (342:9): [True: 0, False: 0]
  ------------------
  343|      0|					abort();
  344|      0|				goto error;
  345|      0|			}
  346|  2.74k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (346:8): [True: 2.74k, False: 0]
  ------------------
  347|  2.74k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (347:9): [True: 1, False: 2.74k]
  ------------------
  348|      1|					free(rbuf);
  349|      1|					goto error;
  350|      1|				}
  351|  2.74k|				free(rbuf);
  352|  2.74k|			}
  353|  2.74k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (353:8): [True: 2.74k, False: 0]
  |  Branch (353:17): [True: 0, False: 2.74k]
  ------------------
  354|      0|				goto error;
  355|       |			/*FALLTHROUGH*/
  356|  2.74k|		case NODATA:
  ------------------
  |  |  216|  2.74k|#define NODATA	1
  ------------------
  |  Branch (356:3): [True: 0, False: 2.76k]
  ------------------
  357|  2.74k|			break;
  358|      0|		default:
  ------------------
  |  Branch (358:3): [True: 0, False: 2.76k]
  ------------------
  359|      0|			abort();
  360|       |			/*NOTREACHED*/
  361|     17|		error:
  362|     17|			rv = -1;
  363|     17|			break;
  364|  2.76k|		}
  365|  2.76k|	}
  366|  7.48k|out:
  367|  7.48k|	DPRINTF("rv = %d\n", rv);
  368|       |
  369|  7.48k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (369:6): [True: 2.47k, False: 5.01k]
  |  Branch (369:18): [True: 2.47k, False: 0]
  ------------------
  370|  2.47k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  371|       |
  372|  7.48k|	free(newbuf);
  373|  7.48k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  7.48k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  374|  7.48k|	DPRINTF("Zmagic returns %d\n", rv);
  375|  7.48k|	return rv;
  376|  7.48k|}
sread:
  408|  5.36k|{
  409|  5.36k|	ssize_t rv;
  410|  5.36k|#if defined(FIONREAD) && !defined(__MINGW32__)
  411|  5.36k|	int t = 0;
  412|  5.36k|#endif
  413|  5.36k|	size_t rn = n;
  414|       |
  415|  5.36k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (415:6): [True: 0, False: 5.36k]
  ------------------
  416|      0|		goto nocheck;
  417|       |
  418|  5.36k|#if defined(FIONREAD) && !defined(__MINGW32__)
  419|  5.36k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (419:6): [True: 0, False: 5.36k]
  |  Branch (419:20): [True: 0, False: 0]
  |  Branch (419:53): [True: 0, False: 0]
  ------------------
  420|      0|#ifdef FD_ZERO
  421|      0|		ssize_t cnt;
  422|      0|		for (cnt = 0;; cnt++) {
  423|      0|			fd_set check;
  424|      0|			struct timeval tout = {0, 100 * 1000};
  425|      0|			int selrv;
  426|       |
  427|      0|			FD_ZERO(&check);
  428|      0|			FD_SET(fd, &check);
  429|       |
  430|       |			/*
  431|       |			 * Avoid soft deadlock: do not read if there
  432|       |			 * is nothing to read from sockets and pipes.
  433|       |			 */
  434|      0|			selrv = select(fd + 1, &check, NULL, NULL, &tout);
  435|      0|			if (selrv == -1) {
  ------------------
  |  Branch (435:8): [True: 0, False: 0]
  ------------------
  436|      0|				if (errno == EINTR || errno == EAGAIN)
  ------------------
  |  Branch (436:9): [True: 0, False: 0]
  |  Branch (436:27): [True: 0, False: 0]
  ------------------
  437|      0|					continue;
  438|      0|			} else if (selrv == 0 && cnt >= 5) {
  ------------------
  |  Branch (438:15): [True: 0, False: 0]
  |  Branch (438:29): [True: 0, False: 0]
  ------------------
  439|      0|				return 0;
  440|      0|			} else
  441|      0|				break;
  442|      0|		}
  443|      0|#endif
  444|      0|		(void)ioctl(fd, FIONREAD, &t);
  445|      0|	}
  446|       |
  447|  5.36k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (447:6): [True: 0, False: 5.36k]
  |  Branch (447:15): [True: 0, False: 0]
  ------------------
  448|      0|		n = t;
  449|      0|		rn = n;
  450|      0|	}
  451|  5.36k|#endif
  452|       |
  453|  5.36k|nocheck:
  454|  5.36k|	do
  455|   106k|		switch ((rv = read(fd, buf, n))) {
  456|     43|		case -1:
  ------------------
  |  Branch (456:3): [True: 43, False: 106k]
  ------------------
  457|     43|			if (errno == EINTR)
  ------------------
  |  Branch (457:8): [True: 43, False: 0]
  ------------------
  458|     43|				continue;
  459|      0|			return -1;
  460|  5.30k|		case 0:
  ------------------
  |  Branch (460:3): [True: 5.30k, False: 100k]
  ------------------
  461|  5.30k|			return rn - n;
  462|   100k|		default:
  ------------------
  |  Branch (462:3): [True: 100k, False: 5.34k]
  ------------------
  463|   100k|			n -= rv;
  464|   100k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  444|   100k|#define CAST(T, b)	((T)(b))
  ------------------
  465|   100k|			break;
  466|   106k|		}
  467|   100k|	while (n > 0);
  ------------------
  |  Branch (467:9): [True: 100k, False: 60]
  ------------------
  468|     60|	return rn;
  469|  5.36k|}
compress.c:lzmacmp:
  137|  4.60k|{
  138|  4.60k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (138:6): [True: 4.57k, False: 26]
  |  Branch (138:24): [True: 4, False: 22]
  |  Branch (138:34): [True: 9, False: 13]
  ------------------
  139|  4.59k|		return 0;
  140|     13|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (140:6): [True: 11, False: 2]
  |  Branch (140:17): [True: 10, False: 1]
  ------------------
  141|     10|		return 0;
  142|      3|	return 1;
  143|     13|}
compress.c:zlibcmp:
  119|  7.48k|{
  120|  7.48k|	unsigned short x = 1;
  121|  7.48k|	unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
  ------------------
  |  |  444|  7.48k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  7.48k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (123:6): [True: 7.40k, False: 84]
  |  Branch (123:29): [True: 30, False: 54]
  ------------------
  124|  7.43k|		return 0;
  125|     54|	if (s[0] != 1)	/* endianness test */
  ------------------
  |  Branch (125:6): [True: 0, False: 54]
  ------------------
  126|      0|		x = buf[0] | (buf[1] << 8);
  127|     54|	else
  128|     54|		x = buf[1] | (buf[0] << 8);
  129|     54|	if (x % 31)
  ------------------
  |  Branch (129:6): [True: 26, False: 28]
  ------------------
  130|     26|		return 0;
  131|     28|	return 1;
  132|     54|}
compress.c:format_decompression_error:
  253|    242|{
  254|    242|	unsigned char *p;
  255|    242|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    242|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    242|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    242|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  256|       |
  257|    242|	if (!mime)
  ------------------
  |  Branch (257:6): [True: 242, False: 0]
  ------------------
  258|    242|		return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
  259|       |
  260|      0|	for (p = buf; *p; p++)
  ------------------
  |  Branch (260:16): [True: 0, False: 0]
  ------------------
  261|      0|		if (!isalnum(*p))
  ------------------
  |  Branch (261:7): [True: 0, False: 0]
  ------------------
  262|      0|			*p = '-';
  263|       |
  264|      0|	return file_printf(ms, "application/x-decompression-error-%s-%s",
  265|      0|	    methodname(i), buf);
  266|    242|}
compress.c:methodname:
  986|    242|{
  987|    242|	switch (method) {
  988|      0|#ifdef BUILTIN_DECOMPRESS
  989|     11|	case METH_FROZEN:
  ------------------
  |  |  185|     11|#define METH_FROZEN	2
  ------------------
  |  Branch (989:2): [True: 11, False: 231]
  ------------------
  990|     39|	case METH_ZLIB:
  ------------------
  |  |  191|     39|#define METH_ZLIB	14
  ------------------
  |  Branch (990:2): [True: 28, False: 214]
  ------------------
  991|     39|		return "zlib";
  992|      0|#endif
  993|      0|#ifdef BUILTIN_BZLIB
  994|      7|	case METH_BZIP:
  ------------------
  |  |  186|      7|#define METH_BZIP	7
  ------------------
  |  Branch (994:2): [True: 7, False: 235]
  ------------------
  995|      7|		return "bzlib";
  996|      0|#endif
  997|      0|#ifdef BUILTIN_XZLIB
  998|      2|	case METH_XZ:
  ------------------
  |  |  187|      2|#define METH_XZ		9
  ------------------
  |  Branch (998:2): [True: 2, False: 240]
  ------------------
  999|      5|	case METH_LZMA:
  ------------------
  |  |  190|      5|#define METH_LZMA	13
  ------------------
  |  Branch (999:2): [True: 3, False: 239]
  ------------------
 1000|      5|		return "xzlib";
 1001|      0|#endif
 1002|      0|#ifdef BUILTIN_ZSTDLIB
 1003|      3|	case METH_ZSTD:
  ------------------
  |  |  189|      3|#define METH_ZSTD	12
  ------------------
  |  Branch (1003:2): [True: 3, False: 239]
  ------------------
 1004|      3|		return "zstd";
 1005|      0|#endif
 1006|       |#ifdef BUILTIN_LZLIB
 1007|       |	case METH_LZIP:
 1008|       |		return "lzlib";
 1009|       |#endif
 1010|    188|	default:
  ------------------
  |  Branch (1010:2): [True: 188, False: 54]
  ------------------
 1011|    188|		return compr[method].argv[0];
 1012|    242|	}
 1013|    242|}
compress.c:uncompressbuf:
 1051|  2.76k|{
 1052|  2.76k|	int fdp[3][2];
 1053|  2.76k|	int status, rv, w;
 1054|  2.76k|	pid_t pid;
 1055|  2.76k|	pid_t writepid = -1;
 1056|  2.76k|	size_t i;
 1057|  2.76k|	ssize_t r, re;
 1058|  2.76k|	char *const *args;
 1059|  2.76k|#ifdef HAVE_POSIX_SPAWNP
 1060|  2.76k|	posix_spawn_file_actions_t fa;
 1061|  2.76k|#endif
 1062|  2.76k|	int (*decompress)(const unsigned char *, unsigned char **,
 1063|  2.76k|	    size_t, size_t *, int) = getdecompressor(method);
 1064|       |
 1065|  2.76k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  444|  2.76k|#define CAST(T, b)	((T)(b))
  ------------------
 1066|  2.76k|	if (*newch == NULL)
  ------------------
  |  Branch (1066:6): [True: 0, False: 2.76k]
  ------------------
 1067|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1068|       |
 1069|  2.76k|	if (decompress) {
  ------------------
  |  Branch (1069:6): [True: 54, False: 2.71k]
  ------------------
 1070|     54|		if (nofork) {
  ------------------
  |  Branch (1070:7): [True: 54, False: 0]
  ------------------
 1071|     54|			return makeerror(newch, n,
 1072|     54|			    "Fork is required to uncompress, but disabled");
 1073|     54|		}
 1074|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1075|     54|	}
 1076|       |
 1077|  2.71k|	(void)fflush(stdout);
 1078|  2.71k|	(void)fflush(stderr);
 1079|       |
 1080|  10.8k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  10.8k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1080:14): [True: 8.13k, False: 2.71k]
  ------------------
 1081|  8.13k|		fdp[i][0] = fdp[i][1] = -1;
 1082|       |
 1083|       |	/*
 1084|       |	 * There are multithreaded users who run magic_file()
 1085|       |	 * from dozens of threads. If two parallel magic_file() calls
 1086|       |	 * analyze two large compressed files, both will spawn
 1087|       |	 * an uncompressing child here, which writes out uncompressed data.
 1088|       |	 * We read some portion, then close the pipe, then waitpid() the child.
 1089|       |	 * If uncompressed data is larger, child should get EPIPE and exit.
 1090|       |	 * However, with *parallel* calls OTHER child may unintentionally
 1091|       |	 * inherit pipe fds, thus keeping pipe open and making writes in
 1092|       |	 * our child block instead of failing with EPIPE!
 1093|       |	 * (For the bug to occur, two threads must mutually inherit their pipes,
 1094|       |	 * and both must have large outputs. Thus it happens not that often).
 1095|       |	 * To avoid this, be sure to create pipes with O_CLOEXEC.
 1096|       |	 */
 1097|  2.71k|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1097:7): [True: 2.71k, False: 0]
  |  Branch (1097:19): [True: 0, False: 2.71k]
  ------------------
 1098|  2.71k|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1098:6): [True: 0, False: 2.71k]
  ------------------
 1099|  2.71k|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1099:6): [True: 0, False: 2.71k]
  ------------------
 1100|      0|		closep(fdp[STDIN_FILENO]);
 1101|      0|		closep(fdp[STDOUT_FILENO]);
 1102|      0|		return makeerror(newch, n, "Cannot create pipe, %s",
 1103|      0|		    strerror(errno));
 1104|      0|	}
 1105|       |
 1106|  2.71k|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  445|  2.71k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1107|  2.71k|#ifdef HAVE_POSIX_SPAWNP
 1108|  2.71k|	posix_spawn_file_actions_init(&fa);
 1109|       |
 1110|  2.71k|	handledesc(&fa, fd, fdp);
 1111|       |
 1112|  2.71k|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1113|  2.71k|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1114|  2.71k|	    args, NULL);
 1115|       |
 1116|  2.71k|	posix_spawn_file_actions_destroy(&fa);
 1117|       |
 1118|  2.71k|	if (status == -1) {
  ------------------
  |  Branch (1118:6): [True: 0, False: 2.71k]
  ------------------
 1119|      0|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1120|      0|		    compr[method].argv[0], strerror(errno));
 1121|      0|	}
 1122|       |#else
 1123|       |	/* For processes with large mapped virtual sizes, vfork
 1124|       |	 * may be _much_ faster (10-100 times) than fork.
 1125|       |	 */
 1126|       |	pid = vfork();
 1127|       |	if (pid == -1) {
 1128|       |		return makeerror(newch, n, "Cannot vfork, %s",
 1129|       |		    strerror(errno));
 1130|       |	}
 1131|       |	if (pid == 0) {
 1132|       |		/* child */
 1133|       |		/* Note: we are after vfork, do not modify memory
 1134|       |		 * in a way which confuses parent. In particular,
 1135|       |		 * do not modify fdp[i][j].
 1136|       |		 */
 1137|       |		handledesc(NULL, fd, fdp);
 1138|       |		DPRINTF("Executing %s\n", compr[method].argv[0]);
 1139|       |
 1140|       |		(void)execvp(compr[method].argv[0], args);
 1141|       |		dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 1142|       |		    compr[method].argv[0], strerror(errno));
 1143|       |		_exit(EXIT_FAILURE); /* _exit(), not exit(), because of vfork */
 1144|       |	}
 1145|       |#endif
 1146|       |	/* parent */
 1147|       |	/* Close write sides of child stdout/err pipes */
 1148|  8.13k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  8.13k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1148:14): [True: 5.42k, False: 2.71k]
  ------------------
 1149|  5.42k|		closefd(fdp[i], 1);
 1150|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1151|  2.71k|	if (fd == -1) {
  ------------------
  |  Branch (1151:6): [True: 2.71k, False: 0]
  ------------------
 1152|  2.71k|		closefd(fdp[STDIN_FILENO], 0);
 1153|  2.71k|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1154|  2.71k|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1154:7): [True: 0, False: 2.71k]
  ------------------
 1155|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1156|      0|			    strerror(errno));
 1157|      0|			DPRINTF("Write to child failed\n");
 1158|      0|			goto err;
 1159|      0|		}
 1160|  2.71k|		closefd(fdp[STDIN_FILENO], 1);
 1161|  2.71k|	}
 1162|       |
 1163|  2.71k|	rv = OKDATA;
  ------------------
  |  |  215|  2.71k|#define OKDATA 	0
  ------------------
 1164|  2.71k|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1165|  2.71k|	DPRINTF("read got %zd\n", r);
 1166|  2.71k|	if (r < 0) {
  ------------------
  |  Branch (1166:6): [True: 0, False: 2.71k]
  ------------------
 1167|      0|		rv = ERRDATA;
  ------------------
  |  |  217|      0|#define ERRDATA	2
  ------------------
 1168|      0|		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
 1169|      0|		        strerror(errno));
 1170|      0|		goto err;
 1171|      0|	} 
 1172|  2.71k|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  444|  2.71k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1172:6): [True: 60, False: 2.65k]
  ------------------
 1173|       |		/*
 1174|       |		 * close fd so that the child exits with sigpipe and ignore
 1175|       |		 * errors, otherwise we risk the child blocking and never
 1176|       |		 * exiting.
 1177|       |		 */
 1178|     60|		DPRINTF("Closing stdout for bytes_max\n");
 1179|     60|		closefd(fdp[STDOUT_FILENO], 0);
 1180|     60|		goto ok;
 1181|     60|	}
 1182|  2.65k|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1182:6): [True: 174, False: 2.47k]
  ------------------
 1183|    174|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1184|    174|		rv = ERRDATA;
  ------------------
  |  |  217|    174|#define ERRDATA	2
  ------------------
 1185|    174|		r = filter_error(*newch, r);
 1186|    174|		goto ok;
 1187|    174|	}
 1188|  2.47k|	if  (re == 0)
  ------------------
  |  Branch (1188:7): [True: 2.47k, False: 0]
  ------------------
 1189|  2.47k|		goto ok;
 1190|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1191|      0|	    strerror(errno));
 1192|      0|	goto err;
 1193|  2.71k|ok:
 1194|  2.71k|	*n = r;
 1195|       |	/* NUL terminate, as every buffer is handled here. */
 1196|  2.71k|	(*newch)[*n] = '\0';
 1197|  2.71k|err:
 1198|  2.71k|	closefd(fdp[STDIN_FILENO], 1);
 1199|  2.71k|	closefd(fdp[STDOUT_FILENO], 0);
 1200|  2.71k|	closefd(fdp[STDERR_FILENO], 0);
 1201|       |
 1202|  2.71k|	w = waitpid(pid, &status, 0);
 1203|  5.42k|wait_err:
 1204|  5.42k|	if (w == -1) {
  ------------------
  |  Branch (1204:6): [True: 14, False: 5.40k]
  ------------------
 1205|     14|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1206|     14|		DPRINTF("Child wait return %#x\n", status);
 1207|  5.40k|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1207:13): [True: 0, False: 5.40k]
  ------------------
 1208|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1209|  5.40k|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1209:13): [True: 2.94k, False: 2.46k]
  ------------------
 1210|  2.94k|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1211|  2.94k|	}
 1212|  5.42k|	if (writepid > 0) {
  ------------------
  |  Branch (1212:6): [True: 2.71k, False: 2.71k]
  ------------------
 1213|       |		/* _After_ we know decompressor has exited, our input writer
 1214|       |		 * definitely will exit now (at worst, writing fails in it,
 1215|       |		 * since output fd is closed now on the reading size).
 1216|       |		 */
 1217|  2.71k|		w = waitpid(writepid, &status, 0);
 1218|  2.71k|		writepid = -1;
 1219|  2.71k|		goto wait_err;
 1220|  2.71k|	}
 1221|       |
 1222|  2.71k|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1223|  2.71k|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1224|       |
 1225|  2.71k|	return rv;
 1226|  5.42k|}
compress.c:getdecompressor:
 1018|  2.76k|{
 1019|  2.76k|	switch (method) {
 1020|      0|#ifdef BUILTIN_DECOMPRESS
 1021|     11|	case METH_FROZEN:
  ------------------
  |  |  185|     11|#define METH_FROZEN	2
  ------------------
  |  Branch (1021:2): [True: 11, False: 2.75k]
  ------------------
 1022|     11|		return uncompressgzipped;
 1023|     28|	case METH_ZLIB:
  ------------------
  |  |  191|     28|#define METH_ZLIB	14
  ------------------
  |  Branch (1023:2): [True: 28, False: 2.73k]
  ------------------
 1024|     28|		return uncompresszlib;
 1025|      0|#endif
 1026|      0|#ifdef BUILTIN_BZLIB
 1027|      7|	case METH_BZIP:
  ------------------
  |  |  186|      7|#define METH_BZIP	7
  ------------------
  |  Branch (1027:2): [True: 7, False: 2.75k]
  ------------------
 1028|      7|		return uncompressbzlib;
 1029|      0|#endif
 1030|      0|#ifdef BUILTIN_XZLIB
 1031|      2|	case METH_XZ:
  ------------------
  |  |  187|      2|#define METH_XZ		9
  ------------------
  |  Branch (1031:2): [True: 2, False: 2.76k]
  ------------------
 1032|      5|	case METH_LZMA:
  ------------------
  |  |  190|      5|#define METH_LZMA	13
  ------------------
  |  Branch (1032:2): [True: 3, False: 2.76k]
  ------------------
 1033|      5|		return uncompressxzlib;
 1034|      0|#endif
 1035|      0|#ifdef BUILTIN_ZSTDLIB
 1036|      3|	case METH_ZSTD:
  ------------------
  |  |  189|      3|#define METH_ZSTD	12
  ------------------
  |  Branch (1036:2): [True: 3, False: 2.76k]
  ------------------
 1037|      3|		return uncompresszstd;
 1038|      0|#endif
 1039|       |#ifdef BUILTIN_LZLIB
 1040|       |	case METH_LZIP:
 1041|       |		return uncompresslzlib;
 1042|       |#endif
 1043|  2.71k|	default:
  ------------------
  |  Branch (1043:2): [True: 2.71k, False: 54]
  ------------------
 1044|  2.71k|		return NULL;
 1045|  2.76k|	}
 1046|  2.76k|}
compress.c:makeerror:
  835|     68|{
  836|     68|	char *msg;
  837|     68|	va_list ap;
  838|     68|	int rv;
  839|       |
  840|     68|	DPRINTF("Makeerror %s\n", fmt);
  841|     68|	free(*buf);
  842|     68|	va_start(ap, fmt);
  843|     68|	rv = vasprintf(&msg, fmt, ap);
  844|     68|	va_end(ap);
  845|     68|	if (rv < 0) {
  ------------------
  |  Branch (845:6): [True: 0, False: 68]
  ------------------
  846|      0|		DPRINTF("Makeerror failed");
  847|      0|		*buf = NULL;
  848|      0|		*len = 0;
  849|      0|		return NODATA;
  ------------------
  |  |  216|      0|#define NODATA	1
  ------------------
  850|      0|	}
  851|     68|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  445|     68|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  852|     68|	*len = strlen(msg);
  853|     68|	return ERRDATA;
  ------------------
  |  |  217|     68|#define ERRDATA	2
  ------------------
  854|     68|}
compress.c:handledesc:
  904|  2.71k|{
  905|  2.71k|	if (fd != -1) {
  ------------------
  |  Branch (905:6): [True: 0, False: 2.71k]
  ------------------
  906|      0|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  907|      0|		movedesc(v, STDIN_FILENO, fd);
  908|  2.71k|	} else {
  909|  2.71k|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
  910|  2.71k|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (910:7): [True: 2.71k, False: 0]
  ------------------
  911|  2.71k|		    closedesc(v, fdp[STDIN_FILENO][1]);
  912|  2.71k|	}
  913|       |
  914|  2.71k|	file_clear_closexec(STDIN_FILENO);
  915|       |
  916|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
  917|  2.71k|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
  918|  2.71k|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (918:6): [True: 2.71k, False: 0]
  ------------------
  919|  2.71k|		closedesc(v, fdp[STDOUT_FILENO][0]);
  920|       |
  921|  2.71k|	file_clear_closexec(STDOUT_FILENO);
  922|       |
  923|  2.71k|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
  924|  2.71k|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (924:6): [True: 2.71k, False: 0]
  ------------------
  925|  2.71k|		closedesc(v, fdp[STDERR_FILENO][0]);
  926|       |
  927|  2.71k|	file_clear_closexec(STDERR_FILENO);
  928|  2.71k|}
compress.c:movedesc:
  875|  8.13k|{
  876|  8.13k|	if (fd == i)
  ------------------
  |  Branch (876:6): [True: 0, False: 8.13k]
  ------------------
  877|      0|		return; /* "no dup was necessary" */
  878|  8.13k|#ifdef HAVE_POSIX_SPAWNP
  879|  8.13k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  445|  8.13k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  880|  8.13k|	posix_spawn_file_actions_adddup2(fa, fd, i);
  881|  8.13k|	posix_spawn_file_actions_addclose(fa, fd);
  882|       |#else
  883|       |	if (dup2(fd, i) == -1) {
  884|       |		DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
  885|       |		exit(EXIT_FAILURE);
  886|       |	}
  887|       |	close(v ? fd : fd);
  888|       |#endif
  889|  8.13k|}
compress.c:closedesc:
  893|  8.13k|{
  894|  8.13k|#ifdef HAVE_POSIX_SPAWNP
  895|  8.13k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  445|  8.13k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  896|  8.13k|	posix_spawn_file_actions_addclose(fa, fd);
  897|       |#else
  898|       |	close(v ? fd : fd);
  899|       |#endif
  900|  8.13k|}
compress.c:closefd:
  858|  21.7k|{
  859|  21.7k|	if (fd[i] == -1)
  ------------------
  |  Branch (859:6): [True: 5.48k, False: 16.2k]
  ------------------
  860|  5.48k|		return;
  861|  16.2k|	(void) close(fd[i]);
  862|  16.2k|	fd[i] = -1;
  863|  16.2k|}
compress.c:writechild:
  932|  2.71k|{
  933|  2.71k|	pid_t pid;
  934|       |
  935|       |	/*
  936|       |	 * fork again, to avoid blocking because both
  937|       |	 * pipes filled
  938|       |	 */
  939|  2.71k|	pid = fork();
  940|  2.71k|	if (pid == -1) {
  ------------------
  |  Branch (940:6): [True: 0, False: 2.71k]
  ------------------
  941|      0|		DPRINTF("Fork failed (%s)\n", strerror(errno));
  942|      0|		return -1;
  943|      0|	}
  944|  2.71k|	if (pid == 0) {
  ------------------
  |  Branch (944:6): [True: 0, False: 2.71k]
  ------------------
  945|       |		/* child */
  946|      0|		if (swrite(fd, old, n) != CAST(ssize_t, n)) {
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (946:7): [True: 0, False: 0]
  ------------------
  947|      0|			DPRINTF("Write failed (%s)\n", strerror(errno));
  948|      0|			exit(EXIT_FAILURE);
  949|      0|		}
  950|      0|		exit(EXIT_SUCCESS);
  951|      0|	}
  952|       |	/* parent */
  953|  2.71k|	return pid;
  954|  2.71k|}
compress.c:filter_error:
  958|    174|{
  959|    174|	char *p;
  960|    174|	char *buf;
  961|       |
  962|    174|	ubuf[n] = '\0';
  963|    174|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  445|    174|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  964|    174|	while (isspace(CAST(unsigned char, *buf)))
  965|     52|		buf++;
  966|    174|	DPRINTF("Filter error[[[%s]]]\n", buf);
  967|    174|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  444|    174|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (967:6): [True: 11, False: 163]
  ------------------
  968|     11|		*p = '\0';
  969|    174|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  444|    174|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (969:6): [True: 0, False: 174]
  ------------------
  970|      0|		*p = '\0';
  971|    174|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  444|    174|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (971:6): [True: 18, False: 156]
  ------------------
  972|     18|		++p;
  973|     18|		while (isspace(CAST(unsigned char, *p)))
  974|     16|			p++;
  975|     18|		n = strlen(p);
  976|     18|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  444|     18|#define CAST(T, b)	((T)(b))
  ------------------
  977|     18|	}
  978|    174|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
  979|    174|	if (islower(*ubuf))
  980|     14|		*ubuf = toupper(*ubuf);
  981|    174|	return n;
  982|    174|}

der_offs:
  265|  29.9k|{
  266|  29.9k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  445|  29.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  29.9k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 29.9k, False: 0]
  ------------------
  268|       |
  269|  29.9k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  29.9k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  29.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 29.9k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  29.9k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  29.9k|	    offs, m->offset));
  275|       |
  276|  29.9k|	uint32_t tlen = getlength(b, &offs, len);
  277|  29.9k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  29.9k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  29.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 29.9k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  29.9k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  29.9k|	    offs, tlen));
  283|       |
  284|  29.9k|	offs += ms->offset + m->offset;
  285|  29.9k|	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|  29.9k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 5.20k, False: 24.7k]
  ------------------
  293|  5.20k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 5.20k]
  ------------------
  294|      0|			return -1;
  295|  5.20k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  444|  5.20k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  5.20k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  5.20k|		    ms->c.li[m->cont_level - 1].off));
  298|  5.20k|	}
  299|  29.9k|	return CAST(int32_t, offs);
  ------------------
  |  |  444|  29.9k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  29.9k|}
der_cmp:
  304|   368k|{
  305|   368k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  445|   368k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   368k|	const char *s = m->value.s;
  307|   368k|	size_t offs = 0, len = ms->search.s_len;
  308|   368k|	uint32_t tag, tlen;
  309|   368k|	char buf[128];
  310|       |
  311|   368k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   368k|	tag = gettag(b, &offs, len);
  314|   368k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   368k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   368k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 10.5k, False: 358k]
  ------------------
  315|  10.5k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  10.5k|		return -1;
  317|  10.5k|	}
  318|       |
  319|   358k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   358k|	    offs, m->offset));
  321|       |
  322|   358k|	tlen = getlength(b, &offs, len);
  323|   358k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   358k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   358k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 133k, False: 224k]
  ------------------
  324|   133k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   133k|		return -1;
  326|   133k|	}
  327|       |
  328|   224k|	der_tag(buf, sizeof(buf), tag);
  329|   224k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   224k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 224k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   224k|	size_t slen = strlen(buf);
  333|       |
  334|   224k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 192k, False: 32.0k]
  ------------------
  335|   192k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   192k|		return 0;
  337|   192k|	}
  338|       |
  339|  32.0k|	s += slen;
  340|       |
  341|  33.0k|again:
  342|  33.0k|	switch (*s) {
  343|  29.3k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 29.3k, False: 3.76k]
  ------------------
  344|  29.3k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  29.3k|		return 1;
  346|  1.29k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.29k, False: 31.7k]
  ------------------
  347|  1.29k|		s++;
  348|  1.29k|		goto val;
  349|  2.46k|	default:
  ------------------
  |  Branch (349:2): [True: 2.46k, False: 30.6k]
  ------------------
  350|  2.46k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 2.46k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  2.46k|		slen = 0;
  356|  2.46k|		do
  357|  3.47k|			slen = slen * 10 + *s - '0';
  358|  2.46k|		while (isdigit(CAST(unsigned char, *++s)));
  359|  2.46k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.46k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 2.46k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  2.46k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 1.39k, False: 1.07k]
  ------------------
  363|  1.39k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  1.39k|			return 0;
  365|  1.39k|		}
  366|  1.07k|		goto again;
  367|  33.0k|	}
  368|  1.29k|val:
  369|  1.29k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.29k|	    tlen));
  371|  1.29k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.29k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.29k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.29k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.29k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 939, False: 358]
  |  Branch (374:29): [True: 645, False: 294]
  ------------------
  375|    645|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    645|		return 0;
  377|    645|	}
  378|    652|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    652|	DPRINTF(("%s: complete match\n", __func__));
  380|    652|	return 1;
  381|  1.29k|}
der.c:gettag:
  150|   398k|{
  151|   398k|	uint32_t tag;
  152|       |
  153|   398k|	if (*p >= l)
  ------------------
  |  Branch (153:6): [True: 6.01k, False: 392k]
  ------------------
  154|  6.01k|		return DER_BAD;
  ------------------
  |  |   62|  6.01k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  6.01k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   392k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   392k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 274k, False: 118k]
  ------------------
  159|   274k|		return tag;
  160|       |
  161|   118k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 1.03k, False: 117k]
  ------------------
  162|  1.03k|		return DER_BAD;
  ------------------
  |  |   62|  1.03k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  1.03k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  1.12M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 1.00M, False: 114k]
  ------------------
  165|  1.00M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  1.00M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 2.88k, False: 1.00M]
  ------------------
  167|  2.88k|			return DER_BAD;
  ------------------
  |  |   62|  2.88k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  2.88k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  1.00M|	}
  169|   114k|	return tag;
  170|   117k|}
der.c:getlength:
  183|   388k|{
  184|   388k|	uint8_t digits, i;
  185|   388k|	size_t len;
  186|   388k|	int is_onebyte_result;
  187|       |
  188|   388k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 4.44k, False: 383k]
  ------------------
  189|  4.44k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  4.44k|		return DER_BAD;
  ------------------
  |  |   62|  4.44k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  4.44k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  4.44k|	}
  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|   383k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   383k|	digits = c[(*p)++] & 0x7f;
  200|   383k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 100k, False: 283k]
  ------------------
  201|   100k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|   100k|		return DER_BAD;
  ------------------
  |  |   62|   100k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   100k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|   100k|	}
  204|       |
  205|   283k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 215k, False: 67.8k]
  ------------------
  206|   215k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  67.8k|	len = 0;
  213|  4.97M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 4.91M, False: 67.8k]
  ------------------
  214|  4.91M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  67.8k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 26.8k, False: 40.9k]
  |  Branch (216:31): [True: 1.55k, False: 39.3k]
  ------------------
  217|  28.4k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  28.4k|		    __func__, *p, len, l));
  219|  28.4k|		return DER_BAD;
  ------------------
  |  |   62|  28.4k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  28.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  28.4k|	}
  221|  39.3k|	return CAST(uint32_t, len);
  ------------------
  |  |  444|  39.3k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  67.8k|}
der.c:der_tag:
  226|   224k|{
  227|   224k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   224k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 138k, False: 85.8k]
  ------------------
  228|   138k|		strlcpy(buf, der__tag[tag], len);
  229|  85.8k|	else
  230|  85.8k|		snprintf(buf, len, "%#x", tag);
  231|   224k|	return buf;
  232|   224k|}
der.c:der_data:
  237|  1.29k|{
  238|  1.29k|	uint32_t i;
  239|  1.29k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  444|  1.29k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.29k|	switch (tag) {
  241|     90|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     90|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 90, False: 1.20k]
  ------------------
  242|    189|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    189|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 99, False: 1.19k]
  ------------------
  243|    220|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    220|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 31, False: 1.26k]
  ------------------
  244|    220|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  445|    220|#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.29k]
  ------------------
  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.07k|	default:
  ------------------
  |  Branch (251:2): [True: 1.07k, False: 220]
  ------------------
  252|  1.07k|		break;
  253|  1.29k|	}
  254|       |
  255|  4.61k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 3.53k, False: 1.07k]
  ------------------
  256|  3.53k|		uint32_t z = i << 1;
  257|  3.53k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 3.24k, False: 290]
  ------------------
  258|  3.24k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  3.53k|	}
  260|  1.07k|	return len * 2;
  261|  1.29k|}

file_encoding:
   78|  23.0k|{
   79|  23.0k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  23.0k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  23.0k|	size_t nbytes = b->flen;
   81|  23.0k|	size_t mlen;
   82|  23.0k|	int rv = 1, ucs_type;
   83|  23.0k|	file_unichar_t *udefbuf;
   84|  23.0k|	size_t udeflen;
   85|       |
   86|  23.0k|	if (ubuf == NULL)
  ------------------
  |  Branch (86:6): [True: 12.7k, False: 10.2k]
  ------------------
   87|  12.7k|		ubuf = &udefbuf;
   88|  23.0k|	if (ulen == NULL)
  ------------------
  |  Branch (88:6): [True: 12.7k, False: 10.2k]
  ------------------
   89|  12.7k|		ulen = &udeflen;
   90|       |
   91|  23.0k|	*type = "text";
   92|  23.0k|	*ulen = 0;
   93|  23.0k|	*code = "unknown";
   94|  23.0k|	*code_mime = "binary";
   95|       |
   96|  23.0k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (96:6): [True: 660, False: 22.3k]
  ------------------
   97|    660|		nbytes = ms->encoding_max;
   98|       |
   99|  23.0k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  100|  23.0k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  444|  23.0k|#define CAST(T, b)	((T)(b))
  ------------------
  101|  23.0k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (101:6): [True: 0, False: 23.0k]
  ------------------
  102|      0|		file_oomem(ms, mlen);
  103|      0|		goto done;
  104|      0|	}
  105|  23.0k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (105:6): [True: 1.72k, False: 21.2k]
  ------------------
  106|  1.72k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (106:7): [True: 12, False: 1.71k]
  ------------------
  107|     12|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  108|     12|			*code = "Unicode text, UTF-7";
  109|     12|			*code_mime = "utf-7";
  110|  1.71k|		} else {
  111|  1.71k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  112|  1.71k|			*code = "ASCII";
  113|  1.71k|			*code_mime = "us-ascii";
  114|  1.71k|		}
  115|  21.2k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (115:13): [True: 7, False: 21.2k]
  ------------------
  116|      7|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  117|      7|		*code = "Unicode text, UTF-8 (with BOM)";
  118|      7|		*code_mime = "utf-8";
  119|  21.2k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (119:13): [True: 165, False: 21.1k]
  ------------------
  120|    165|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  121|    165|		*code = "Unicode text, UTF-8";
  122|    165|		*code_mime = "utf-8";
  123|  21.1k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (123:13): [True: 322, False: 20.7k]
  ------------------
  124|    322|		if (ucs_type == 1) {
  ------------------
  |  Branch (124:7): [True: 136, False: 186]
  ------------------
  125|    136|			*code = "Unicode text, UTF-32, little-endian";
  126|    136|			*code_mime = "utf-32le";
  127|    186|		} else {
  128|    186|			*code = "Unicode text, UTF-32, big-endian";
  129|    186|			*code_mime = "utf-32be";
  130|    186|		}
  131|    322|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  132|  20.7k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (132:13): [True: 397, False: 20.3k]
  ------------------
  133|    397|		if (ucs_type == 1) {
  ------------------
  |  Branch (133:7): [True: 196, False: 201]
  ------------------
  134|    196|			*code = "Unicode text, UTF-16, little-endian";
  135|    196|			*code_mime = "utf-16le";
  136|    201|		} else {
  137|    201|			*code = "Unicode text, UTF-16, big-endian";
  138|    201|			*code_mime = "utf-16be";
  139|    201|		}
  140|    397|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  141|  20.3k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (141:13): [True: 909, False: 19.4k]
  ------------------
  142|    909|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  143|    909|		*code = "ISO-8859";
  144|    909|		*code_mime = "iso-8859-1";
  145|  19.4k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (145:13): [True: 541, False: 18.9k]
  ------------------
  146|    541|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  147|    541|		*code = "Non-ISO extended-ASCII";
  148|    541|		*code_mime = "unknown-8bit";
  149|  18.9k|	} else {
  150|  18.9k|		unsigned char *nbuf;
  151|       |
  152|  18.9k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  153|  18.9k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  444|  18.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (153:7): [True: 0, False: 18.9k]
  ------------------
  154|      0|			file_oomem(ms, mlen);
  155|      0|			goto done;
  156|      0|		}
  157|  18.9k|		from_ebcdic(buf, nbytes, nbuf);
  158|       |
  159|  18.9k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (159:7): [True: 90, False: 18.8k]
  ------------------
  160|     90|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  161|     90|			*code = "EBCDIC";
  162|     90|			*code_mime = "ebcdic";
  163|  18.8k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (163:14): [True: 84, False: 18.7k]
  ------------------
  164|     84|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  165|     84|			    *ulen));
  166|     84|			*code = "International EBCDIC";
  167|     84|			*code_mime = "ebcdic";
  168|  18.7k|		} else { /* Doesn't look like text at all */
  169|  18.7k|			DPRINTF(("binary\n"));
  170|  18.7k|			rv = 0;
  171|  18.7k|			*type = "binary";
  172|  18.7k|		}
  173|  18.9k|		free(nbuf);
  174|  18.9k|	}
  175|       |
  176|  23.0k| done:
  177|  23.0k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (177:6): [True: 12.7k, False: 10.2k]
  ------------------
  178|  12.7k|		free(udefbuf);
  179|       |
  180|  23.0k|	return rv;
  181|  23.0k|}
file_looks_utf8:
  352|  21.3k|{
  353|  21.3k|	size_t i;
  354|  21.3k|	int n;
  355|  21.3k|	file_unichar_t c;
  356|  21.3k|	int gotone = 0, ctrl = 0;
  357|       |
  358|  21.3k|	if (ubuf)
  ------------------
  |  Branch (358:6): [True: 21.3k, False: 0]
  ------------------
  359|  21.3k|		*ulen = 0;
  360|       |
  361|  18.5M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (361:14): [True: 18.5M, False: 1.58k]
  ------------------
  362|  18.5M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (362:7): [True: 18.4M, False: 40.3k]
  ------------------
  363|       |			/*
  364|       |			 * Even if the whole file is valid UTF-8 sequences,
  365|       |			 * still reject it if it uses weird control characters.
  366|       |			 */
  367|       |
  368|  18.4M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  236|  18.4M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (368:8): [True: 15.8M, False: 2.63M]
  ------------------
  369|  15.8M|				ctrl = 1;
  370|       |
  371|  18.4M|			if (ubuf)
  ------------------
  |  Branch (371:8): [True: 18.4M, False: 0]
  ------------------
  372|  18.4M|				ubuf[(*ulen)++] = buf[i];
  373|  18.4M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (373:14): [True: 9.62k, False: 30.6k]
  ------------------
  374|  9.62k|			return -1;
  375|  30.6k|		} else {			   /* 11xxxxxx begins UTF-8 */
  376|  30.6k|			int following;
  377|  30.6k|			uint8_t x = first[buf[i]];
  378|  30.6k|			const struct accept_range *ar =
  379|  30.6k|			    &accept_ranges[(unsigned int)x >> 4];
  380|  30.6k|			if (x == XX)
  ------------------
  |  |  300|  30.6k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (380:8): [True: 4.27k, False: 26.4k]
  ------------------
  381|  4.27k|				return -1;
  382|       |
  383|  26.4k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (383:8): [True: 15.5k, False: 10.8k]
  ------------------
  384|  15.5k|				c = buf[i] & 0x1f;
  385|  15.5k|				following = 1;
  386|  15.5k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (386:15): [True: 9.85k, False: 992]
  ------------------
  387|  9.85k|				c = buf[i] & 0x0f;
  388|  9.85k|				following = 2;
  389|  9.85k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (389:15): [True: 992, False: 0]
  ------------------
  390|    992|				c = buf[i] & 0x07;
  391|    992|				following = 3;
  392|    992|			} else if ((buf[i] & 0x04) == 0) {	/* 111110xx */
  ------------------
  |  Branch (392:15): [True: 0, False: 0]
  ------------------
  393|      0|				c = buf[i] & 0x03;
  394|      0|				following = 4;
  395|      0|			} else if ((buf[i] & 0x02) == 0) {	/* 1111110x */
  ------------------
  |  Branch (395:15): [True: 0, False: 0]
  ------------------
  396|      0|				c = buf[i] & 0x01;
  397|      0|				following = 5;
  398|      0|			} else
  399|      0|				return -1;
  400|       |
  401|  57.9k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (401:16): [True: 37.4k, False: 20.5k]
  ------------------
  402|  37.4k|				i++;
  403|  37.4k|				if (i >= nbytes)
  ------------------
  |  Branch (403:9): [True: 174, False: 37.2k]
  ------------------
  404|    174|					goto done;
  405|       |
  406|  37.2k|				if (n == 0 &&
  ------------------
  |  Branch (406:9): [True: 26.2k, False: 11.0k]
  ------------------
  407|  37.2k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (407:11): [True: 914, False: 25.3k]
  |  Branch (407:30): [True: 4.65k, False: 20.6k]
  ------------------
  408|  5.56k|					return -1;
  409|       |
  410|  31.6k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (410:9): [True: 68, False: 31.6k]
  |  Branch (410:33): [True: 47, False: 31.5k]
  ------------------
  411|    115|					return -1;
  412|       |
  413|  31.5k|				c = (c << 6) + (buf[i] & 0x3f);
  414|  31.5k|			}
  415|       |
  416|  20.5k|			if (ubuf)
  ------------------
  |  Branch (416:8): [True: 20.5k, False: 0]
  ------------------
  417|  20.5k|				ubuf[(*ulen)++] = c;
  418|  20.5k|			gotone = 1;
  419|  20.5k|		}
  420|  18.5M|	}
  421|  1.76k|done:
  422|  1.76k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (422:9): [True: 1.50k, False: 256]
  |  Branch (422:21): [True: 165, False: 91]
  ------------------
  423|  21.3k|}
encoding.c:looks_ascii:
  265|  41.9k|    size_t *ulen) \
  266|  41.9k|{ \
  267|  41.9k|	size_t i; \
  268|  41.9k|\
  269|  41.9k|	*ulen = 0; \
  270|  41.9k|\
  271|  16.0M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 16.0M, False: 1.81k]
  ------------------
  272|  16.0M|		int t = text_chars[buf[i]]; \
  273|  16.0M|\
  274|  16.0M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 40.1k, False: 16.0M]
  ------------------
  275|  16.0M|			return 0; \
  276|  16.0M|\
  277|  16.0M|		ubuf[(*ulen)++] = buf[i]; \
  278|  16.0M|	} \
  279|  41.9k|	return 1; \
  280|  41.9k|}
encoding.c:looks_latin1:
  265|  39.2k|    size_t *ulen) \
  266|  39.2k|{ \
  267|  39.2k|	size_t i; \
  268|  39.2k|\
  269|  39.2k|	*ulen = 0; \
  270|  39.2k|\
  271|  6.32M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 6.32M, False: 993]
  ------------------
  272|  6.32M|		int t = text_chars[buf[i]]; \
  273|  6.32M|\
  274|  15.7M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 3.10M, False: 3.21M]
  |  Branch (274:7): [True: 38.2k, False: 3.06M]
  ------------------
  275|  6.32M|			return 0; \
  276|  6.32M|\
  277|  6.32M|		ubuf[(*ulen)++] = buf[i]; \
  278|  6.28M|	} \
  279|  39.2k|	return 1; \
  280|  39.2k|}
encoding.c:looks_extended:
  265|  19.4k|    size_t *ulen) \
  266|  19.4k|{ \
  267|  19.4k|	size_t i; \
  268|  19.4k|\
  269|  19.4k|	*ulen = 0; \
  270|  19.4k|\
  271|  4.67M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 4.67M, False: 541]
  ------------------
  272|  4.67M|		int t = text_chars[buf[i]]; \
  273|  4.67M|\
  274|  15.2M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 741k, False: 3.93M]
  |  Branch (274:7): [True: 446k, False: 294k]
  |  Branch (274:7): [True: 18.9k, False: 427k]
  ------------------
  275|  4.67M|			return 0; \
  276|  4.67M|\
  277|  4.67M|		ubuf[(*ulen)++] = buf[i]; \
  278|  4.65M|	} \
  279|  19.4k|	return 1; \
  280|  19.4k|}
encoding.c:looks_utf8_with_BOM:
  433|  21.2k|{
  434|  21.2k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (434:6): [True: 20.0k, False: 1.20k]
  |  Branch (434:20): [True: 132, False: 19.9k]
  |  Branch (434:38): [True: 94, False: 38]
  |  Branch (434:56): [True: 71, False: 23]
  ------------------
  435|     71|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  436|  21.2k|	else
  437|  21.2k|		return -1;
  438|  21.2k|}
encoding.c:looks_utf7:
  443|  1.72k|{
  444|  1.72k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (444:6): [True: 1.10k, False: 623]
  |  Branch (444:20): [True: 35, False: 1.06k]
  |  Branch (444:37): [True: 18, False: 17]
  |  Branch (444:54): [True: 15, False: 3]
  ------------------
  445|     15|		switch (buf[3]) {
  446|      3|		case '8':
  ------------------
  |  Branch (446:3): [True: 3, False: 12]
  ------------------
  447|      6|		case '9':
  ------------------
  |  Branch (447:3): [True: 3, False: 12]
  ------------------
  448|      9|		case '+':
  ------------------
  |  Branch (448:3): [True: 3, False: 12]
  ------------------
  449|     12|		case '/':
  ------------------
  |  Branch (449:3): [True: 3, False: 12]
  ------------------
  450|     12|			if (ubuf)
  ------------------
  |  Branch (450:8): [True: 12, False: 0]
  ------------------
  451|     12|				*ulen = 0;
  452|     12|			return 1;
  453|      3|		default:
  ------------------
  |  Branch (453:3): [True: 3, False: 12]
  ------------------
  454|      3|			return -1;
  455|     15|		}
  456|  1.71k|	else
  457|  1.71k|		return -1;
  458|  1.72k|}
encoding.c:looks_ucs16:
  467|  20.7k|{
  468|  20.7k|	int bigend;
  469|  20.7k|	uint32_t hi;
  470|  20.7k|	size_t i;
  471|       |
  472|  20.7k|	if (nbytes < 2)
  ------------------
  |  Branch (472:6): [True: 72, False: 20.7k]
  ------------------
  473|     72|		return 0;
  474|       |
  475|  20.7k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (475:6): [True: 2.23k, False: 18.4k]
  |  Branch (475:23): [True: 266, False: 1.96k]
  ------------------
  476|    266|		bigend = 0;
  477|  20.4k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (477:11): [True: 344, False: 20.1k]
  |  Branch (477:28): [True: 292, False: 52]
  ------------------
  478|    292|		bigend = 1;
  479|  20.1k|	else
  480|  20.1k|		return 0;
  481|       |
  482|    558|	*ulen = 0;
  483|    558|	hi = 0;
  484|       |
  485|   428k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (485:14): [True: 428k, False: 397]
  ------------------
  486|   428k|		uint32_t uc;
  487|       |
  488|   428k|		if (bigend)
  ------------------
  |  Branch (488:7): [True: 132k, False: 296k]
  ------------------
  489|   132k|			uc = CAST(uint32_t,
  ------------------
  |  |  444|   132k|#define CAST(T, b)	((T)(b))
  ------------------
  490|   428k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  491|   296k|		else
  492|   296k|			uc = CAST(uint32_t,
  ------------------
  |  |  444|   296k|#define CAST(T, b)	((T)(b))
  ------------------
  493|   428k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  494|       |
  495|   428k|		uc &= 0xffff;
  496|       |
  497|   428k|		switch (uc) {
  498|      0|		case 0xfffe:
  ------------------
  |  Branch (498:3): [True: 0, False: 428k]
  ------------------
  499|     10|		case 0xffff:
  ------------------
  |  Branch (499:3): [True: 10, False: 428k]
  ------------------
  500|     10|			return 0;
  501|   428k|		default:
  ------------------
  |  Branch (501:3): [True: 428k, False: 10]
  ------------------
  502|   428k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  460|   428k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (460:26): [True: 36.9k, False: 391k]
  |  |  |  Branch (460:43): [True: 16, False: 36.9k]
  |  |  ------------------
  ------------------
  503|     16|				return 0;
  504|   428k|			break;
  505|   428k|		}
  506|   428k|		if (hi) {
  ------------------
  |  Branch (506:7): [True: 480, False: 427k]
  ------------------
  507|    480|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  462|    480|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 437, False: 43]
  |  |  |  Branch (462:43): [True: 420, False: 17]
  |  |  ------------------
  ------------------
  508|     60|				return 0;
  509|    420|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  510|    420|			hi = 0;
  511|    420|		}
  512|   428k|		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  444|  10.6k|#define CAST(T, b)	((T)(b))
  ------------------
              		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  236|  10.6k|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (512:7): [True: 10.6k, False: 417k]
  |  Branch (512:19): [True: 44, False: 10.6k]
  ------------------
  513|     44|			return 0;
  514|   428k|		ubf[(*ulen)++] = uc;
  515|   428k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  461|   428k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (461:26): [True: 59.8k, False: 368k]
  |  |  |  Branch (461:43): [True: 525, False: 59.3k]
  |  |  ------------------
  ------------------
  516|    525|			hi = uc - 0xd800 + 1;
  517|   428k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  462|   428k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 59.3k, False: 368k]
  |  |  |  Branch (462:43): [True: 31, False: 59.3k]
  |  |  ------------------
  ------------------
  518|     31|			return 0;
  519|   428k|	}
  520|       |
  521|    397|	return 1 + bigend;
  522|    558|}
encoding.c:looks_ucs32:
  527|  21.1k|{
  528|  21.1k|	int bigend;
  529|  21.1k|	size_t i;
  530|       |
  531|  21.1k|	if (nbytes < 4)
  ------------------
  |  Branch (531:6): [True: 1.11k, False: 19.9k]
  ------------------
  532|  1.11k|		return 0;
  533|       |
  534|  19.9k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (534:6): [True: 2.28k, False: 17.7k]
  |  Branch (534:23): [True: 381, False: 1.90k]
  |  Branch (534:40): [True: 205, False: 176]
  |  Branch (534:54): [True: 159, False: 46]
  ------------------
  535|    159|		bigend = 0;
  536|  19.8k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (536:11): [True: 1.17k, False: 18.6k]
  |  Branch (536:25): [True: 601, False: 576]
  |  Branch (536:39): [True: 247, False: 354]
  |  Branch (536:56): [True: 200, False: 47]
  ------------------
  537|    200|		bigend = 1;
  538|  19.6k|	else
  539|  19.6k|		return 0;
  540|       |
  541|    359|	*ulen = 0;
  542|       |
  543|   507k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (543:14): [True: 506k, False: 322]
  ------------------
  544|       |		/* XXX fix to properly handle chars > 65536 */
  545|       |
  546|   506k|		if (bigend)
  ------------------
  |  Branch (546:7): [True: 326k, False: 180k]
  ------------------
  547|   326k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  444|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  548|   326k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  444|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  549|   326k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  444|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  550|   326k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  444|   326k|#define CAST(T, b)	((T)(b))
  ------------------
  551|   180k|		else
  552|   180k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  444|   180k|#define CAST(T, b)	((T)(b))
  ------------------
  553|   180k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  444|   180k|#define CAST(T, b)	((T)(b))
  ------------------
  554|   180k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  444|   180k|#define CAST(T, b)	((T)(b))
  ------------------
  555|   180k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  444|   180k|#define CAST(T, b)	((T)(b))
  ------------------
  556|       |
  557|   506k|		if (ubf[*ulen - 1] == 0xfffe)
  ------------------
  |  Branch (557:7): [True: 7, False: 506k]
  ------------------
  558|      7|			return 0;
  559|   506k|		if (ubf[*ulen - 1] < 128 &&
  ------------------
  |  Branch (559:7): [True: 3.62k, False: 503k]
  ------------------
  560|   506k|		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  444|  3.62k|#define CAST(T, b)	((T)(b))
  ------------------
              		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  236|  3.62k|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (560:7): [True: 30, False: 3.59k]
  ------------------
  561|     30|			return 0;
  562|   506k|	}
  563|       |
  564|    322|	return 1 + bigend;
  565|    359|}
encoding.c:from_ebcdic:
  652|  18.9k|{
  653|  18.9k|	size_t i;
  654|       |
  655|  81.7M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (655:14): [True: 81.6M, False: 18.9k]
  ------------------
  656|  81.6M|		out[i] = ebcdic_to_ascii[buf[i]];
  657|  81.6M|	}
  658|  18.9k|}

fmtcheck:
  236|  32.3k|{
  237|  32.3k|	const char	*f1p, *f2p;
  238|  32.3k|	EFT		f1t, f2t;
  239|       |
  240|  32.3k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 32.3k]
  ------------------
  241|       |
  242|  32.3k|	f1p = f1;
  243|  32.3k|	f1t = FMTCHECK_START;
  244|  32.3k|	f2p = f2;
  245|  32.3k|	f2t = FMTCHECK_START;
  246|  64.6k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 32.3k, False: 32.3k]
  ------------------
  247|  32.3k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 32.3k]
  ------------------
  248|      0|			return f2;
  249|  32.3k|		f2t = get_next_format(&f2p, f2t);
  250|  32.3k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 32.3k]
  ------------------
  251|      0|			return f2;
  252|  32.3k|	}
  253|  32.3k|	return f1;
  254|  32.3k|}
fmtcheck.c:get_next_format:
  190|  96.9k|{
  191|  96.9k|	int		infmt;
  192|  96.9k|	const char	*f;
  193|       |
  194|  96.9k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 96.9k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|  96.9k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 96.9k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|  96.9k|	f = *pf;
  203|  96.9k|	infmt = 0;
  204|   161k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 96.9k, False: 64.6k]
  ------------------
  205|  96.9k|		f = strchr(f, '%');
  206|  96.9k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 32.3k, False: 64.6k]
  ------------------
  207|  32.3k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  32.3k|#define RETURN(pf,f,r) do { \
  |  |   61|  32.3k|			*(pf) = (f); \
  |  |   62|  32.3k|			return r; \
  |  |   63|  32.3k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  208|  64.6k|		f++;
  209|  64.6k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 64.6k]
  ------------------
  210|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  211|  64.6k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 64.6k, False: 0]
  ------------------
  212|  64.6k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|  64.6k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|  70.7k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 70.7k, False: 0]
  |  Branch (218:15): [True: 6.08k, False: 64.6k]
  ------------------
  219|  6.08k|		f++;
  220|       |
  221|  64.6k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 64.6k]
  ------------------
  222|      0|		RETURN(pf,f,FMTCHECK_WIDTH);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  223|      0|	}
  224|       |	/* eat any width */
  225|  64.6k|	while (isdigit((unsigned char)*f)) f++;
  226|  64.6k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 64.6k]
  ------------------
  227|      0|		RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  228|      0|	}
  229|       |
  230|  64.6k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|  64.6k|#define RETURN(pf,f,r) do { \
  |  |   61|  64.6k|			*(pf) = (f); \
  |  |   62|  64.6k|			return r; \
  |  |   63|  64.6k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|  64.6k|}
fmtcheck.c:get_next_format_from_width:
  171|  64.6k|{
  172|  64.6k|	const char	*f;
  173|       |
  174|  64.6k|	f = *pf;
  175|  64.6k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 2.90k, False: 61.7k]
  ------------------
  176|  2.90k|		f++;
  177|  2.90k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 2.90k]
  ------------------
  178|      0|			RETURN(pf,f,FMTCHECK_PRECISION);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|      0|		}
  180|       |		/* eat any precision (empty is allowed) */
  181|  3.62k|		while (isdigit((unsigned char)*f)) f++;
  182|  2.90k|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (182:7): [True: 0, False: 2.90k]
  ------------------
  183|  2.90k|	}
  184|  64.6k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|  64.6k|#define RETURN(pf,f,r) do { \
  |  |   61|  64.6k|			*(pf) = (f); \
  |  |   62|  64.6k|			return r; \
  |  |   63|  64.6k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|  64.6k|}
fmtcheck.c:get_next_format_from_precision:
   67|  64.6k|{
   68|  64.6k|	int		sh, lg, quad, longdouble;
   69|  64.6k|	const char	*f;
   70|       |
   71|  64.6k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|  64.6k|	f = *pf;
   74|  64.6k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 64.6k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|  2.38k|	case 'l':
  ------------------
  |  Branch (79:2): [True: 2.38k, False: 62.2k]
  ------------------
   80|  2.38k|		f++;
   81|  2.38k|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (81:7): [True: 0, False: 2.38k]
  ------------------
   82|  2.38k|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 2.38k, False: 0]
  ------------------
   83|  2.38k|			f++;
   84|  2.38k|			quad = 1;
   85|  2.38k|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|  2.38k|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 64.6k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 64.6k]
  ------------------
   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|  62.2k|	default:
  ------------------
  |  Branch (114:2): [True: 62.2k, False: 2.38k]
  ------------------
  115|  62.2k|		break;
  116|  64.6k|	}
  117|  64.6k|	if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (117:6): [True: 0, False: 64.6k]
  ------------------
  118|  64.6k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 47.3k, False: 17.2k]
  ------------------
  119|  47.3k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 47.3k]
  ------------------
  120|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  47.3k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 47.3k]
  ------------------
  122|      0|			RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  47.3k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 2.38k, False: 45.0k]
  ------------------
  124|  2.38k|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|  2.38k|#define RETURN(pf,f,r) do { \
  |  |   61|  2.38k|			*(pf) = (f); \
  |  |   62|  2.38k|			return r; \
  |  |   63|  2.38k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  45.0k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  45.0k|#define RETURN(pf,f,r) do { \
  |  |   61|  45.0k|			*(pf) = (f); \
  |  |   62|  45.0k|			return r; \
  |  |   63|  45.0k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|  45.0k|	}
  127|  17.2k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 17.2k]
  ------------------
  128|      0|		if (longdouble)
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|      0|		if (sh)
  ------------------
  |  Branch (130:7): [True: 0, False: 0]
  ------------------
  131|      0|			RETURN(pf,f,FMTCHECK_SHORTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|      0|		if (lg)
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|			RETURN(pf,f,FMTCHECK_LONGPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|      0|		if (quad)
  ------------------
  |  Branch (134:7): [True: 0, False: 0]
  ------------------
  135|      0|			RETURN(pf,f,FMTCHECK_QUADPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  136|      0|		RETURN(pf,f,FMTCHECK_INTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  137|      0|	}
  138|  17.2k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 17.2k]
  ------------------
  139|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (139:7): [True: 0, False: 0]
  ------------------
  140|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  141|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  142|      0|	}
  143|  17.2k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 1.43k, False: 15.8k]
  ------------------
  144|  1.43k|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 1.43k]
  ------------------
  145|      0|			RETURN(pf,f,FMTCHECK_LONGDOUBLE);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  146|  1.43k|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 1.43k]
  ------------------
  147|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  148|  1.43k|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|  1.43k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.43k|			*(pf) = (f); \
  |  |   62|  1.43k|			return r; \
  |  |   63|  1.43k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|  1.43k|	}
  150|  15.8k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 541, False: 15.2k]
  ------------------
  151|    541|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 541]
  ------------------
  152|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|    541|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    541|#define RETURN(pf,f,r) do { \
  |  |   61|    541|			*(pf) = (f); \
  |  |   62|    541|			return r; \
  |  |   63|    541|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|    541|	}
  155|  15.2k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 15.2k, False: 0]
  ------------------
  156|  15.2k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 15.2k]
  ------------------
  157|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  158|  15.2k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  15.2k|#define RETURN(pf,f,r) do { \
  |  |   61|  15.2k|			*(pf) = (f); \
  |  |   62|  15.2k|			return r; \
  |  |   63|  15.2k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|  15.2k|	}
  160|      0|	if (*f == 'p') {
  ------------------
  |  Branch (160:6): [True: 0, False: 0]
  ------------------
  161|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (161:7): [True: 0, False: 0]
  ------------------
  162|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  163|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  164|      0|	}
  165|      0|	RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|       |	/*NOTREACHED*/
  167|      0|}

file_checkfmt:
   95|   276k|{
   96|   276k|	const char *p;
   97|  1.93M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (97:16): [True: 1.66M, False: 276k]
  ------------------
   98|  1.66M|		if (*p != '%')
  ------------------
  |  Branch (98:7): [True: 1.54M, False: 120k]
  ------------------
   99|  1.54M|			continue;
  100|   120k|		if (*++p == '%')
  ------------------
  |  Branch (100:7): [True: 0, False: 120k]
  ------------------
  101|      0|			continue;
  102|       |		// Skip uninteresting.
  103|   127k|		while (strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (103:10): [True: 6.95k, False: 120k]
  ------------------
  104|  6.95k|			p++;
  105|   120k|		if (*p == '*') {
  ------------------
  |  Branch (105:7): [True: 0, False: 120k]
  ------------------
  106|      0|			if (msg)
  ------------------
  |  Branch (106:8): [True: 0, False: 0]
  ------------------
  107|      0|				snprintf(msg, mlen, "* not allowed in format");
  108|      0|			return -1;
  109|      0|		}
  110|       |
  111|   120k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (111:7): [True: 0, False: 120k]
  ------------------
  112|      0|			return -1;
  113|       |
  114|   120k|		if (*p == '.') {
  ------------------
  |  Branch (114:7): [True: 1.92k, False: 118k]
  ------------------
  115|  1.92k|			p++;
  116|  1.92k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (116:8): [True: 0, False: 1.92k]
  ------------------
  117|      0|				return -1;
  118|  1.92k|		}
  119|       |
  120|   120k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (120:7): [True: 0, False: 120k]
  ------------------
  121|      0|			if (msg)
  ------------------
  |  Branch (121:8): [True: 0, False: 0]
  ------------------
  122|      0|				snprintf(msg, mlen, "bad format char: %c", *p);
  123|      0|			return -1;
  124|      0|		}
  125|   120k|	}
  126|   276k|	return 0;
  127|   276k|}
file_vprintf:
  134|   288k|{
  135|   288k|	int len;
  136|   288k|	char *buf, *newstr;
  137|   288k|	char tbuf[1024];
  138|       |
  139|   288k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|   288k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (139:6): [True: 11.8k, False: 276k]
  ------------------
  140|  11.8k|		return 0;
  141|       |
  142|   276k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (142:6): [True: 0, False: 276k]
  ------------------
  143|      0|		file_clearbuf(ms);
  144|      0|		file_error(ms, 0, "Bad magic format `%s' (%s)", fmt, tbuf);
  145|      0|		return -1;
  146|      0|	}
  147|       |
  148|   276k|	len = vasprintf(&buf, fmt, ap);
  149|   276k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (149:6): [True: 0, False: 276k]
  |  Branch (149:17): [True: 95, False: 276k]
  |  Branch (149:39): [True: 0, False: 276k]
  ------------------
  150|     95|		size_t blen = ms->o.blen;
  151|     95|		free(buf);
  152|     95|		file_clearbuf(ms);
  153|     95|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  154|     95|		    SIZE_T_FORMAT "u", len, blen);
  155|     95|		return -1;
  156|     95|	}
  157|       |
  158|   276k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (158:6): [True: 251k, False: 24.8k]
  ------------------
  159|   251k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  160|   251k|		free(buf);
  161|   251k|		if (len < 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 251k]
  ------------------
  162|      0|			goto out;
  163|   251k|		free(ms->o.buf);
  164|   251k|		buf = newstr;
  165|   251k|	}
  166|   276k|	ms->o.buf = buf;
  167|   276k|	ms->o.blen = len;
  168|   276k|	return 0;
  169|      0|out:
  170|      0|	file_clearbuf(ms);
  171|      0|	file_error(ms, errno, "vasprintf failed");
  172|      0|	return -1;
  173|   276k|}
file_printf:
  177|   288k|{
  178|   288k|	int rv;
  179|   288k|	va_list ap;
  180|       |
  181|   288k|	va_start(ap, fmt);
  182|   288k|	rv = file_vprintf(ms, fmt, ap);
  183|   288k|	va_end(ap);
  184|   288k|	return rv;
  185|   288k|}
file_error:
  215|    848|{
  216|    848|	va_list va;
  217|    848|	va_start(va, f);
  218|    848|	file_error_core(ms, error, f, va, 0);
  219|    848|	va_end(va);
  220|    848|}
file_separator:
  259|  46.3k|{
  260|  46.3k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  255|  46.3k|#define FILE_SEPARATOR "\n- "
  ------------------
  261|  46.3k|}
file_default:
  294|  8.12k|{
  295|  8.12k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  8.12k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  8.12k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  8.12k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (295:6): [True: 0, False: 8.12k]
  ------------------
  296|      0|		if ((ms->flags & MAGIC_MIME_TYPE) &&
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (296:7): [True: 0, False: 0]
  ------------------
  297|      0|		    file_printf(ms, "application/%s",
  ------------------
  |  Branch (297:7): [True: 0, False: 0]
  ------------------
  298|      0|			nb ? "octet-stream" : "x-empty") == -1)
  ------------------
  |  Branch (298:4): [True: 0, False: 0]
  ------------------
  299|      0|			return -1;
  300|      0|		return 1;
  301|      0|	}
  302|  8.12k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  8.12k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (302:6): [True: 0, False: 8.12k]
  ------------------
  303|      0|		if (file_printf(ms, "UNKNUNKN") == -1)
  ------------------
  |  Branch (303:7): [True: 0, False: 0]
  ------------------
  304|      0|			return -1;
  305|      0|		return 1;
  306|      0|	}
  307|  8.12k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  8.12k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (307:6): [True: 0, False: 8.12k]
  ------------------
  308|      0|		if (file_printf(ms, "???") == -1)
  ------------------
  |  Branch (308:7): [True: 0, False: 0]
  ------------------
  309|      0|			return -1;
  310|      0|		return 1;
  311|      0|	}
  312|  8.12k|	return 0;
  313|  8.12k|}
file_buffer:
  326|  12.7k|{
  327|  12.7k|	int m = 0, rv = 0, looks_text = 0;
  328|  12.7k|	const char *code = NULL;
  329|  12.7k|	const char *code_mime = "binary";
  330|  12.7k|	const char *def = "data";
  331|  12.7k|	const char *ftype = NULL;
  332|  12.7k|	char *rbuf = NULL;
  333|  12.7k|	struct buffer b;
  334|       |
  335|  12.7k|	buffer_init(&b, fd, st, buf, nb);
  336|  12.7k|	ms->mode = b.st.st_mode;
  337|       |
  338|  12.7k|	if (nb == 0) {
  ------------------
  |  Branch (338:6): [True: 15, False: 12.7k]
  ------------------
  339|     15|		def = "empty";
  340|     15|		goto simple;
  341|  12.7k|	} else if (nb == 1) {
  ------------------
  |  Branch (341:13): [True: 4, False: 12.7k]
  ------------------
  342|      4|		def = "very short file (no magic)";
  343|      4|		goto simple;
  344|      4|	}
  345|       |
  346|  12.7k|	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
  ------------------
  |  |   63|  12.7k|#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
  ------------------
  |  Branch (346:6): [True: 12.7k, False: 0]
  ------------------
  347|  12.7k|		looks_text = file_encoding(ms, &b, NULL, 0,
  348|  12.7k|		    &code, &code_mime, &ftype);
  349|  12.7k|	}
  350|       |
  351|       |#ifdef __EMX__
  352|       |	if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
  353|       |		m = file_os2_apptype(ms, inname, &b);
  354|       |		if ((ms->flags & MAGIC_DEBUG) != 0)
  355|       |			(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
  356|       |		switch (m) {
  357|       |		case -1:
  358|       |			return -1;
  359|       |		case 0:
  360|       |			break;
  361|       |		default:
  362|       |			return 1;
  363|       |		}
  364|       |	}
  365|       |#endif
  366|  12.7k|#if HAVE_FORK
  367|       |	/* try compression stuff */
  368|  12.7k|	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
  ------------------
  |  |   54|  12.7k|#define	MAGIC_NO_CHECK_COMPRESS	0x0001000 /* Don't check for compressed files */
  ------------------
  |  Branch (368:6): [True: 12.7k, False: 0]
  ------------------
  369|  12.7k|		m = file_zmagic(ms, &b, inname);
  370|  12.7k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  12.7k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (370:7): [True: 0, False: 12.7k]
  ------------------
  371|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  372|  12.7k|		if (m) {
  ------------------
  |  Branch (372:7): [True: 2.47k, False: 10.2k]
  ------------------
  373|  2.47k|			goto done_encoding;
  374|  2.47k|		}
  375|  12.7k|	}
  376|  10.2k|#endif
  377|       |	/* Check if we have a tar file */
  378|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  10.2k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (378:6): [True: 10.2k, False: 0]
  ------------------
  379|  10.2k|		m = file_is_tar(ms, &b);
  380|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (380:7): [True: 0, False: 10.2k]
  ------------------
  381|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  382|  10.2k|		if (m) {
  ------------------
  |  Branch (382:7): [True: 16, False: 10.2k]
  ------------------
  383|     16|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (383:8): [True: 0, False: 16]
  ------------------
  384|      0|				goto done;
  385|     16|		}
  386|  10.2k|	}
  387|       |
  388|       |	/* Check if we have a JSON file */
  389|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  10.2k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (389:6): [True: 10.2k, False: 0]
  ------------------
  390|  10.2k|		m = file_is_json(ms, &b);
  391|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (391:7): [True: 0, False: 10.2k]
  ------------------
  392|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  393|  10.2k|		if (m) {
  ------------------
  |  Branch (393:7): [True: 38, False: 10.2k]
  ------------------
  394|     38|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (394:8): [True: 0, False: 38]
  ------------------
  395|      0|				goto done;
  396|     38|		}
  397|  10.2k|	}
  398|       |
  399|       |	/* Check if we have a CSV file */
  400|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  10.2k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (400:6): [True: 10.2k, False: 0]
  ------------------
  401|  10.2k|		m = file_is_csv(ms, &b, looks_text, code);
  402|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (402:7): [True: 0, False: 10.2k]
  ------------------
  403|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  404|  10.2k|		if (m) {
  ------------------
  |  Branch (404:7): [True: 8, False: 10.2k]
  ------------------
  405|      8|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (405:8): [True: 0, False: 8]
  ------------------
  406|      0|				goto done;
  407|      8|		}
  408|  10.2k|	}
  409|       |
  410|       |	/* Check if we have a SIMH tape file */
  411|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_SIMH) == 0) {
  ------------------
  |  |   65|  10.2k|#define MAGIC_NO_CHECK_SIMH	0x0800000 /* Don't check for SIMH tape files */
  ------------------
  |  Branch (411:6): [True: 10.2k, False: 0]
  ------------------
  412|  10.2k|		m = file_is_simh(ms, &b);
  413|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (413:7): [True: 0, False: 10.2k]
  ------------------
  414|      0|			(void)fprintf(stderr, "[try simh %d]\n", m);
  415|  10.2k|		if (m) {
  ------------------
  |  Branch (415:7): [True: 34, False: 10.2k]
  ------------------
  416|     34|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 34]
  ------------------
  417|      0|				goto done;
  418|     34|		}
  419|  10.2k|	}
  420|       |
  421|       |	/* Check if we have a CDF file */
  422|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  10.2k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (422:6): [True: 10.2k, False: 0]
  ------------------
  423|  10.2k|		m = file_trycdf(ms, &b);
  424|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (424:7): [True: 0, False: 10.2k]
  ------------------
  425|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  426|  10.2k|		if (m) {
  ------------------
  |  Branch (426:7): [True: 1.86k, False: 8.39k]
  ------------------
  427|  1.86k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (427:8): [True: 0, False: 1.86k]
  ------------------
  428|      0|				goto done;
  429|  1.86k|		}
  430|  10.2k|	}
  431|  10.2k|#ifdef BUILTIN_ELF
  432|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  10.2k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (432:6): [True: 10.2k, False: 0]
  |  Branch (432:47): [True: 8.80k, False: 1.45k]
  |  Branch (432:57): [True: 0, False: 8.80k]
  ------------------
  433|      0|		file_pushbuf_t *pb;
  434|       |		/*
  435|       |		 * We matched something in the file, so this
  436|       |		 * *might* be an ELF file, and the file is at
  437|       |		 * least 5 bytes long, so if it's an ELF file
  438|       |		 * it has at least one byte past the ELF magic
  439|       |		 * number - try extracting information from the
  440|       |		 * ELF headers that cannot easily be  extracted
  441|       |		 * with rules in the magic file. We we don't
  442|       |		 * print the information yet.
  443|       |		 */
  444|      0|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (444:7): [True: 0, False: 0]
  ------------------
  445|      0|			return -1;
  446|       |
  447|      0|		rv = file_tryelf(ms, &b);
  448|      0|		rbuf = file_pop_buffer(ms, pb);
  449|      0|		if (rv == -1) {
  ------------------
  |  Branch (449:7): [True: 0, False: 0]
  ------------------
  450|      0|			free(rbuf);
  451|      0|			rbuf = NULL;
  452|      0|		}
  453|      0|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (453:7): [True: 0, False: 0]
  ------------------
  454|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  455|      0|	}
  456|  10.2k|#endif
  457|       |
  458|       |	/* try soft magic tests */
  459|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  10.2k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (459:6): [True: 10.2k, False: 0]
  ------------------
  460|  10.2k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  228|  10.2k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  461|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (461:7): [True: 0, False: 10.2k]
  ------------------
  462|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  463|  10.2k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (463:7): [True: 7.17k, False: 3.08k]
  |  Branch (463:17): [True: 0, False: 7.17k]
  ------------------
  464|      0|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (464:8): [True: 0, False: 0]
  ------------------
  465|      0|				goto done;
  466|      0|		}
  467|  10.2k|		if (m) {
  ------------------
  |  Branch (467:7): [True: 7.28k, False: 2.97k]
  ------------------
  468|  7.28k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (468:8): [True: 0, False: 7.28k]
  ------------------
  469|      0|				goto done;
  470|  7.28k|		}
  471|  10.2k|	}
  472|       |
  473|       |	/* try text properties */
  474|  10.2k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  10.2k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (474:6): [True: 10.2k, False: 0]
  ------------------
  475|       |
  476|  10.2k|		m = file_ascmagic(ms, &b, looks_text);
  477|  10.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (477:7): [True: 0, False: 10.2k]
  ------------------
  478|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  479|  10.2k|		if (m) {
  ------------------
  |  Branch (479:7): [True: 2.15k, False: 8.10k]
  ------------------
  480|  2.15k|			goto done;
  481|  2.15k|		}
  482|  10.2k|	}
  483|       |
  484|  8.12k|simple:
  485|       |	/* give up */
  486|  8.12k|	if (m == 0) {
  ------------------
  |  Branch (486:6): [True: 8.12k, False: 0]
  ------------------
  487|  8.12k|		m = 1;
  488|  8.12k|		rv = file_default(ms, nb);
  489|  8.12k|		if (rv == 0)
  ------------------
  |  Branch (489:7): [True: 8.12k, False: 0]
  ------------------
  490|  8.12k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (490:8): [True: 0, False: 8.12k]
  ------------------
  491|      0|				rv = -1;
  492|  8.12k|	}
  493|  10.2k| done:
  494|  10.2k|	trim_separator(ms);
  495|  10.2k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  10.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (495:6): [True: 0, False: 10.2k]
  ------------------
  496|      0|		if (ms->flags & MAGIC_MIME_TYPE)
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (496:7): [True: 0, False: 0]
  ------------------
  497|      0|			if (file_printf(ms, "; charset=") == -1)
  ------------------
  |  Branch (497:8): [True: 0, False: 0]
  ------------------
  498|      0|				rv = -1;
  499|      0|		if (file_printf(ms, "%s", code_mime) == -1)
  ------------------
  |  Branch (499:7): [True: 0, False: 0]
  ------------------
  500|      0|			rv = -1;
  501|      0|	}
  502|  10.2k|#if HAVE_FORK
  503|  12.7k| done_encoding:
  504|  12.7k|#endif
  505|  12.7k|	free(rbuf);
  506|  12.7k|	buffer_fini(&b);
  507|  12.7k|	if (rv)
  ------------------
  |  Branch (507:6): [True: 0, False: 12.7k]
  ------------------
  508|      0|		return rv;
  509|       |
  510|  12.7k|	return m;
  511|  12.7k|}
file_reset:
  516|  7.48k|{
  517|  7.48k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (517:6): [True: 7.48k, False: 2]
  |  Branch (517:21): [True: 0, False: 7.48k]
  ------------------
  518|      0|		file_error(ms, 0, "no magic files loaded");
  519|      0|		return -1;
  520|      0|	}
  521|  7.48k|	file_clearbuf(ms);
  522|  7.48k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (522:6): [True: 7.30k, False: 188]
  ------------------
  523|  7.30k|		free(ms->o.pbuf);
  524|  7.30k|		ms->o.pbuf = NULL;
  525|  7.30k|	}
  526|  7.48k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  479|  7.48k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  527|  7.48k|	ms->error = -1;
  528|  7.48k|	return 0;
  529|  7.48k|}
file_getbuffer:
  541|  7.46k|{
  542|  7.46k|	char *pbuf, *op, *np;
  543|  7.46k|	size_t psize, len;
  544|       |
  545|  7.46k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  7.46k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (545:6): [True: 168, False: 7.30k]
  ------------------
  546|    168|		return NULL;
  547|       |
  548|  7.30k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  7.30k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (548:6): [True: 0, False: 7.30k]
  ------------------
  549|      0|		return ms->o.buf;
  550|       |
  551|  7.30k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (551:6): [True: 0, False: 7.30k]
  ------------------
  552|      0|		return NULL;
  553|       |
  554|       |	/* * 4 is for octal representation, + 1 is for NUL */
  555|  7.30k|	len = strlen(ms->o.buf);
  556|  7.30k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (556:6): [True: 0, False: 7.30k]
  ------------------
  557|      0|		file_oomem(ms, len);
  558|      0|		return NULL;
  559|      0|	}
  560|  7.30k|	psize = len * 4 + 1;
  561|  7.30k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  444|  7.30k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (561:6): [True: 0, False: 7.30k]
  ------------------
  562|      0|		file_oomem(ms, psize);
  563|      0|		return NULL;
  564|      0|	}
  565|  7.30k|	ms->o.pbuf = pbuf;
  566|       |
  567|  7.30k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  568|  7.30k|	{
  569|  7.30k|		mbstate_t state;
  570|  7.30k|		wchar_t nextchar;
  571|  7.30k|		int mb_conv = 1;
  572|  7.30k|		size_t bytesconsumed;
  573|  7.30k|		char *eop;
  574|  7.30k|		(void)memset(&state, 0, sizeof(mbstate_t));
  575|       |
  576|  7.30k|		np = ms->o.pbuf;
  577|  7.30k|		op = ms->o.buf;
  578|  7.30k|		eop = op + len;
  579|       |
  580|  1.46M|		while (op < eop) {
  ------------------
  |  Branch (580:10): [True: 1.45M, False: 7.27k]
  ------------------
  581|  1.45M|			bytesconsumed = mbrtowc(&nextchar, op,
  582|  1.45M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  444|  1.45M|#define CAST(T, b)	((T)(b))
  ------------------
  583|  1.45M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  444|  2.90M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (583:8): [True: 27, False: 1.45M]
  ------------------
  584|  1.45M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  444|  1.45M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (584:8): [True: 0, False: 1.45M]
  ------------------
  585|     27|				mb_conv = 0;
  586|     27|				break;
  587|     27|			}
  588|       |
  589|  1.45M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (589:8): [True: 1.42M, False: 30.5k]
  ------------------
  590|  1.42M|				(void)memcpy(np, op, bytesconsumed);
  591|  1.42M|				op += bytesconsumed;
  592|  1.42M|				np += bytesconsumed;
  593|  1.42M|			} else {
  594|  61.1k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (594:12): [True: 30.5k, False: 30.5k]
  ------------------
  595|  30.5k|					OCTALIFY(np, op);
  ------------------
  |  |  533|  30.5k|	(void)(*(n)++ = '\\', \
  |  |  534|  30.5k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  444|  30.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  535|  30.5k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|  30.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  536|  30.5k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|  30.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  537|  30.5k|	(o)++)
  ------------------
  596|  30.5k|			}
  597|  1.45M|		}
  598|  7.30k|		*np = '\0';
  599|       |
  600|       |		/* Parsing succeeded as a multi-byte sequence */
  601|  7.30k|		if (mb_conv != 0)
  ------------------
  |  Branch (601:7): [True: 7.27k, False: 27]
  ------------------
  602|  7.27k|			return ms->o.pbuf;
  603|  7.30k|	}
  604|     27|#endif
  605|       |
  606|  23.1k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (606:40): [True: 23.1k, False: 27]
  ------------------
  607|  23.1k|		if (isprint(CAST(unsigned char, *op))) {
  608|  22.2k|			*np++ = *op++;
  609|  22.2k|		} else {
  610|    853|			OCTALIFY(np, op);
  ------------------
  |  |  533|    853|	(void)(*(n)++ = '\\', \
  |  |  534|    853|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  444|    853|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  535|    853|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|    853|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  536|    853|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|    853|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  537|    853|	(o)++)
  ------------------
  611|    853|		}
  612|  23.1k|	}
  613|     27|	*np = '\0';
  614|     27|	return ms->o.pbuf;
  615|  7.30k|}
file_check_mem:
  619|   700k|{
  620|   700k|	size_t len;
  621|       |
  622|   700k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (622:6): [True: 1, False: 700k]
  ------------------
  623|      1|		len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
  624|      1|		ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  625|      1|		    malloc(len) :
  626|      1|		    realloc(ms->c.li, len));
  627|      1|		if (ms->c.li == NULL) {
  ------------------
  |  Branch (627:7): [True: 0, False: 1]
  ------------------
  628|      0|			file_oomem(ms, len);
  629|      0|			return -1;
  630|      0|		}
  631|      1|	}
  632|   700k|	ms->c.li[level].got_match = 0;
  633|   700k|#ifdef ENABLE_CONDITIONALS
  634|   700k|	ms->c.li[level].last_match = 0;
  635|   700k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  353|   700k|#define				COND_NONE	0
  ------------------
  636|   700k|#endif /* ENABLE_CONDITIONALS */
  637|   700k|	return 0;
  638|   700k|}
file_printedlen:
  642|  2.15k|{
  643|  2.15k|	return ms->o.blen;
  644|  2.15k|}
file_replace:
  648|  1.37k|{
  649|  1.37k|	file_regex_t rx;
  650|  1.37k|	int rc, rv = -1;
  651|       |
  652|  1.37k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  653|  1.37k|	if (rc == 0) {
  ------------------
  |  Branch (653:6): [True: 1.37k, False: 0]
  ------------------
  654|  1.37k|		regmatch_t rm;
  655|  1.37k|		int nm = 0;
  656|  1.45k|		while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (656:10): [True: 88, False: 1.37k]
  ------------------
  657|     88|			ms->o.buf[rm.rm_so] = '\0';
  658|     88|			if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (658:8): [True: 0, False: 88]
  ------------------
  659|     88|			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (659:8): [True: 88, False: 0]
  ------------------
  660|      0|				goto out;
  661|     88|			nm++;
  662|     88|		}
  663|  1.37k|		rv = nm;
  664|  1.37k|	}
  665|  1.37k|out:
  666|  1.37k|	file_regfree(&rx);
  667|  1.37k|	return rv;
  668|  1.37k|}
file_regcomp:
  721|  26.2k|{
  722|  26.2k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (722:6): [True: 0, False: 26.2k]
  ------------------
  723|      0|		return -1;
  724|       |
  725|  26.2k|#ifdef USE_C_LOCALE
  726|  26.2k|	locale_t old = uselocale(ms->c_lc_ctype);
  727|  26.2k|	assert(old != NULL);
  728|       |#else
  729|       |	char old[1024];
  730|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  731|       |	(void)setlocale(LC_CTYPE, "C");
  732|       |#endif
  733|  26.2k|	int rc;
  734|  26.2k|	rc = regcomp(rx, pat, flags);
  735|       |
  736|  26.2k|#ifdef USE_C_LOCALE
  737|  26.2k|	uselocale(old);
  738|       |#else
  739|       |	(void)setlocale(LC_CTYPE, old);
  740|       |#endif
  741|  26.2k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (741:6): [True: 0, False: 26.2k]
  |  Branch (741:16): [True: 0, False: 0]
  ------------------
  742|      0|		char errmsg[512], buf[512];
  743|       |
  744|      0|		(void)regerror(rc, rx, errmsg, sizeof(errmsg));
  745|      0|		file_magerror(ms, "regex error %d for `%s', (%s)", rc, 
  746|      0|		    file_printable(ms, buf, sizeof(buf), pat, strlen(pat)),
  747|      0|		    errmsg);
  748|      0|	}
  749|  26.2k|	return rc;
  750|  26.2k|}
file_regexec:
  756|   240k|{
  757|   240k|#ifdef USE_C_LOCALE
  758|   240k|	locale_t old = uselocale(ms->c_lc_ctype);
  759|   240k|	assert(old != NULL);
  760|       |#else
  761|       |	char old[1024];
  762|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  763|       |	(void)setlocale(LC_CTYPE, "C");
  764|       |#endif
  765|   240k|	int rc;
  766|       |	/* XXX: force initialization because glibc does not always do this */
  767|   240k|	if (nmatch != 0)
  ------------------
  |  Branch (767:6): [True: 215k, False: 24.6k]
  ------------------
  768|   215k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  769|   240k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  770|   240k|#ifdef USE_C_LOCALE
  771|   240k|	uselocale(old);
  772|       |#else
  773|       |	(void)setlocale(LC_CTYPE, old);
  774|       |#endif
  775|   240k|	return rc;
  776|   240k|}
file_regfree:
  780|  26.0k|{
  781|  26.0k|	regfree(rx);
  782|  26.0k|}
file_push_buffer:
  786|  21.2k|{
  787|  21.2k|	file_pushbuf_t *pb;
  788|       |
  789|  21.2k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  21.2k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (789:6): [True: 1.15k, False: 20.0k]
  ------------------
  790|  1.15k|		return NULL;
  791|       |
  792|  20.0k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  444|  20.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (792:6): [True: 0, False: 20.0k]
  ------------------
  793|      0|		return NULL;
  794|       |
  795|  20.0k|	pb->buf = ms->o.buf;
  796|  20.0k|	pb->blen = ms->o.blen;
  797|  20.0k|	pb->offset = ms->offset;
  798|       |
  799|  20.0k|	ms->o.buf = NULL;
  800|  20.0k|	ms->o.blen = 0;
  801|  20.0k|	ms->offset = 0;
  802|       |
  803|  20.0k|	return pb;
  804|  20.0k|}
file_pop_buffer:
  808|  20.0k|{
  809|  20.0k|	char *rbuf;
  810|       |
  811|  20.0k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  479|  20.0k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (811:6): [True: 1.27k, False: 18.7k]
  ------------------
  812|  1.27k|		free(pb->buf);
  813|  1.27k|		free(pb);
  814|  1.27k|		return NULL;
  815|  1.27k|	}
  816|       |
  817|  18.7k|	rbuf = ms->o.buf;
  818|       |
  819|  18.7k|	ms->o.buf = pb->buf;
  820|  18.7k|	ms->o.blen = pb->blen;
  821|  18.7k|	ms->offset = pb->offset;
  822|       |
  823|  18.7k|	free(pb);
  824|  18.7k|	return rbuf;
  825|  20.0k|}
file_printable:
  833|  38.2k|{
  834|  38.2k|	char *ptr, *eptr = buf + bufsiz - 1;
  835|  38.2k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  445|  38.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  836|  38.2k|	const unsigned char *es = s + slen;
  837|       |
  838|   235k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (838:19): [True: 234k, False: 69]
  |  Branch (838:33): [True: 234k, False: 528]
  |  Branch (838:43): [True: 196k, False: 37.5k]
  ------------------
  839|   196k|		if ((ms->flags & MAGIC_RAW) != 0 || isprint(*s)) {
  ------------------
  |  |   41|   196k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (839:7): [True: 0, False: 196k]
  ------------------
  840|   115k|			*ptr++ = *s;
  841|   115k|			continue;
  842|   115k|		}
  843|  81.3k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (843:7): [True: 67, False: 81.2k]
  ------------------
  844|     67|			break;
  845|  81.2k|		*ptr++ = '\\';
  846|  81.2k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  444|  81.2k|#define CAST(T, b)	((T)(b))
  ------------------
  847|  81.2k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  444|  81.2k|#define CAST(T, b)	((T)(b))
  ------------------
  848|  81.2k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  444|  81.2k|#define CAST(T, b)	((T)(b))
  ------------------
  849|  81.2k|	}
  850|  38.2k|	*ptr = '\0';
  851|  38.2k|	return buf;
  852|  38.2k|}
file_print_guid:
  888|    313|{
  889|    313|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  444|    313|#define CAST(T, b)	((T)(b))
  ------------------
  890|    313|	    CAST(const void *, guid));
  891|       |
  892|    313|#ifndef WIN32
  893|    313|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  894|    313|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  895|    313|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  896|    313|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  897|    313|	    g->data4[6], g->data4[7]);
  898|       |#else
  899|       |	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hX%.2hX-"
  900|       |	    "%.2hX%.2hX%.2hX%.2hX%.2hX%.2hX",
  901|       |	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  902|       |	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  903|       |	    g->data4[6], g->data4[7]);
  904|       |#endif
  905|    313|}
file_pipe_closexec:
  909|  8.13k|{
  910|       |#ifdef __MINGW32__
  911|       |	return 0;
  912|       |#elif defined(HAVE_PIPE2)
  913|  8.13k|	return pipe2(fds, O_CLOEXEC);
  914|       |#else
  915|       |	if (pipe(fds) == -1)
  916|       |		return -1;
  917|       |# ifdef F_SETFD
  918|       |	(void)fcntl(fds[0], F_SETFD, FD_CLOEXEC);
  919|       |	(void)fcntl(fds[1], F_SETFD, FD_CLOEXEC);
  920|       |# endif
  921|       |	return 0;
  922|       |#endif
  923|  8.13k|}
file_clear_closexec:
  926|  8.13k|file_clear_closexec(int fd) {
  927|  8.13k|#ifdef F_SETFD
  928|  8.13k|	return fcntl(fd, F_SETFD, 0);
  929|       |#else
  930|       |	return 0;
  931|       |#endif
  932|  8.13k|}
file_strtrim:
  936|    290|{
  937|    290|	char *last;
  938|       |
  939|    290|	while (isspace(CAST(unsigned char, *str)))
  940|    346|		str++;
  941|    290|	last = str;
  942|  2.91k|	while (*last)
  ------------------
  |  Branch (942:9): [True: 2.62k, False: 290]
  ------------------
  943|  2.62k|		last++;
  944|    290|	--last;
  945|    290|	while (isspace(CAST(unsigned char, *last)))
  946|    557|		last--;
  947|    290|	*++last = '\0';
  948|    290|	return str;
  949|    290|}
funcs.c:file_checkfield:
   76|   122k|{
   77|   122k|	const char *p = *pp;
   78|   122k|	int fw = 0;
   79|       |
   80|   128k|	while (*p && isdigit((unsigned char)*p))
  ------------------
  |  Branch (80:9): [True: 128k, False: 0]
  ------------------
   81|  5.86k|		fw = fw * 10 + (*p++ - '0');
   82|       |
   83|   122k|	*pp = p;
   84|       |
   85|   122k|	if (fw < 1024)
  ------------------
  |  Branch (85:6): [True: 122k, False: 0]
  ------------------
   86|   122k|		return 1;
   87|      0|	if (msg)
  ------------------
  |  Branch (87:6): [True: 0, False: 0]
  ------------------
   88|      0|		snprintf(msg, mlen, "field %s too large: %d", what, fw);
   89|       |
   90|      0|	return 0;
   91|   122k|}
funcs.c:file_clearbuf:
   68|  7.58k|{
   69|  7.58k|	free(ms->o.buf);
   70|  7.58k|	ms->o.buf = NULL;
   71|  7.58k|	ms->o.blen = 0;
   72|  7.58k|}
funcs.c:file_error_core:
  195|    848|{
  196|       |	/* Only the first error is ok */
  197|    848|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|    848|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (197:6): [True: 663, False: 185]
  ------------------
  198|    663|		return;
  199|    185|	if (lineno != 0) {
  ------------------
  |  Branch (199:6): [True: 0, False: 185]
  ------------------
  200|      0|		file_clearbuf(ms);
  201|      0|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  202|      0|	}
  203|    185|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (203:6): [True: 4, False: 181]
  |  Branch (203:19): [True: 4, False: 0]
  ------------------
  204|      4|		(void)file_printf(ms, " ");
  205|    185|	(void)file_vprintf(ms, f, va);
  206|    185|	if (error > 0)
  ------------------
  |  Branch (206:6): [True: 0, False: 185]
  ------------------
  207|      0|		(void)file_printf(ms, " (%s)", strerror(error));
  208|    185|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  479|    185|#define 		EVENT_HAD_ERR		0x01
  ------------------
  209|    185|	ms->error = error;
  210|    185|}
funcs.c:checkdone:
  284|  9.24k|{
  285|  9.24k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  9.24k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (285:6): [True: 0, False: 9.24k]
  ------------------
  286|      0|		return 1;
  287|  9.24k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (287:6): [True: 0, False: 9.24k]
  ------------------
  288|      0|		*rv = -1;
  289|  9.24k|	return 0;
  290|  9.24k|}
funcs.c:trim_separator:
  265|  10.2k|{
  266|  10.2k|	size_t l;
  267|       |
  268|  10.2k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (268:6): [True: 0, False: 10.2k]
  ------------------
  269|      0|		return;
  270|       |
  271|  10.2k|	l = strlen(ms->o.buf);
  272|  10.2k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  255|  10.2k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (272:6): [True: 0, False: 10.2k]
  ------------------
  273|      0|		return;
  274|       |
  275|  10.2k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  255|  10.2k|#define FILE_SEPARATOR "\n- "
  ------------------
  276|  10.2k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  255|  10.2k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (276:6): [True: 10.2k, False: 0]
  ------------------
  277|  10.2k|		return;
  278|       |
  279|      0|	ms->o.buf[l] = '\0';
  280|      0|}
funcs.c:check_regex:
  672|  26.2k|{
  673|  26.2k|	char sbuf[512];
  674|  26.2k|	unsigned char oc = '\0';
  675|  26.2k|	const char *p;
  676|  26.2k|	unsigned long l;
  677|       |
  678|   317k|	for (p = pat; *p; p++) {
  ------------------
  |  Branch (678:16): [True: 290k, False: 26.2k]
  ------------------
  679|   290k|		unsigned char c = *p;
  680|       |		// Avoid repetition
  681|   290k|		if (c == oc && strchr("?*+{", c) != NULL) {
  ------------------
  |  Branch (681:7): [True: 138, False: 290k]
  |  Branch (681:18): [True: 0, False: 138]
  ------------------
  682|      0|			size_t len = strlen(pat);
  683|      0|			file_magwarn(ms,
  684|      0|			    "repetition-operator operand `%c' "
  685|      0|			    "invalid in regex `%s'", c,
  686|      0|			    file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  687|      0|			return -1;
  688|      0|		}
  689|   290k|		if (c == '{') {
  ------------------
  |  Branch (689:7): [True: 65, False: 290k]
  ------------------
  690|     65|			char *ep, *eep;
  691|     65|			errno = 0;
  692|     65|			l = strtoul(p + 1, &ep, 10);
  693|     65|			if (ep != p + 1 && l > 1000)
  ------------------
  |  Branch (693:8): [True: 42, False: 23]
  |  Branch (693:23): [True: 0, False: 42]
  ------------------
  694|      0|				goto bounds;
  695|       |
  696|     65|			if (*ep == ',') {
  ------------------
  |  Branch (696:8): [True: 27, False: 38]
  ------------------
  697|     27|				l = strtoul(ep + 1, &eep, 10);
  698|     27|				if (eep != ep + 1 && l > 1000)
  ------------------
  |  Branch (698:9): [True: 27, False: 0]
  |  Branch (698:26): [True: 0, False: 27]
  ------------------
  699|      0|					goto bounds;
  700|     27|			}
  701|     65|		}
  702|   290k|		oc = c;
  703|   290k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (703:35): [True: 4, False: 1]
  ------------------
  704|   290k|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (704:10): [True: 1, False: 0]
  ------------------
  705|   290k|			continue;
  706|      0|		size_t len = strlen(pat);
  707|      0|		file_magwarn(ms,
  708|      0|		    "non-ascii characters in regex \\%#o `%s'",
  709|      0|		    c, file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  710|      0|		return -1;
  711|   290k|	}
  712|  26.2k|	return 0;
  713|      0|bounds:
  714|      0|	file_magwarn(ms, "bounds too large %ld in regex `%s'", l, pat);
  715|      0|	return -1;
  716|  26.2k|}

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

file_is_json:
  423|  10.2k|{
  424|  10.2k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.2k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  10.2k|	const unsigned char *ue = uc + b->flen;
  426|  10.2k|	size_t st[JSON_MAX];
  427|  10.2k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  10.2k|	int jt;
  429|       |
  430|       |
  431|  10.2k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  10.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  10.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 10.2k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  10.2k|	memset(st, 0, sizeof(st));
  435|       |
  436|  10.2k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 10.2k, False: 38]
  ------------------
  437|  10.2k|		return 0;
  438|       |
  439|     38|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     38|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 38]
  ------------------
  440|      0|		return 1;
  441|     38|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 38]
  ------------------
  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|     38|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 38]
  ------------------
  448|     38|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 27, False: 11]
  ------------------
  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|     38|	return 1;
  462|     38|}
is_json.c:json_parse:
  348|  18.0k|{
  349|  18.0k|	const unsigned char *uc, *ouc;
  350|  18.0k|	int rv = 0;
  351|  18.0k|	int t;
  352|       |
  353|  18.0k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  18.0k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 93, False: 17.9k]
  ------------------
  355|     93|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  17.9k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 2, False: 17.9k]
  ------------------
  359|      2|		DPRINTF("Too many levels", uc, *ucp);
  ------------------
  |  |   52|      2|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|      2|		return 0;
  361|      2|	}
  362|       |#if JSON_COUNT
  363|       |	/* bail quickly if not counting */
  364|       |	if (lvl > 1 && (st[JSON_OBJECT] || st[JSON_ARRAYN]))
  365|       |		return 1;
  366|       |#endif
  367|       |
  368|  17.9k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  17.9k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|  17.9k|	switch (*uc++) {
  370|    778|	case '"':
  ------------------
  |  Branch (370:2): [True: 778, False: 17.1k]
  ------------------
  371|    778|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    778|		t = JSON_STRING;
  ------------------
  |  |   60|    778|#define JSON_STRING	4
  ------------------
  373|    778|		break;
  374|  4.30k|	case '[':
  ------------------
  |  Branch (374:2): [True: 4.30k, False: 13.6k]
  ------------------
  375|  4.30k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  4.30k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  4.30k|#define JSON_ARRAY	0
  ------------------
  377|  4.30k|		break;
  378|    667|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 667, False: 17.2k]
  ------------------
  379|    667|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    667|		t = JSON_OBJECT;
  ------------------
  |  |   59|    667|#define JSON_OBJECT	3
  ------------------
  381|    667|		break;
  382|    334|	case 't':
  ------------------
  |  Branch (382:2): [True: 334, False: 17.6k]
  ------------------
  383|    334|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    334|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    334|#define JSON_CONSTANT	1
  ------------------
  385|    334|		break;
  386|    255|	case 'f':
  ------------------
  |  Branch (386:2): [True: 255, False: 17.7k]
  ------------------
  387|    255|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    255|		    lvl + 1);
  389|    255|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    255|#define JSON_CONSTANT	1
  ------------------
  390|    255|		break;
  391|    283|	case 'n':
  ------------------
  |  Branch (391:2): [True: 283, False: 17.6k]
  ------------------
  392|    283|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    283|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    283|#define JSON_CONSTANT	1
  ------------------
  394|    283|		break;
  395|  11.3k|	default:
  ------------------
  |  Branch (395:2): [True: 11.3k, False: 6.62k]
  ------------------
  396|  11.3k|		--uc;
  397|  11.3k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  11.3k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  11.3k|#define JSON_NUMBER	2
  ------------------
  399|  11.3k|		break;
  400|  17.9k|	}
  401|  17.9k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 4.62k, False: 13.3k]
  ------------------
  402|  4.62k|		st[t]++;
  403|  17.9k|	uc = json_skip_space(uc, ue);
  404|  18.0k|out:
  405|  18.0k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  18.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  406|  18.0k|	*ucp = uc;
  407|  18.0k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 10.2k, False: 7.78k]
  ------------------
  408|  10.2k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 9.89k, False: 367]
  ------------------
  409|  9.89k|			return 0;
  410|    367|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 105, False: 262]
  ------------------
  411|    105|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|    105|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     85|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 20, False: 85]
  |  Branch (411:31): [True: 7, False: 78]
  ------------------
  412|    262|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 54, False: 208]
  |  Branch (412:22): [True: 43, False: 11]
  ------------------
  413|     43|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     43|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     36|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 7, False: 36]
  |  Branch (413:31): [True: 4, False: 32]
  ------------------
  414|    219|		else
  415|    219|			return 0;
  416|    262|	}
  417|  7.78k|	return rv;
  418|  18.0k|}
is_json.c:json_skip_space:
  119|  44.9k|{
  120|   113M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 113M, False: 3.26k]
  |  Branch (120:20): [True: 113M, False: 41.6k]
  ------------------
  121|   113M|		uc++;
  122|  44.9k|	return uc;
  123|  44.9k|}
is_json.c:json_isspace:
   79|   113M|{
   80|   113M|	switch (uc) {
   81|   250k|	case ' ':
  ------------------
  |  Branch (81:2): [True: 250k, False: 113M]
  ------------------
   82|  53.2M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 52.9M, False: 60.8M]
  ------------------
   83|   110M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 56.8M, False: 56.9M]
  ------------------
   84|   113M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 3.66M, False: 110M]
  ------------------
   85|   113M|		return 1;
   86|  41.6k|	default:
  ------------------
  |  Branch (86:2): [True: 41.6k, False: 113M]
  ------------------
   87|  41.6k|		return 0;
   88|   113M|	}
   89|   113M|}
is_json.c:json_parse_string:
  129|  1.39k|{
  130|  1.39k|	const unsigned char *uc = *ucp;
  131|  1.39k|	size_t i;
  132|       |
  133|  1.39k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  1.39k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|  65.7M|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 65.7M, False: 106]
  ------------------
  135|  65.7M|		switch (*uc++) {
  136|      9|		case '\0':
  ------------------
  |  Branch (136:3): [True: 9, False: 65.7M]
  ------------------
  137|      9|			goto out;
  138|  21.0M|		case '\\':
  ------------------
  |  Branch (138:3): [True: 21.0M, False: 44.7M]
  ------------------
  139|  21.0M|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 9, False: 21.0M]
  ------------------
  140|      9|				goto out;
  141|  21.0M|			switch (*uc++) {
  142|      0|			case '\0':
  ------------------
  |  Branch (142:4): [True: 0, False: 21.0M]
  ------------------
  143|      0|				goto out;
  144|  3.37M|			case '"':
  ------------------
  |  Branch (144:4): [True: 3.37M, False: 17.6M]
  ------------------
  145|  10.2M|			case '\\':
  ------------------
  |  Branch (145:4): [True: 6.91M, False: 14.1M]
  ------------------
  146|  11.2M|			case '/':
  ------------------
  |  Branch (146:4): [True: 977k, False: 20.0M]
  ------------------
  147|  13.7M|			case 'b':
  ------------------
  |  Branch (147:4): [True: 2.49M, False: 18.5M]
  ------------------
  148|  15.1M|			case 'f':
  ------------------
  |  Branch (148:4): [True: 1.35M, False: 19.6M]
  ------------------
  149|  17.1M|			case 'n':
  ------------------
  |  Branch (149:4): [True: 2.04M, False: 18.9M]
  ------------------
  150|  18.6M|			case 'r':
  ------------------
  |  Branch (150:4): [True: 1.51M, False: 19.5M]
  ------------------
  151|  19.4M|			case 't':
  ------------------
  |  Branch (151:4): [True: 816k, False: 20.2M]
  ------------------
  152|  19.4M|				continue;
  153|  1.55M|			case 'u':
  ------------------
  |  Branch (153:4): [True: 1.55M, False: 19.4M]
  ------------------
  154|  1.55M|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 9, False: 1.55M]
  ------------------
  155|      9|					uc = ue;
  156|      9|					goto out;
  157|      9|				}
  158|  7.76M|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 6.20M, False: 1.55M]
  ------------------
  159|  6.20M|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 30, False: 6.20M]
  ------------------
  160|     30|						goto out;
  161|  1.55M|				continue;
  162|  1.55M|			default:
  ------------------
  |  Branch (162:4): [True: 7, False: 21.0M]
  ------------------
  163|      7|				goto out;
  164|  21.0M|			}
  165|  1.22k|		case '"':
  ------------------
  |  Branch (165:3): [True: 1.22k, False: 65.7M]
  ------------------
  166|  1.22k|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|  1.22k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|  1.22k|			*ucp = uc;
  168|  1.22k|			return 1;
  169|  44.7M|		default:
  ------------------
  |  Branch (169:3): [True: 44.7M, False: 21.0M]
  ------------------
  170|  44.7M|			continue;
  171|  65.7M|		}
  172|  65.7M|	}
  173|    170|out:
  174|    170|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    170|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|    170|	*ucp = uc;
  176|    170|	return 0;
  177|  1.39k|}
is_json.c:json_isxdigit:
  105|  6.20M|{
  106|  6.20M|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 2.14M, False: 4.06M]
  ------------------
  107|  2.14M|		return 1;
  108|  4.06M|	switch (uc) {
  109|  3.23M|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 1.31M, False: 2.74M]
  |  Branch (109:12): [True: 149k, False: 3.91M]
  |  Branch (109:22): [True: 1.18M, False: 2.87M]
  |  Branch (109:32): [True: 235k, False: 3.83M]
  |  Branch (109:42): [True: 340k, False: 3.72M]
  |  Branch (109:52): [True: 2, False: 4.06M]
  ------------------
  110|  4.06M|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 117k, False: 3.94M]
  |  Branch (110:12): [True: 4, False: 4.06M]
  |  Branch (110:22): [True: 12, False: 4.06M]
  |  Branch (110:32): [True: 12, False: 4.06M]
  |  Branch (110:42): [True: 353k, False: 3.71M]
  |  Branch (110:52): [True: 363k, False: 3.70M]
  ------------------
  111|  4.06M|		return 1;
  112|     30|	default:
  ------------------
  |  Branch (112:2): [True: 30, False: 4.06M]
  ------------------
  113|     30|		return 0;
  114|  4.06M|	}
  115|  4.06M|}
is_json.c:json_isdigit:
   93|  14.3M|{
   94|  14.3M|	switch (uc) {
   95|  10.1M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 9.03M, False: 5.32M]
  |  Branch (95:12): [True: 1.11M, False: 13.2M]
  |  Branch (95:22): [True: 243, False: 14.3M]
  |  Branch (95:32): [True: 32.5k, False: 14.3M]
  |  Branch (95:42): [True: 77, False: 14.3M]
  ------------------
   96|  10.2M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 16.4k, False: 14.3M]
  |  Branch (96:12): [True: 41.5k, False: 14.3M]
  |  Branch (96:22): [True: 130, False: 14.3M]
  |  Branch (96:32): [True: 31.6k, False: 14.3M]
  |  Branch (96:42): [True: 139, False: 14.3M]
  ------------------
   97|  10.2M|		return 1;
   98|  4.08M|	default:
  ------------------
  |  Branch (98:2): [True: 4.08M, False: 10.2M]
  ------------------
   99|  4.08M|		return 0;
  100|  14.3M|	}
  101|  14.3M|}
is_json.c:json_parse_array:
  182|  4.30k|{
  183|  4.30k|	const unsigned char *uc = *ucp;
  184|       |
  185|  4.30k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  4.30k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  7.47k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 7.42k, False: 45]
  ------------------
  187|  7.42k|		uc = json_skip_space(uc, ue);
  188|  7.42k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 11, False: 7.41k]
  ------------------
  189|     11|			goto out;
  190|  7.41k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 268, False: 7.14k]
  ------------------
  191|    268|			goto done;
  192|  7.14k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 3.32k, False: 3.82k]
  ------------------
  193|  3.32k|			goto out;
  194|  3.82k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 45, False: 3.77k]
  ------------------
  195|     45|			goto out;
  196|  3.77k|		switch (*uc) {
  197|  3.16k|		case ',':
  ------------------
  |  Branch (197:3): [True: 3.16k, False: 611]
  ------------------
  198|  3.16k|			uc++;
  199|  3.16k|			continue;
  200|    597|		case ']':
  ------------------
  |  Branch (200:3): [True: 597, False: 3.18k]
  ------------------
  201|    865|		done:
  202|    865|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    865|#define JSON_ARRAYN	5
  ------------------
  203|    865|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    865|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  204|    865|			*ucp = uc + 1;
  205|    865|			return 1;
  206|     14|		default:
  ------------------
  |  Branch (206:3): [True: 14, False: 3.76k]
  ------------------
  207|     14|			goto out;
  208|  3.77k|		}
  209|  3.77k|	}
  210|  3.43k|out:
  211|  3.43k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  3.43k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  212|  3.43k|	*ucp = uc;
  213|  3.43k|	return 0;
  214|  4.30k|}
is_json.c:json_parse_object:
  219|    667|{
  220|    667|	const unsigned char *uc = *ucp;
  221|    667|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    667|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  222|    864|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 857, False: 7]
  ------------------
  223|    857|		uc = json_skip_space(uc, ue);
  224|    857|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 12, False: 845]
  ------------------
  225|     12|			goto out;
  226|    845|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 201, False: 644]
  ------------------
  227|    201|			uc++;
  228|    201|			goto done;
  229|    201|		}
  230|    644|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 31, False: 613]
  ------------------
  231|     31|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     31|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|     31|			goto out;
  233|     31|		}
  234|    613|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    613|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  235|    613|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 3, False: 610]
  ------------------
  236|      3|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      3|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  237|      3|			goto out;
  238|      3|		}
  239|    610|		uc = json_skip_space(uc, ue);
  240|    610|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 12, False: 598]
  ------------------
  241|     12|			goto out;
  242|    598|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 9, False: 589]
  ------------------
  243|      9|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|      9|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  244|      9|			goto out;
  245|      9|		}
  246|    589|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 195, False: 394]
  ------------------
  247|    195|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    195|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|    195|			goto out;
  249|    195|		}
  250|    394|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 1, False: 393]
  ------------------
  251|      1|			goto out;
  252|    393|		switch (*uc++) {
  253|    197|		case ',':
  ------------------
  |  Branch (253:3): [True: 197, False: 196]
  ------------------
  254|    197|			continue;
  255|    195|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 195, False: 198]
  ------------------
  256|    396|		done:
  257|    396|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    396|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|    396|			*ucp = uc;
  259|    396|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 392]
  ------------------
  261|      1|			DPRINTF("not more", uc, *ucp);
  ------------------
  |  |   52|      1|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  262|      1|			*ucp = uc - 1;
  263|      1|			goto out;
  264|    393|		}
  265|    393|	}
  266|    271|out:
  267|    271|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    271|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  268|    271|	*ucp = uc;
  269|    271|	return 0;
  270|    667|}
is_json.c:json_parse_const:
  328|    872|{
  329|    872|	const unsigned char *uc = *ucp;
  330|       |
  331|    872|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|    872|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  332|    872|	*ucp += --len - 1;
  333|    872|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 47, False: 825]
  ------------------
  334|     47|		*ucp = ue;
  335|  3.45k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 3.41k, False: 42]
  |  Branch (335:20): [True: 2.65k, False: 759]
  ------------------
  336|  2.65k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 71, False: 2.58k]
  ------------------
  337|     71|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     71|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  338|     71|			return 0;
  339|     71|		}
  340|  2.65k|	}
  341|    801|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|    801|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  342|    801|	return 1;
  343|    872|}
is_json.c:json_parse_number:
  276|  11.3k|{
  277|  11.3k|	const unsigned char *uc = *ucp;
  278|  11.3k|	int got = 0;
  279|       |
  280|  11.3k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  11.3k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|  11.3k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 11.3k]
  ------------------
  282|      0|		return 0;
  283|  11.3k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 208, False: 11.1k]
  ------------------
  284|    208|		uc++;
  285|       |
  286|  8.14M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 8.14M, False: 44]
  ------------------
  287|  8.14M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 11.2k, False: 8.13M]
  ------------------
  288|  11.2k|			break;
  289|  8.13M|		got = 1;
  290|  8.13M|	}
  291|  11.3k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 44, False: 11.2k]
  ------------------
  292|     44|		goto out;
  293|  11.2k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 299, False: 10.9k]
  ------------------
  294|    299|		uc++;
  295|  11.9k|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 11.8k, False: 28]
  ------------------
  296|  11.8k|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 11.2k, False: 624]
  ------------------
  297|  11.2k|			break;
  298|    624|		got = 1;
  299|    624|	}
  300|  11.2k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 28, False: 11.2k]
  ------------------
  301|     28|		goto out;
  302|  11.2k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 1.94k, False: 9.32k]
  |  Branch (302:14): [True: 592, False: 1.35k]
  |  Branch (302:28): [True: 238, False: 1.11k]
  ------------------
  303|    830|		uc++;
  304|    830|		got = 0;
  305|    830|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 10, False: 820]
  ------------------
  306|     10|			goto out;
  307|    820|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 197, False: 623]
  |  Branch (307:21): [True: 194, False: 429]
  ------------------
  308|    391|			uc++;
  309|  1.83k|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 1.79k, False: 35]
  ------------------
  310|  1.79k|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 785, False: 1.01k]
  ------------------
  311|    785|				break;
  312|  1.01k|			got = 1;
  313|  1.01k|		}
  314|    820|	}
  315|  11.3k|out:
  316|  11.3k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 9.38k, False: 1.95k]
  ------------------
  317|  9.38k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  9.38k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  1.95k|	else
  319|  1.95k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  1.95k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|  11.3k|	*ucp = uc;
  321|  11.3k|	return got;
  322|  11.2k|}

file_is_simh:
  150|  10.2k|{
  151|  10.2k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.2k|#define CAST(T, b)	((T)(b))
  ------------------
  152|  10.2k|	const unsigned char *ue = uc + b->flen;
  153|  10.2k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  154|       |
  155|  10.2k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  10.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  10.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (155:6): [True: 0, False: 10.2k]
  ------------------
  156|      0|		return 0;
  157|       |
  158|  10.2k|	if (!simh_parse(uc, ue))
  ------------------
  |  Branch (158:6): [True: 10.2k, False: 34]
  ------------------
  159|  10.2k|		return 0;
  160|       |
  161|     34|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     34|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (161:6): [True: 0, False: 34]
  ------------------
  162|      0|		return 1;
  163|       |
  164|     34|	if (mime) {
  ------------------
  |  Branch (164:6): [True: 0, False: 34]
  ------------------
  165|      0|		if (file_printf(ms, "application/SIMH-tape-data") == -1)
  ------------------
  |  Branch (165:7): [True: 0, False: 0]
  ------------------
  166|      0|			return -1;
  167|      0|		return 1;
  168|      0|	}
  169|       |
  170|     34|	if (file_printf(ms, "SIMH tape data") == -1)
  ------------------
  |  Branch (170:6): [True: 0, False: 34]
  ------------------
  171|      0|		return -1;
  172|       |
  173|     34|	return 1;
  174|     34|}
is_simh.c:simh_parse:
  111|  10.2k|{
  112|  10.2k|	uint32_t nbytes, cbytes;
  113|  10.2k|	const unsigned char *orig_uc = uc;
  114|  10.2k|	size_t nt = 0, nr = 0;
  115|       |
  116|  10.2k|	(void)memcpy(simh_bo.s, "\01\02\03\04", 4);
  117|       |
  118|   119k|	while (ue - uc >= CAST(ptrdiff_t, sizeof(nbytes))) {
  ------------------
  |  |  444|   119k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (118:9): [True: 118k, False: 711]
  ------------------
  119|   118k|		nbytes = getlen(&uc);
  120|   118k|		if ((nt > 0 || nr > 0) && nbytes == 0xFFFFFFFF)
  ------------------
  |  Branch (120:8): [True: 50.8k, False: 67.6k]
  |  Branch (120:18): [True: 58.0k, False: 9.58k]
  |  Branch (120:29): [True: 3, False: 108k]
  ------------------
  121|       |			/* EOM after at least one record or tapemark */
  122|      3|			break;
  123|   118k|		if (nbytes == 0) {
  ------------------
  |  Branch (123:7): [True: 1.27k, False: 117k]
  ------------------
  124|  1.27k|			nt++;	/* count tapemarks */
  125|  1.27k|#if SIMH_TAPEMARKS
  126|  1.27k|			if (nt == SIMH_TAPEMARKS)
  ------------------
  |  |   65|  1.27k|#define SIMH_TAPEMARKS 10
  ------------------
  |  Branch (126:8): [True: 116, False: 1.15k]
  ------------------
  127|    116|				break;
  128|  1.15k|#endif
  129|  1.15k|			continue;
  130|  1.27k|		}
  131|       |		/* handle a data record */
  132|   117k|		uc += nbytes;
  133|   117k|		if (ue - uc < CAST(ptrdiff_t, sizeof(nbytes)))
  ------------------
  |  |  444|   117k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (133:7): [True: 9.21k, False: 107k]
  ------------------
  134|  9.21k|			break;
  135|   107k|		cbytes = getlen(&uc);
  136|   107k|		if (nbytes != cbytes)
  ------------------
  |  Branch (136:7): [True: 224, False: 107k]
  ------------------
  137|    224|			return 0;
  138|   107k|		nr++;
  139|   107k|	}
  140|  10.0k|	if (nt * sizeof(uint32_t) == CAST(size_t, uc - orig_uc))
  ------------------
  |  |  444|  10.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (140:6): [True: 819, False: 9.22k]
  ------------------
  141|    819|		return 0;	/* All examined data was tapemarks (0) */
  142|  9.22k|	if (nr == 0)		/* No records */
  ------------------
  |  Branch (142:6): [True: 9.18k, False: 34]
  ------------------
  143|  9.18k|		return 0;
  144|     34|	return 1;
  145|  9.22k|}
is_simh.c:getlen:
   95|   226k|{
   96|   226k|	uint32_t n;
   97|   226k|	memcpy(&n, *uc, sizeof(n));
   98|   226k|	*uc += sizeof(n);
   99|   226k|	if (NEED_SWAP)
  ------------------
  |  |   75|   226k|#define NEED_SWAP	(simh_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  444|   226k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (75:19): [True: 0, False: 226k]
  |  |  ------------------
  ------------------
  100|      0|		n = swap4(n);
  101|   226k|	if (n == 0xffffffff)	/* check for End of Medium */
  ------------------
  |  Branch (101:6): [True: 35, False: 226k]
  ------------------
  102|     35|		return n;
  103|   226k|	n &= 0x00ffffff;	/* keep only the record len */
  104|   226k|	if (n & 1)
  ------------------
  |  Branch (104:6): [True: 5.66k, False: 220k]
  ------------------
  105|  5.66k|		n++;
  106|   226k|	return n;
  107|   226k|}

file_is_tar:
   64|  10.2k|{
   65|  10.2k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.2k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  10.2k|	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|  10.2k|	int tar;
   72|  10.2k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  10.2k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  10.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  10.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 10.2k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  10.2k|	tar = is_tar(buf, nbytes);
   78|  10.2k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 10.2k, False: 16]
  |  Branch (78:17): [True: 0, False: 16]
  ------------------
   79|  10.2k|		return 0;
   80|       |
   81|     16|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     16|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 16]
  ------------------
   82|      0|		return 1;
   83|       |
   84|     16|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 16]
  |  Branch (84:28): [True: 0, False: 16]
  ------------------
   85|     16|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|     16|	return 1;
   89|     16|}
is_tar.c:is_tar:
  100|  10.2k|{
  101|  10.2k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  10.2k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  445|  10.2k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  10.2k|	    RCAST(const void *, buf));
  105|  10.2k|	size_t i;
  106|  10.2k|	int sum, recsum;
  107|  10.2k|	const unsigned char *p, *ep;
  108|  10.2k|	const char *nulp;
  109|       |
  110|  10.2k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 7.12k, False: 3.14k]
  ------------------
  111|  7.12k|		return 0;
  112|       |
  113|       |	/* If the file looks like Gentoo GLEP 78 binary package (GPKG),
  114|       |	 * don't waste time on further checks and fall back to magic rules.
  115|       |	 */
  116|  3.14k|	nulp = CAST(const char *,
  ------------------
  |  |  444|  3.14k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  3.14k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  3.14k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 2.81k, False: 325]
  |  Branch (118:22): [True: 2.09k, False: 721]
  ------------------
  119|  3.14k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 35, False: 2.06k]
  ------------------
  120|  2.09k|	    sizeof(gpkg_match)) == 0)
  121|     35|	    return 0;
  122|       |
  123|  3.10k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  3.10k|	sum = 0;
  126|  3.10k|	p = header->charptr;
  127|  3.10k|	ep = header->charptr + sizeof(*header);
  128|  1.59M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.59M, False: 3.10k]
  ------------------
  129|  1.59M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  27.9k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 24.8k, False: 3.10k]
  ------------------
  133|  24.8k|		sum -= header->header.chksum[i];
  134|  3.10k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  3.10k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 3.09k, False: 16]
  ------------------
  137|  3.09k|		return 0;	/* Not a tar archive */
  138|       |
  139|     16|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|     16|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 0, False: 16]
  ------------------
  140|     16|	    sizeof(header->header.magic)) == 0)
  141|      0|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|     16|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|     16|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 1, False: 15]
  ------------------
  144|     16|	    sizeof(header->header.magic)) == 0)
  145|      1|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|     15|	return 1;			/* Old fashioned tar archive */
  148|     16|}
is_tar.c:from_oct:
  158|  3.10k|{
  159|  3.10k|	int	value;
  160|       |
  161|  3.10k|	if (digs == 0)
  ------------------
  |  Branch (161:6): [True: 0, False: 3.10k]
  ------------------
  162|      0|		return -1;
  163|       |
  164|  3.10k|	while (isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  165|    927|		where++;
  166|    927|		if (digs-- == 0)
  ------------------
  |  Branch (166:7): [True: 78, False: 849]
  ------------------
  167|     78|			return -1;		/* All blank field */
  168|    927|	}
  169|  3.02k|	value = 0;
  170|  3.45k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  3.42k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 873, False: 2.55k]
  |  |  |  Branch (51:39): [True: 423, False: 450]
  |  |  ------------------
  ------------------
  |  Branch (170:9): [True: 3.42k, False: 24]
  ------------------
  171|    423|		value = (value << 3) | (*where++ - '0');
  172|    423|		digs--;
  173|    423|	}
  174|       |
  175|  3.02k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (175:6): [True: 3.00k, False: 24]
  |  Branch (175:18): [True: 1.28k, False: 1.71k]
  |  Branch (175:28): [True: 1.24k, False: 43]
  ------------------
  176|  1.24k|		return -1;			/* Ended on non-(space/NUL) */
  177|       |
  178|  1.78k|	return value;
  179|  3.02k|}

magic_getpath:
  255|      2|{
  256|      2|	if (magicfile != NULL)
  ------------------
  |  Branch (256:6): [True: 2, False: 0]
  ------------------
  257|      2|		return magicfile;
  258|       |
  259|      0|	magicfile = getenv("MAGIC");
  260|      0|	if (magicfile != NULL)
  ------------------
  |  Branch (260:6): [True: 0, False: 0]
  ------------------
  261|      0|		return magicfile;
  262|       |
  263|      0|	return action == FILE_LOAD ? get_default_magic() : MAGIC;
  ------------------
  |  |  187|      0|#define	FILE_LOAD	0
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  ------------------
  264|      0|}
magic_open:
  268|      2|{
  269|      2|	return file_ms_alloc(flags);
  270|      2|}
magic_load:
  318|      2|{
  319|      2|	if (ms == NULL)
  ------------------
  |  Branch (319:6): [True: 0, False: 2]
  ------------------
  320|      0|		return -1;
  321|      2|	return file_apprentice(ms, magicfile, FILE_LOAD);
  ------------------
  |  |  187|      2|#define	FILE_LOAD	0
  ------------------
  322|      2|}
magic_buffer:
  550|  7.48k|{
  551|  7.48k|	if (ms == NULL)
  ------------------
  |  Branch (551:6): [True: 0, False: 7.48k]
  ------------------
  552|      0|		return NULL;
  553|  7.48k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (553:6): [True: 0, False: 7.48k]
  ------------------
  554|      0|		return NULL;
  555|       |	/*
  556|       |	 * The main work is done here!
  557|       |	 * We have the file name and/or the data buffer to be identified.
  558|       |	 */
  559|  7.48k|	if (file_buffer(ms, -1, NULL, NULL, buf, nb) == -1) {
  ------------------
  |  Branch (559:6): [True: 17, False: 7.46k]
  ------------------
  560|     17|		return NULL;
  561|     17|	}
  562|  7.46k|	return file_getbuffer(ms);
  563|  7.48k|}
magic_setflags:
  593|      2|{
  594|      2|	if (ms == NULL)
  ------------------
  |  Branch (594:6): [True: 0, False: 2]
  ------------------
  595|      0|		return -1;
  596|       |#if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
  597|       |	if (flags & MAGIC_PRESERVE_ATIME)
  598|       |		return -1;
  599|       |#endif
  600|      2|	ms->flags = flags;
  601|      2|	return 0;
  602|      2|}

file_fmtdatetime:
  273|  2.33k|{
  274|  2.33k|	char *pp;
  275|  2.33k|	time_t t;
  276|  2.33k|	struct tm *tm, tmz;
  277|       |
  278|  2.33k|	if (flags & FILE_T_WINDOWS) {
  ------------------
  |  |  529|  2.33k|#define FILE_T_WINDOWS	2
  ------------------
  |  Branch (278:6): [True: 912, False: 1.41k]
  ------------------
  279|    912|		struct timespec ts;
  280|    912|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  444|    912|#define CAST(T, b)	((T)(b))
  ------------------
  281|    912|		t = ts.tv_sec;
  282|  1.41k|	} else {
  283|       |		// XXX: perhaps detect and print something if overflow
  284|       |		// on 32 bit time_t?
  285|  1.41k|		t = CAST(time_t, v);
  ------------------
  |  |  444|  1.41k|#define CAST(T, b)	((T)(b))
  ------------------
  286|  1.41k|	}
  287|       |
  288|  2.33k|	if (t > MAX_CTIME)
  ------------------
  |  |  173|  2.33k|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  444|  4.66k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (288:6): [True: 128, False: 2.20k]
  ------------------
  289|    128|		goto out;
  290|       |
  291|  2.20k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  528|  2.20k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (291:6): [True: 635, False: 1.56k]
  ------------------
  292|    635|		tzset();
  293|    635|		tm = localtime_r(&t, &tmz);
  294|  1.56k|	} else {
  295|  1.56k|		tm = gmtime_r(&t, &tmz);
  296|  1.56k|	}
  297|  2.20k|	if (tm == NULL)
  ------------------
  |  Branch (297:6): [True: 107, False: 2.09k]
  ------------------
  298|    107|		goto out;
  299|  2.09k|	pp = asctime_r(tm, buf);
  300|       |
  301|  2.09k|	if (pp == NULL)
  ------------------
  |  Branch (301:6): [True: 156, False: 1.93k]
  ------------------
  302|    156|		goto out;
  303|  1.93k|	pp[strcspn(pp, "\n")] = '\0';
  304|  1.93k|	return pp;
  305|    391|out:
  306|    391|	strlcpy(buf, "*Invalid datetime*", bsize);
  307|    391|	return buf;
  308|  2.09k|}
file_fmtdate:
  316|     67|{
  317|     67|	struct tm tm;
  318|       |
  319|     67|	memset(&tm, 0, sizeof(tm));
  320|     67|	tm.tm_mday = v & 0x1f;
  321|     67|	tm.tm_mon = ((v >> 5) & 0xf) - 1;
  322|     67|	tm.tm_year = (v >> 9) + 80;
  323|       |
  324|     67|	if (strftime(buf, bsize, "%a, %b %d %Y", &tm) == 0)
  ------------------
  |  Branch (324:6): [True: 0, False: 67]
  ------------------
  325|      0|		goto out;
  326|       |
  327|     67|	return buf;
  328|      0|out:
  329|      0|	strlcpy(buf, "*Invalid date*", bsize);
  330|      0|	return buf;
  331|     67|}
file_fmttime:
  335|     67|{
  336|     67|	struct tm tm;
  337|       |
  338|     67|	memset(&tm, 0, sizeof(tm));
  339|     67|	tm.tm_sec = (v & 0x1f) * 2;
  340|     67|	tm.tm_min = ((v >> 5) & 0x3f);
  341|     67|	tm.tm_hour = (v >> 11);
  342|       |
  343|     67|	if (strftime(buf, bsize, "%T", &tm) == 0)
  ------------------
  |  Branch (343:6): [True: 0, False: 67]
  ------------------
  344|      0|		goto out;
  345|       |
  346|     67|	return buf;
  347|      0|out:
  348|      0|	strlcpy(buf, "*Invalid time*", bsize);
  349|      0|	return buf;
  350|       |
  351|     67|}

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

file_softmagic:
  121|  12.3k|{
  122|  12.3k|	struct mlist *ml;
  123|  12.3k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  124|  12.3k|	uint16_t nc, ic;
  125|       |
  126|  12.3k|	if (name_count == NULL) {
  ------------------
  |  Branch (126:6): [True: 12.3k, False: 0]
  ------------------
  127|  12.3k|		nc = 0;
  128|  12.3k|		name_count = &nc;
  129|  12.3k|	}
  130|  12.3k|	if (indir_count == NULL) {
  ------------------
  |  Branch (130:6): [True: 12.3k, False: 0]
  ------------------
  131|  12.3k|		ic = 0;
  132|  12.3k|		indir_count = &ic;
  133|  12.3k|	}
  134|       |
  135|  24.5k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (135:32): [True: 12.3k, False: 12.2k]
  ------------------
  136|  12.3k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  137|  12.3k|		    0, mode, text, 0, indir_count, name_count,
  138|  12.3k|		    &printed_something, &need_separator, &firstline,
  139|  12.3k|		    NULL, NULL);
  140|  12.3k|		switch (ret) {
  141|    109|		case -1:
  ------------------
  |  Branch (141:3): [True: 109, False: 12.2k]
  ------------------
  142|    109|			return ret;
  143|  4.96k|		case 0:
  ------------------
  |  Branch (143:3): [True: 4.96k, False: 7.38k]
  ------------------
  144|  4.96k|			continue;
  145|  7.27k|		default:
  ------------------
  |  Branch (145:3): [True: 7.27k, False: 5.07k]
  ------------------
  146|  7.27k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  7.27k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (146:8): [True: 0, False: 7.27k]
  ------------------
  147|      0|				return ret;
  148|  7.27k|			rv = ret;
  149|  7.27k|			break;
  150|  12.3k|		}
  151|  12.3k|	}
  152|       |
  153|  12.2k|	return rv;
  154|  12.3k|}
softmagic.c:match:
  213|  88.9k|{
  214|  88.9k|	uint32_t magindex = 0;
  215|  88.9k|	unsigned int cont_level = 0;
  216|  88.9k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  217|  88.9k|	int returnvalv = 0, e;
  218|  88.9k|	struct buffer bb;
  219|  88.9k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  88.9k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  88.9k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  88.9k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  88.9k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  88.9k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  88.9k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  220|       |
  221|       |	/*
  222|       |	 * returnval can be 0 if a match is found, but there was no
  223|       |	 * annotation to be printed.
  224|       |	 */
  225|  88.9k|	if (returnval == NULL)
  ------------------
  |  Branch (225:6): [True: 29.6k, False: 59.2k]
  ------------------
  226|  29.6k|		returnval = &returnvalv;
  227|  88.9k|	if (found_match == NULL)
  ------------------
  |  Branch (227:6): [True: 29.6k, False: 59.2k]
  ------------------
  228|  29.6k|		found_match = &found_matchv;
  229|       |
  230|  88.9k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (230:6): [True: 0, False: 88.9k]
  ------------------
  231|      0|		return -1;
  232|       |
  233|   105M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (233:21): [True: 105M, False: 85.7k]
  ------------------
  234|   105M|		int flush = 0;
  235|   105M|		struct magic *m = &magic[magindex];
  236|   105M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  237|       |
  238|   105M|		if (m->type != FILE_NAME)
  ------------------
  |  |  285|   105M|#define				FILE_NAME		45
  ------------------
  |  Branch (238:7): [True: 105M, False: 59.2k]
  ------------------
  239|   105M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  303|   210M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  245|   210M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (303:3): [True: 65.1M, False: 39.8M]
  |  |  ------------------
  |  |  304|   105M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  253|   144M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (304:3): [True: 29.5k, False: 39.8M]
  |  |  ------------------
  |  |  305|   105M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  258|   144M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (305:3): [True: 0, False: 39.8M]
  |  |  ------------------
  |  |  306|   105M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  259|   144M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (306:3): [True: 58.4k, False: 39.8M]
  |  |  ------------------
  |  |  307|   105M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  257|   144M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (307:3): [True: 2.00M, False: 37.8M]
  |  |  ------------------
  |  |  308|   105M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  260|   142M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (308:3): [True: 7.18M, False: 30.6M]
  |  |  ------------------
  |  |  309|   105M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  281|   135M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (309:3): [True: 0, False: 30.6M]
  |  |  ------------------
  |  |  310|   105M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  285|   135M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (310:3): [True: 0, False: 30.6M]
  |  |  ------------------
  |  |  311|   105M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  286|   135M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (311:3): [True: 0, False: 30.6M]
  |  |  ------------------
  |  |  312|   210M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  299|  30.6M|#define				FILE_OCTAL		59
  |  |  ------------------
  |  |  |  Branch (312:3): [True: 0, False: 30.6M]
  |  |  ------------------
  ------------------
  240|   105M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  241|   105M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  375|  10.6M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  240|  10.6M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  395|  10.6M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  10.6M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  394|  10.6M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  10.6M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  395|  10.6M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  388|  10.6M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (241:10): [True: 10.6M, False: 63.7M]
  |  Branch (241:18): [True: 406k, False: 10.2M]
  ------------------
  242|  74.4M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  375|  63.7M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  240|  63.7M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  395|  63.7M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  63.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  394|  63.7M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  63.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  394|  63.7M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  388|  63.7M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (242:10): [True: 63.7M, False: 10.2M]
  |  Branch (242:19): [True: 2.96M, False: 60.7M]
  ------------------
  243|   105M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (243:7): [True: 14.2M, False: 87.3M]
  ------------------
  244|   104M|flush:
  245|       |			/* Skip sub-tests */
  246|   475M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (246:11): [True: 475M, False: 26.9k]
  ------------------
  247|   475M|			    magic[magindex + 1].cont_level != 0)
  ------------------
  |  Branch (247:8): [True: 370M, False: 104M]
  ------------------
  248|   370M|				magindex++;
  249|   104M|			cont_level = 0;
  250|   104M|			continue; /* Skip to next top-level test*/
  251|  17.6M|		}
  252|       |
  253|  87.4M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (253:7): [True: 216k, False: 87.2M]
  ------------------
  254|   216k|			goto flush;
  255|  87.2M|		ms->line = m->lineno;
  256|       |
  257|       |		/* if main entry matches, print it... */
  258|  87.2M|		switch (mget(ms, m, b, CAST(const unsigned char *, bb.fbuf),
  ------------------
  |  |  444|  87.2M|#define CAST(T, b)	((T)(b))
  ------------------
  259|  87.2M|		    bb.flen, offset, cont_level,
  260|  87.2M|		    mode, text, flip, indir_count, name_count,
  261|  87.2M|		    printed_something, need_separator, firstline, returnval,
  262|  87.2M|		    found_match))
  263|  87.2M|		{
  264|    441|		case -1:
  ------------------
  |  Branch (264:3): [True: 441, False: 87.2M]
  ------------------
  265|    441|			return -1;
  266|  16.4M|		case 0:
  ------------------
  |  Branch (266:3): [True: 16.4M, False: 70.8M]
  ------------------
  267|  16.4M|			flush = m->reln != '!';
  268|  16.4M|			break;
  269|  70.8M|		default:
  ------------------
  |  Branch (269:3): [True: 70.8M, False: 16.4M]
  ------------------
  270|  70.8M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  281|  70.8M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (270:8): [True: 0, False: 70.8M]
  ------------------
  271|      0|				*found_match = 1;
  272|      0|				*returnval = 1;
  273|      0|			}
  274|       |
  275|  70.8M|			switch (magiccheck(ms, m, m_rxcomp)) {
  276|      0|			case -1:
  ------------------
  |  Branch (276:4): [True: 0, False: 70.8M]
  ------------------
  277|      0|				return -1;
  278|  70.4M|			case 0:
  ------------------
  |  Branch (278:4): [True: 70.4M, False: 338k]
  ------------------
  279|  70.4M|				flush++;
  280|  70.4M|				break;
  281|   338k|			default:
  ------------------
  |  Branch (281:4): [True: 338k, False: 70.4M]
  ------------------
  282|   338k|				flush = 0;
  283|   338k|				break;
  284|  70.8M|			}
  285|  70.8M|			break;
  286|  87.2M|		}
  287|  87.2M|		if (flush) {
  ------------------
  |  Branch (287:7): [True: 86.8M, False: 338k]
  ------------------
  288|       |			/*
  289|       |			 * main entry didn't match,
  290|       |			 * flush its continuations
  291|       |			 */
  292|  86.8M|			goto flush;
  293|  86.8M|		}
  294|       |
  295|   338k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (295:7): [True: 0, False: 338k]
  ------------------
  296|      0|		{
  297|      0|			*found_match = 1;
  298|      0|			*need_separator = 1;
  299|      0|			*printed_something = 1;
  300|      0|			*returnval = 1;
  301|      0|			*firstline = 0;
  302|      0|			return e;
  303|      0|		}
  304|       |
  305|       |		/*
  306|       |		 * If we are going to print something, we'll need to print
  307|       |		 * a blank before we print something else.
  308|       |		 */
  309|   338k|		if (*m->desc) {
  ------------------
  |  Branch (309:7): [True: 27.4k, False: 310k]
  ------------------
  310|  27.4k|			*found_match = 1;
  311|  27.4k|			if (print) {
  ------------------
  |  Branch (311:8): [True: 27.4k, False: 0]
  ------------------
  312|  27.4k|				*returnval = 1;
  313|  27.4k|				*need_separator = 1;
  314|  27.4k|				*printed_something = 1;
  315|  27.4k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (315:9): [True: 0, False: 27.4k]
  ------------------
  316|      0|					return -1;
  317|  27.4k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (317:9): [True: 0, False: 27.4k]
  ------------------
  318|      0|					return -1;
  319|  27.4k|			}
  320|  27.4k|		}
  321|       |
  322|   338k|		switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
  323|  23.0k|		case -1:
  ------------------
  |  Branch (323:3): [True: 23.0k, False: 315k]
  ------------------
  324|  23.0k|		case 0:
  ------------------
  |  Branch (324:3): [True: 0, False: 338k]
  ------------------
  325|  23.0k|			goto flush;
  326|   315k|		default:
  ------------------
  |  Branch (326:3): [True: 315k, False: 23.0k]
  ------------------
  327|   315k|			break;
  328|   338k|		}
  329|       |
  330|       |		/* and any continuations that match */
  331|   315k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (331:7): [True: 0, False: 315k]
  ------------------
  332|      0|			return -1;
  333|       |
  334|  5.73M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (334:10): [True: 5.67M, False: 58.7k]
  ------------------
  335|  5.73M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (335:7): [True: 5.42M, False: 252k]
  ------------------
  336|  5.42M|			m = &magic[++magindex];
  337|  5.42M|			m_rxcomp = &magic_rxcomp[magindex];
  338|  5.42M|			ms->line = m->lineno; /* for messages */
  339|       |
  340|  5.42M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (340:8): [True: 4.26M, False: 1.15M]
  ------------------
  341|  4.26M|				continue;
  342|  1.15M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (342:8): [True: 100k, False: 1.05M]
  ------------------
  343|       |				/*
  344|       |				 * We're at the end of the level
  345|       |				 * "cont_level" continuations.
  346|       |				 */
  347|   100k|				cont_level = m->cont_level;
  348|   100k|			}
  349|  1.15M|			if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (349:8): [True: 705, False: 1.15M]
  ------------------
  350|    705|				goto flush;
  351|  1.15M|			if (m->flag & OFFADD) {
  ------------------
  |  |  224|  1.15M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (351:8): [True: 104k, False: 1.05M]
  ------------------
  352|   104k|				if (cont_level == 0) {
  ------------------
  |  Branch (352:9): [True: 0, False: 104k]
  ------------------
  353|      0|					if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (353:10): [True: 0, False: 0]
  ------------------
  354|      0|						fprintf(stderr,
  355|      0|						    "direct *zero*"
  356|      0|						    " cont_level\n");
  357|      0|					return 0;
  358|      0|				}
  359|   104k|				ms->offset +=
  360|   104k|				    ms->c.li[cont_level - 1].off;
  361|   104k|			}
  362|       |
  363|  1.15M|#ifdef ENABLE_CONDITIONALS
  364|  1.15M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  356|  2.31M|#define				COND_ELSE	3
  ------------------
  |  Branch (364:8): [True: 0, False: 1.15M]
  ------------------
  365|  1.15M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  355|  1.15M|#define				COND_ELIF	2
  ------------------
  |  Branch (365:8): [True: 0, False: 1.15M]
  ------------------
  366|      0|				if (ms->c.li[cont_level].last_match == 1)
  ------------------
  |  Branch (366:9): [True: 0, False: 0]
  ------------------
  367|      0|					continue;
  368|      0|			}
  369|  1.15M|#endif
  370|  1.15M|			switch (mget(ms, m, b, CAST(const unsigned char *,
  ------------------
  |  |  444|  1.15M|#define CAST(T, b)	((T)(b))
  ------------------
  371|  1.15M|			    bb.fbuf), bb.flen, offset,
  372|  1.15M|			    cont_level, mode, text, flip, indir_count,
  373|  1.15M|			    name_count, printed_something, need_separator,
  374|  1.15M|			    firstline, returnval, found_match)) {
  375|  2.80k|			case -1:
  ------------------
  |  Branch (375:4): [True: 2.80k, False: 1.15M]
  ------------------
  376|  2.80k|				return -1;
  377|   101k|			case 0:
  ------------------
  |  Branch (377:4): [True: 101k, False: 1.05M]
  ------------------
  378|   101k|				if (m->reln != '!')
  ------------------
  |  Branch (378:9): [True: 98.9k, False: 2.57k]
  ------------------
  379|  98.9k|					continue;
  380|  2.57k|				flush = 1;
  381|  2.57k|				break;
  382|  1.05M|			default:
  ------------------
  |  Branch (382:4): [True: 1.05M, False: 104k]
  ------------------
  383|  1.05M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  281|  1.05M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (383:9): [True: 12.3k, False: 1.03M]
  ------------------
  384|  12.3k|					*found_match = 1;
  385|  12.3k|					*returnval = 1;
  386|  12.3k|				}
  387|  1.05M|				flush = 0;
  388|  1.05M|				break;
  389|  1.15M|			}
  390|       |
  391|  1.05M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (391:12): [True: 2.57k, False: 1.05M]
  ------------------
  392|      0|			case -1:
  ------------------
  |  Branch (392:4): [True: 0, False: 1.05M]
  ------------------
  393|      0|				return -1;
  394|   755k|			case 0:
  ------------------
  |  Branch (394:4): [True: 755k, False: 297k]
  ------------------
  395|   755k|#ifdef ENABLE_CONDITIONALS
  396|   755k|				ms->c.li[cont_level].last_match = 0;
  397|   755k|#endif
  398|   755k|				break;
  399|   297k|			default:
  ------------------
  |  Branch (399:4): [True: 297k, False: 755k]
  ------------------
  400|   297k|#ifdef ENABLE_CONDITIONALS
  401|   297k|				ms->c.li[cont_level].last_match = 1;
  402|   297k|#endif
  403|   297k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  287|   297k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (403:9): [True: 460, False: 297k]
  ------------------
  404|    460|					ms->c.li[cont_level].got_match = 0;
  405|   297k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (405:14): [True: 66.8k, False: 230k]
  ------------------
  406|  66.8k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  243|  66.8k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (406:10): [True: 1.45k, False: 65.3k]
  ------------------
  407|  1.45k|						break;
  408|  66.8k|				} else
  409|   230k|					ms->c.li[cont_level].got_match = 1;
  410|       |
  411|   296k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (411:9): [True: 0, False: 296k]
  ------------------
  412|   296k|				    != 0) {
  413|      0|					*found_match = 1;
  414|      0|					*need_separator = 1;
  415|      0|					*printed_something = 1;
  416|      0|					*returnval = 1;
  417|      0|					return e;
  418|      0|				}
  419|   296k|				if (*m->desc) {
  ------------------
  |  Branch (419:9): [True: 88.9k, False: 207k]
  ------------------
  420|  88.9k|					*found_match = 1;
  421|  88.9k|				}
  422|   296k|				if (print && *m->desc) {
  ------------------
  |  Branch (422:9): [True: 296k, False: 0]
  |  Branch (422:18): [True: 88.9k, False: 207k]
  ------------------
  423|  88.9k|					*returnval = 1;
  424|       |					/*
  425|       |					 * This continuation matched.  Print
  426|       |					 * its message, with a blank before it
  427|       |					 * if the previous item printed and
  428|       |					 * this item isn't empty.
  429|       |					 */
  430|       |					/*
  431|       |					 * If we are going to print something,
  432|       |					 * make sure that we have a separator
  433|       |					 * first.
  434|       |					 */
  435|  88.9k|					if (!*printed_something) {
  ------------------
  |  Branch (435:10): [True: 19.1k, False: 69.7k]
  ------------------
  436|  19.1k|						*printed_something = 1;
  437|  19.1k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (437:11): [True: 0, False: 19.1k]
  ------------------
  438|  19.1k|						    == -1)
  439|      0|							return -1;
  440|  19.1k|					}
  441|       |					/* space if previous printed */
  442|  88.9k|					if (*need_separator
  ------------------
  |  Branch (442:10): [True: 77.6k, False: 11.2k]
  ------------------
  443|  88.9k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  227|  77.6k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (443:13): [True: 19.3k, False: 58.3k]
  ------------------
  444|  19.3k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (444:11): [True: 0, False: 19.3k]
  ------------------
  445|      0|							return -1;
  446|  19.3k|					}
  447|  88.9k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (447:10): [True: 0, False: 88.9k]
  ------------------
  448|      0|						return -1;
  449|  88.9k|					*need_separator = 1;
  450|  88.9k|				}
  451|       |
  452|   296k|				switch (moffset(ms, m, &bb,
  453|   296k|				    &ms->c.li[cont_level].off)) {
  454|  4.32k|				case -1:
  ------------------
  |  Branch (454:5): [True: 4.32k, False: 292k]
  ------------------
  455|  4.32k|				case 0:
  ------------------
  |  Branch (455:5): [True: 0, False: 296k]
  ------------------
  456|  4.32k|					cont_level--;
  457|  4.32k|					break;
  458|   292k|				default:
  ------------------
  |  Branch (458:5): [True: 292k, False: 4.32k]
  ------------------
  459|   292k|					break;
  460|   296k|				}
  461|       |
  462|       |				/*
  463|       |				 * If we see any continuations
  464|       |				 * at a higher level,
  465|       |				 * process them.
  466|       |				 */
  467|   296k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (467:9): [True: 0, False: 296k]
  ------------------
  468|      0|					return -1;
  469|   296k|				break;
  470|  1.05M|			}
  471|  1.05M|		}
  472|   311k|		if (*printed_something) {
  ------------------
  |  Branch (472:7): [True: 89.2k, False: 222k]
  ------------------
  473|  89.2k|			*firstline = 0;
  474|  89.2k|		}
  475|   311k|		if (*found_match) {
  ------------------
  |  Branch (475:7): [True: 206k, False: 105k]
  ------------------
  476|   206k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   206k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (476:8): [True: 0, False: 206k]
  ------------------
  477|      0|				return *returnval;
  478|       |			// So that we print a separator
  479|   206k|			*printed_something = 0;
  480|   206k|			*firstline = 0;
  481|   206k|		}
  482|   311k|		cont_level = 0;
  483|   311k|	}
  484|  85.7k|	return *returnval;
  485|  88.9k|}
softmagic.c:msetoffset:
 1515|  88.6M|{
 1516|  88.6M|	int32_t offset;
 1517|  88.6M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  231|  88.6M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1517:6): [True: 219k, False: 88.3M]
  ------------------
 1518|   219k|		offset = -m->offset;
 1519|   219k|		if (cont_level > 0) {
  ------------------
  |  Branch (1519:7): [True: 2.67k, False: 216k]
  ------------------
 1520|  2.67k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  224|  2.67k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  225|  2.67k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1520:8): [True: 1.97k, False: 705]
  ------------------
 1521|  1.97k|				goto normal;
 1522|       |#if 0
 1523|       |			file_error(ms, 0, "negative offset %d at continuation"
 1524|       |			    "level %u", m->offset, cont_level);
 1525|       |			return -1;
 1526|       |#endif
 1527|  2.67k|		}
 1528|   217k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1528:7): [True: 217k, False: 0]
  ------------------
 1529|   217k|			return -1;
 1530|      0|		if (o != 0) {
  ------------------
  |  Branch (1530:7): [True: 0, False: 0]
  ------------------
 1531|       |			// Not yet!
 1532|      0|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1533|      0|			    "u at level %u", o, cont_level);
 1534|      0|			return -1;
 1535|      0|		}
 1536|      0|		if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1536:7): [True: 0, False: 0]
  ------------------
 1537|      0|			return -1;
 1538|      0|		buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1539|      0|		ms->eoffset = ms->offset = CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1540|  88.3M|	} else {
 1541|  88.3M|		offset = m->offset;
 1542|  88.3M|		if (cont_level == 0) {
  ------------------
  |  Branch (1542:7): [True: 87.2M, False: 1.15M]
  ------------------
 1543|  87.2M|normal:
 1544|       |			// XXX: Pass real fd, then who frees bb?
 1545|  87.2M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1546|  87.2M|			ms->offset = offset;
 1547|  87.2M|			ms->eoffset = 0;
 1548|  87.2M|		} else {
 1549|  1.15M|			ms->offset = ms->eoffset + offset;
 1550|  1.15M|		}
 1551|  88.3M|	}
 1552|  88.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  88.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1552:6): [True: 0, False: 88.3M]
  ------------------
 1553|      0|		fprintf(stderr, "bb=[%p,%" SIZE_T_FORMAT "u,%"
 1554|      0|		    SIZE_T_FORMAT "u], %d [b=%p,%"
 1555|      0|		    SIZE_T_FORMAT "u,%" SIZE_T_FORMAT "u], [o=%#x, c=%d]\n",
 1556|      0|		    bb->fbuf, bb->flen, bb->elen, ms->offset, b->fbuf,
 1557|      0|		    b->flen, b->elen, offset, cont_level);
 1558|      0|	}
 1559|  88.3M|	return 0;
 1560|  88.6M|}
softmagic.c:mget:
 1590|  88.3M|{
 1591|  88.3M|	uint32_t eoffset, offset = ms->offset;
 1592|  88.3M|	struct buffer bb;
 1593|  88.3M|	intmax_t lhs;
 1594|  88.3M|	file_pushbuf_t *pb;
 1595|  88.3M|	int rv, oneed_separator, in_type, nfound_match;
 1596|  88.3M|	char *rbuf;
 1597|  88.3M|	union VALUETYPE *p = &ms->ms_value;
 1598|  88.3M|	struct mlist ml, *mlp;
 1599|  88.3M|	struct cont c;
 1600|       |
 1601|  88.3M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1601:6): [True: 743, False: 88.3M]
  ------------------
 1602|    743|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1603|    743|		    *indir_count);
 1604|    743|		return -1;
 1605|    743|	}
 1606|       |
 1607|  88.3M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1607:6): [True: 10, False: 88.3M]
  ------------------
 1608|     10|		file_error(ms, 0, "name use count (%hu) exceeded",
 1609|     10|		    *name_count);
 1610|     10|		return -1;
 1611|     10|	}
 1612|       |
 1613|       |
 1614|       |
 1615|  88.3M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  223|  88.3M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1615:6): [True: 0, False: 88.3M]
  ------------------
 1616|  88.3M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  444|  88.3M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  444|  88.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1617|      0|		return -1;
 1618|       |
 1619|  88.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  88.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1619:6): [True: 0, False: 88.3M]
  ------------------
 1620|      0|		fprintf(stderr, "mget(type=%d, flag=%#x, offset=%u, o=%"
 1621|      0|		    SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
 1622|      0|		    "u, il=%hu, nc=%hu)\n",
 1623|      0|		    m->type, m->flag, offset, o, nbytes,
 1624|      0|		    *indir_count, *name_count);
 1625|      0|		mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  445|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1626|      0|		    sizeof(union VALUETYPE));
 1627|      0|#ifndef COMPILE_ONLY
 1628|      0|		file_mdump(m);
 1629|      0|#endif
 1630|      0|	}
 1631|       |
 1632|  88.3M|	if (m->flag & INDIR) {
  ------------------
  |  |  223|  88.3M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1632:6): [True: 121k, False: 88.2M]
  ------------------
 1633|   121k|		intmax_t off = m->in_offset;
 1634|   121k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  348|   121k|#define				FILE_OPSIGNED	0x20
  ------------------
 1635|   121k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  350|   121k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1635:7): [True: 1.46k, False: 120k]
  ------------------
 1636|  1.46k|			const union VALUETYPE *q = CAST(const union VALUETYPE *,
  ------------------
  |  |  444|  1.46k|#define CAST(T, b)	((T)(b))
  ------------------
 1637|  1.46k|			    RCAST(const void *, s + offset + off));
 1638|  1.46k|			int op;
 1639|  1.46k|			switch (op = cvt_flip(m->in_type, flip)) {
 1640|      0|			case FILE_BYTE:
  ------------------
  |  |  241|      0|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1640:4): [True: 0, False: 1.46k]
  ------------------
 1641|      0|				if (OFFSET_OOB(nbytes, offset + off, 1))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1642|      0|					return 0;
 1643|      0|				off = SEXT(sgn,8,q->b);
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1644|      0|				break;
 1645|      0|			case FILE_SHORT:
  ------------------
  |  |  242|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1645:4): [True: 0, False: 1.46k]
  ------------------
 1646|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1647|      0|					return 0;
 1648|      0|				off = SEXT(sgn,16,q->h);
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1649|      0|				break;
 1650|      0|			case FILE_BESHORT:
  ------------------
  |  |  247|      0|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1650:4): [True: 0, False: 1.46k]
  ------------------
 1651|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1652|      0|					return 0;
 1653|      0|				off = SEXT(sgn,16,BE16(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1654|      0|				break;
 1655|      0|			case FILE_LESHORT:
  ------------------
  |  |  250|      0|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1655:4): [True: 0, False: 1.46k]
  ------------------
 1656|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1657|      0|					return 0;
 1658|      0|				off = SEXT(sgn,16,LE16(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1659|      0|				break;
 1660|      0|			case FILE_LONG:
  ------------------
  |  |  244|      0|#define				FILE_LONG		4
  ------------------
  |  Branch (1660:4): [True: 0, False: 1.46k]
  ------------------
 1661|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1662|      0|					return 0;
 1663|      0|				off = SEXT(sgn,32,q->l);
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1664|      0|				break;
 1665|      0|			case FILE_BELONG:
  ------------------
  |  |  248|      0|#define				FILE_BELONG		8
  ------------------
  |  Branch (1665:4): [True: 0, False: 1.46k]
  ------------------
 1666|      0|			case FILE_BEID3:
  ------------------
  |  |  279|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1666:4): [True: 0, False: 1.46k]
  ------------------
 1667|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1668|      0|					return 0;
 1669|      0|				off = SEXT(sgn,32,BE32(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1670|      0|				break;
 1671|      0|			case FILE_LEID3:
  ------------------
  |  |  280|      0|#define				FILE_LEID3		40
  ------------------
  |  Branch (1671:4): [True: 0, False: 1.46k]
  ------------------
 1672|  1.46k|			case FILE_LELONG:
  ------------------
  |  |  251|  1.46k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1672:4): [True: 1.46k, False: 0]
  ------------------
 1673|  1.46k|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|  1.46k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.92k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 217, False: 1.24k]
  |  |  |  Branch (72:59): [True: 210, False: 1.03k]
  |  |  ------------------
  ------------------
 1674|    427|					return 0;
 1675|  1.03k|				off = SEXT(sgn,32,LE32(q));
  ------------------
  |  |  109|  1.03k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 1.03k]
  |  |  ------------------
  |  |  110|  1.03k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  1.03k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  1.03k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1676|  1.03k|				break;
 1677|      0|			case FILE_MELONG:
  ------------------
  |  |  263|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1677:4): [True: 0, False: 1.46k]
  ------------------
 1678|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1679|      0|					return 0;
 1680|      0|				off = SEXT(sgn,32,ME32(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1681|      0|				break;
 1682|      0|			case FILE_BEQUAD:
  ------------------
  |  |  266|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1682:4): [True: 0, False: 1.46k]
  ------------------
 1683|      0|				if (OFFSET_OOB(nbytes, offset + off, 8))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1684|      0|					return 0;
 1685|      0|				off = SEXT(sgn,64,BE64(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1686|      0|				break;
 1687|      0|			case FILE_LEQUAD:
  ------------------
  |  |  265|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1687:4): [True: 0, False: 1.46k]
  ------------------
 1688|      0|				if (OFFSET_OOB(nbytes, offset + off, 8))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1689|      0|					return 0;
 1690|      0|				off = SEXT(sgn,64,LE64(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1691|      0|				break;
 1692|      0|			case FILE_OCTAL:
  ------------------
  |  |  299|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1692:4): [True: 0, False: 1.46k]
  ------------------
 1693|      0|				if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1694|      0|					return 0;
 1695|      0|				off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1696|      0|				break;
 1697|      0|			default:
  ------------------
  |  Branch (1697:4): [True: 0, False: 1.46k]
  ------------------
 1698|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1698:9): [True: 0, False: 0]
  ------------------
 1699|      0|					fprintf(stderr, "bad op=%d\n", op);
 1700|      0|				return 0;
 1701|  1.46k|			}
 1702|  1.03k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.03k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1702:8): [True: 0, False: 1.03k]
  ------------------
 1703|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1704|  1.03k|		}
 1705|   121k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1706|  17.4k|		case FILE_BYTE:
  ------------------
  |  |  241|  17.4k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1706:3): [True: 17.4k, False: 103k]
  ------------------
 1707|  17.4k|			if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   72|  17.4k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  34.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 43, False: 17.4k]
  |  |  |  Branch (72:59): [True: 66, False: 17.3k]
  |  |  ------------------
  ------------------
 1708|    109|				return 0;
 1709|  17.3k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  109|  17.3k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 17.3k]
  |  |  ------------------
  |  |  110|  17.3k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  17.3k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  17.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1709:8): [True: 0, False: 17.3k]
  ------------------
 1710|      0|				return 0;
 1711|  17.3k|			break;
 1712|  20.9k|		case FILE_BESHORT:
  ------------------
  |  |  247|  20.9k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1712:3): [True: 20.9k, False: 100k]
  ------------------
 1713|  20.9k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  20.9k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  41.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 56, False: 20.8k]
  |  |  |  Branch (72:59): [True: 184, False: 20.7k]
  |  |  ------------------
  ------------------
 1714|    240|				return 0;
 1715|  20.7k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p)), off))
  ------------------
  |  |  109|  20.7k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 20.7k]
  |  |  ------------------
  |  |  110|  20.7k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  20.7k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  20.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1715:8): [True: 0, False: 20.7k]
  ------------------
 1716|      0|				return 0;
 1717|  20.7k|			break;
 1718|  20.7k|		case FILE_LESHORT:
  ------------------
  |  |  250|  7.15k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1718:3): [True: 7.15k, False: 113k]
  ------------------
 1719|  7.15k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  7.15k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  14.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 637, False: 6.52k]
  |  |  |  Branch (72:59): [True: 182, False: 6.34k]
  |  |  ------------------
  ------------------
 1720|    819|				return 0;
 1721|  6.34k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p)), off))
  ------------------
  |  |  109|  6.34k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 95, False: 6.24k]
  |  |  ------------------
  |  |  110|  6.34k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|     95|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  6.34k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  6.24k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1721:8): [True: 0, False: 6.34k]
  ------------------
 1722|      0|				return 0;
 1723|  6.34k|			break;
 1724|  6.34k|		case FILE_SHORT:
  ------------------
  |  |  242|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1724:3): [True: 0, False: 121k]
  ------------------
 1725|      0|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1726|      0|				return 0;
 1727|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,16,p->h), off))
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1727:8): [True: 0, False: 0]
  ------------------
 1728|      0|				return 0;
 1729|      0|			break;
 1730|  11.0k|		case FILE_BELONG:
  ------------------
  |  |  248|  11.0k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1730:3): [True: 11.0k, False: 110k]
  ------------------
 1731|  11.1k|		case FILE_BEID3:
  ------------------
  |  |  279|  11.1k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1731:3): [True: 144, False: 120k]
  ------------------
 1732|  11.1k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  11.1k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  22.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 105, False: 11.0k]
  |  |  |  Branch (72:59): [True: 215, False: 10.8k]
  |  |  ------------------
  ------------------
 1733|    320|				return 0;
 1734|  10.8k|			lhs = BE32(p);
  ------------------
  |  |   96|  10.8k|#define BE32(p) ( \
  |  |   97|  10.8k|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  10.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  10.8k|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  10.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  10.8k|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  10.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  100|  10.8k|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  444|  10.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1735|  10.8k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  279|  10.8k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1735:8): [True: 96, False: 10.7k]
  ------------------
 1736|     96|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  444|     96|#define CAST(T, b)	((T)(b))
  ------------------
 1737|  10.8k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  109|  10.8k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 10.8k]
  |  |  ------------------
  |  |  110|  10.8k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  10.8k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  10.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1737:8): [True: 313, False: 10.5k]
  ------------------
 1738|    313|				return 0;
 1739|  10.5k|			break;
 1740|  63.3k|		case FILE_LELONG:
  ------------------
  |  |  251|  63.3k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1740:3): [True: 63.3k, False: 57.7k]
  ------------------
 1741|  63.3k|		case FILE_LEID3:
  ------------------
  |  |  280|  63.3k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1741:3): [True: 0, False: 121k]
  ------------------
 1742|  63.3k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  63.3k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   126k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 1.80k, False: 61.5k]
  |  |  |  Branch (72:59): [True: 3.69k, False: 57.8k]
  |  |  ------------------
  ------------------
 1743|  5.50k|				return 0;
 1744|  57.8k|			lhs = LE32(p);
  ------------------
  |  |   91|  57.8k|#define LE32(p) ( \
  |  |   92|  57.8k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  57.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  57.8k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  57.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  57.8k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  57.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   95|  57.8k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  444|  57.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1745|  57.8k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  280|  57.8k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1745:8): [True: 0, False: 57.8k]
  ------------------
 1746|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1747|  57.8k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  109|  57.8k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 57.8k]
  |  |  ------------------
  |  |  110|  57.8k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  57.8k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  57.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1747:8): [True: 1.08k, False: 56.7k]
  ------------------
 1748|  1.08k|				return 0;
 1749|  56.7k|			break;
 1750|  56.7k|		case FILE_MELONG:
  ------------------
  |  |  263|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1750:3): [True: 0, False: 121k]
  ------------------
 1751|      0|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1752|      0|				return 0;
 1753|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,32,ME32(p)), off))
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1753:8): [True: 0, False: 0]
  ------------------
 1754|      0|				return 0;
 1755|      0|			break;
 1756|    352|		case FILE_LONG:
  ------------------
  |  |  244|    352|#define				FILE_LONG		4
  ------------------
  |  Branch (1756:3): [True: 352, False: 120k]
  ------------------
 1757|    352|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|    352|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    704|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 76, False: 276]
  |  |  |  Branch (72:59): [True: 72, False: 204]
  |  |  ------------------
  ------------------
 1758|    148|				return 0;
 1759|    204|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  109|    204|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 204]
  |  |  ------------------
  |  |  110|    204|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    204|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    204|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1759:8): [True: 68, False: 136]
  ------------------
 1760|     68|				return 0;
 1761|    136|			break;
 1762|    182|		case FILE_LEQUAD:
  ------------------
  |  |  265|    182|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1762:3): [True: 182, False: 120k]
  ------------------
 1763|    182|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    182|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    364|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 182]
  |  |  |  Branch (72:59): [True: 0, False: 182]
  |  |  ------------------
  ------------------
 1764|      0|				return 0;
 1765|    182|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p)), off))	
  ------------------
  |  |  109|    182|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 182]
  |  |  ------------------
  |  |  110|    182|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    182|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    182|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1765:8): [True: 101, False: 81]
  ------------------
 1766|    101|				return 0;
 1767|     81|			break;
 1768|    178|		case FILE_BEQUAD:
  ------------------
  |  |  266|    178|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1768:3): [True: 178, False: 120k]
  ------------------
 1769|    178|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    178|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    356|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 178]
  |  |  |  Branch (72:59): [True: 0, False: 178]
  |  |  ------------------
  ------------------
 1770|      0|				return 0;
 1771|    178|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p)), off))
  ------------------
  |  |  109|    178|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 178]
  |  |  ------------------
  |  |  110|    178|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    178|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    178|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1771:8): [True: 107, False: 71]
  ------------------
 1772|    107|				return 0;
 1773|     71|			break;
 1774|    263|		case FILE_OCTAL:
  ------------------
  |  |  299|    263|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1774:3): [True: 263, False: 120k]
  ------------------
 1775|    263|			if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|    263|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    526|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 37, False: 226]
  |  |  |  Branch (72:59): [True: 34, False: 192]
  |  |  ------------------
  ------------------
 1776|     71|				return 0;
 1777|    192|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1777:7): [True: 35, False: 157]
  ------------------
 1778|    192|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  109|    192|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 192]
  |  |  ------------------
  |  |  110|    192|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    192|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    192|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1779|     35|				return 0;
 1780|    157|			break;
 1781|    157|		default:
  ------------------
  |  Branch (1781:3): [True: 0, False: 121k]
  ------------------
 1782|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1782:8): [True: 0, False: 0]
  ------------------
 1783|      0|				fprintf(stderr, "bad in_type=%d\n", in_type);
 1784|      0|			return 0;
 1785|   121k|		}
 1786|       |
 1787|   112k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  225|   112k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1787:7): [True: 2.75k, False: 109k]
  ------------------
 1788|  2.75k|			if (cont_level == 0) {
  ------------------
  |  Branch (1788:8): [True: 0, False: 2.75k]
  ------------------
 1789|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1789:9): [True: 0, False: 0]
  ------------------
 1790|      0|					fprintf(stderr,
 1791|      0|					    "indirect *zero* cont_level\n");
 1792|      0|				return 0;
 1793|      0|			}
 1794|  2.75k|			offset += ms->c.li[cont_level - 1].off;
 1795|  2.75k|			if (offset == 0) {
  ------------------
  |  Branch (1795:8): [True: 285, False: 2.46k]
  ------------------
 1796|    285|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    285|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1796:9): [True: 0, False: 285]
  ------------------
 1797|      0|					fprintf(stderr,
 1798|      0|					    "indirect *zero* offset\n");
 1799|    285|				return 0;
 1800|    285|			}
 1801|  2.46k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.46k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1801:8): [True: 0, False: 2.46k]
  ------------------
 1802|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1803|  2.46k|		}
 1804|   111k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1804:7): [True: 0, False: 111k]
  ------------------
 1805|      0|			return -1;
 1806|   111k|		ms->offset = offset;
 1807|       |
 1808|   111k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   111k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1808:7): [True: 0, False: 111k]
  ------------------
 1809|      0|			mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  445|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1810|      0|			    sizeof(union VALUETYPE));
 1811|      0|#ifndef COMPILE_ONLY
 1812|      0|			file_mdump(m);
 1813|      0|#endif
 1814|      0|		}
 1815|   111k|	}
 1816|       |
 1817|       |	/* Verify we have enough data to match magic type */
 1818|  88.3M|	switch (m->type) {
 1819|  1.27M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.27M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1819:2): [True: 1.27M, False: 87.1M]
  ------------------
 1820|  1.27M|		if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   72|  1.27M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.54M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 107k, False: 1.16M]
  |  |  |  Branch (72:59): [True: 22.1k, False: 1.14M]
  |  |  ------------------
  ------------------
 1821|   129k|			return 0;
 1822|  1.14M|		break;
 1823|       |
 1824|  1.14M|	case FILE_SHORT:
  ------------------
  |  |  242|   889k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1824:2): [True: 889k, False: 87.4M]
  ------------------
 1825|  4.79M|	case FILE_BESHORT:
  ------------------
  |  |  247|  4.79M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1825:2): [True: 3.90M, False: 84.4M]
  ------------------
 1826|  7.46M|	case FILE_LESHORT:
  ------------------
  |  |  250|  7.46M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1826:2): [True: 2.67M, False: 85.7M]
  ------------------
 1827|  7.46M|		if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  7.46M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  14.9M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 407k, False: 7.06M]
  |  |  |  Branch (72:59): [True: 210k, False: 6.85M]
  |  |  ------------------
  ------------------
 1828|   617k|			return 0;
 1829|  6.85M|		break;
 1830|       |
 1831|  6.85M|	case FILE_LONG:
  ------------------
  |  |  244|  1.35M|#define				FILE_LONG		4
  ------------------
  |  Branch (1831:2): [True: 1.35M, False: 87.0M]
  ------------------
 1832|  12.9M|	case FILE_BELONG:
  ------------------
  |  |  248|  12.9M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1832:2): [True: 11.6M, False: 76.7M]
  ------------------
 1833|  18.4M|	case FILE_LELONG:
  ------------------
  |  |  251|  18.4M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1833:2): [True: 5.51M, False: 82.8M]
  ------------------
 1834|  18.4M|	case FILE_MELONG:
  ------------------
  |  |  263|  18.4M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1834:2): [True: 34, False: 88.3M]
  ------------------
 1835|  18.4M|	case FILE_DATE:
  ------------------
  |  |  246|  18.4M|#define				FILE_DATE		6
  ------------------
  |  Branch (1835:2): [True: 0, False: 88.3M]
  ------------------
 1836|  18.4M|	case FILE_BEDATE:
  ------------------
  |  |  249|  18.4M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1836:2): [True: 207, False: 88.3M]
  ------------------
 1837|  18.4M|	case FILE_LEDATE:
  ------------------
  |  |  252|  18.4M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1837:2): [True: 383, False: 88.3M]
  ------------------
 1838|  18.4M|	case FILE_MEDATE:
  ------------------
  |  |  261|  18.4M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1838:2): [True: 68, False: 88.3M]
  ------------------
 1839|  18.4M|	case FILE_LDATE:
  ------------------
  |  |  254|  18.4M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1839:2): [True: 0, False: 88.3M]
  ------------------
 1840|  18.4M|	case FILE_BELDATE:
  ------------------
  |  |  255|  18.4M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1840:2): [True: 614, False: 88.3M]
  ------------------
 1841|  18.4M|	case FILE_LELDATE:
  ------------------
  |  |  256|  18.4M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1841:2): [True: 68, False: 88.3M]
  ------------------
 1842|  18.4M|	case FILE_MELDATE:
  ------------------
  |  |  262|  18.4M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1842:2): [True: 0, False: 88.3M]
  ------------------
 1843|  18.4M|	case FILE_FLOAT:
  ------------------
  |  |  273|  18.4M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1843:2): [True: 0, False: 88.3M]
  ------------------
 1844|  18.4M|	case FILE_BEFLOAT:
  ------------------
  |  |  274|  18.4M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1844:2): [True: 0, False: 88.3M]
  ------------------
 1845|  18.4M|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  18.4M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1845:2): [True: 4.30k, False: 88.3M]
  ------------------
 1846|  18.4M|		if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  18.4M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  36.9M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 973k, False: 17.5M]
  |  |  |  Branch (72:59): [True: 1.33M, False: 16.1M]
  |  |  ------------------
  ------------------
 1847|  2.31M|			return 0;
 1848|  16.1M|		break;
 1849|       |
 1850|  16.1M|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1850:2): [True: 0, False: 88.3M]
  ------------------
 1851|    240|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    240|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1851:2): [True: 240, False: 88.3M]
  ------------------
 1852|  1.05k|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|  1.05k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1852:2): [True: 814, False: 88.3M]
  ------------------
 1853|  1.05k|		if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|  1.05k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.10k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 360, False: 694]
  |  |  |  Branch (72:59): [True: 216, False: 478]
  |  |  ------------------
  ------------------
 1854|    576|			return 0;
 1855|    478|		break;
 1856|       |
 1857|   162k|	case FILE_GUID:
  ------------------
  |  |  289|   162k|#define				FILE_GUID		49
  ------------------
  |  Branch (1857:2): [True: 162k, False: 88.2M]
  ------------------
 1858|   162k|		if (OFFSET_OOB(nbytes, offset, 16))
  ------------------
  |  |   72|   162k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   325k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 162k]
  |  |  |  Branch (72:59): [True: 25.6k, False: 137k]
  |  |  ------------------
  ------------------
 1859|  25.6k|			return 0;
 1860|   137k|		break;
 1861|       |
 1862|  57.8M|	case FILE_STRING:
  ------------------
  |  |  245|  57.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (1862:2): [True: 57.8M, False: 30.5M]
  ------------------
 1863|  57.8M|	case FILE_PSTRING:
  ------------------
  |  |  253|  57.8M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1863:2): [True: 29.3k, False: 88.3M]
  ------------------
 1864|  58.7M|	case FILE_SEARCH:
  ------------------
  |  |  260|  58.7M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1864:2): [True: 842k, False: 87.5M]
  ------------------
 1865|  58.7M|	case FILE_OCTAL:
  ------------------
  |  |  299|  58.7M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1865:2): [True: 0, False: 88.3M]
  ------------------
 1866|  58.7M|		if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|  58.7M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   117M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 3.89M, False: 54.8M]
  |  |  |  Branch (72:59): [True: 9.49M, False: 45.3M]
  |  |  ------------------
  ------------------
 1867|  13.3M|			return 0;
 1868|  45.3M|		break;
 1869|       |
 1870|  45.3M|	case FILE_REGEX:
  ------------------
  |  |  257|   215k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1870:2): [True: 215k, False: 88.1M]
  ------------------
 1871|   215k|		if (nbytes < offset)
  ------------------
  |  Branch (1871:7): [True: 1.59k, False: 214k]
  ------------------
 1872|  1.59k|			return 0;
 1873|   214k|		break;
 1874|       |
 1875|   214k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  22.8k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1875:2): [True: 22.8k, False: 88.3M]
  ------------------
 1876|  22.8k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  375|  22.8k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  427|  22.8k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  388|  22.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1876:7): [True: 13.2k, False: 9.60k]
  ------------------
 1877|  13.2k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  444|  13.2k|#define CAST(T, b)	((T)(b))
  ------------------
 1878|  22.8k|		if (offset == 0)
  ------------------
  |  Branch (1878:7): [True: 1.20k, False: 21.6k]
  ------------------
 1879|  1.20k|			return 0;
 1880|       |
 1881|  21.6k|		if (nbytes < offset)
  ------------------
  |  Branch (1881:7): [True: 3.16k, False: 18.4k]
  ------------------
 1882|  3.16k|			return 0;
 1883|       |
 1884|  18.4k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1884:7): [True: 1.13k, False: 17.3k]
  ------------------
 1885|  1.13k|			return -1;
 1886|       |
 1887|  17.3k|		(*indir_count)++;
 1888|  17.3k|		bb = *b;
 1889|  17.3k|		bb.fbuf = s + offset;
 1890|  17.3k|		bb.flen = nbytes - offset;
 1891|  17.3k|		bb.ebuf = NULL;
 1892|  17.3k|		bb.elen = 0;
 1893|  17.3k|		rv = -1;
 1894|  20.8k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1894:34): [True: 17.3k, False: 3.56k]
  ------------------
 1895|  17.3k|		    mlp = mlp->next)
 1896|  17.3k|		{
 1897|  17.3k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1897:8): [True: 13.7k, False: 3.56k]
  ------------------
 1898|  17.3k|			    mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  228|  17.3k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1899|  17.3k|			    name_count, printed_something, need_separator,
 1900|  17.3k|			    firstline, NULL, NULL)) != 0)
 1901|  13.7k|				break;
 1902|  17.3k|		}
 1903|  17.3k|		buffer_fini(&bb);
 1904|       |
 1905|  17.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  17.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1905:7): [True: 0, False: 17.3k]
  ------------------
 1906|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1907|       |
 1908|  17.3k|		rbuf = file_pop_buffer(ms, pb);
 1909|  17.3k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  3.97k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1909:7): [True: 3.97k, False: 13.3k]
  |  Branch (1909:23): [True: 1.27k, False: 2.70k]
  ------------------
 1910|  1.27k|			return -1;
 1911|       |
 1912|  16.0k|		if (rv == 1) {
  ------------------
  |  Branch (1912:7): [True: 12.4k, False: 3.56k]
  ------------------
 1913|  12.4k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  12.4k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  12.4k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  12.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  12.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  12.4k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1913:8): [True: 12.4k, False: 0]
  ------------------
 1914|  12.4k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  158|  12.4k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1914:8): [True: 0, False: 12.4k]
  ------------------
 1915|      0|			{
 1916|      0|				free(rbuf);
 1917|      0|				return -1;
 1918|      0|			}
 1919|  12.4k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1919:8): [True: 83, False: 12.3k]
  ------------------
 1920|     83|				free(rbuf);
 1921|     83|				return -1;
 1922|     83|			}
 1923|  12.4k|		}
 1924|  15.9k|		free(rbuf);
 1925|  15.9k|		return rv;
 1926|       |
 1927|  67.7k|	case FILE_USE:
  ------------------
  |  |  286|  67.7k|#define				FILE_USE		46
  ------------------
  |  Branch (1927:2): [True: 67.7k, False: 88.3M]
  ------------------
 1928|  67.7k|		if (nbytes < offset)
  ------------------
  |  Branch (1928:7): [True: 8.48k, False: 59.2k]
  ------------------
 1929|  8.48k|			return 0;
 1930|  59.2k|		rbuf = m->value.s;
 1931|  59.2k|		if (*rbuf == '^') {
  ------------------
  |  Branch (1931:7): [True: 469, False: 58.8k]
  ------------------
 1932|    469|			rbuf++;
 1933|    469|			flip = !flip;
 1934|    469|		}
 1935|  59.2k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (1935:7): [True: 0, False: 59.2k]
  ------------------
 1936|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 1937|      0|			return -1;
 1938|      0|		}
 1939|  59.2k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (1939:7): [True: 0, False: 59.2k]
  ------------------
 1940|      0|			file_error(ms, errno, "can't allocate continuation");
 1941|      0|			return -1;
 1942|      0|		}
 1943|       |
 1944|  59.2k|		oneed_separator = *need_separator;
 1945|  59.2k|		if (m->flag & NOSPACE)
  ------------------
  |  |  227|  59.2k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (1945:7): [True: 18.0k, False: 41.2k]
  ------------------
 1946|  18.0k|			*need_separator = 0;
 1947|       |
 1948|  59.2k|		nfound_match = 0;
 1949|  59.2k|		(*name_count)++;
 1950|  59.2k|		eoffset = ms->eoffset;
 1951|  59.2k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 1952|  59.2k|		    offset + o, mode, text, flip, indir_count, name_count,
 1953|  59.2k|		    printed_something, need_separator, firstline, returnval,
 1954|  59.2k|		    &nfound_match);
 1955|  59.2k|		ms->ms_value.q = nfound_match;
 1956|  59.2k|		(*name_count)--;
 1957|  59.2k|		*found_match |= nfound_match;
 1958|       |
 1959|  59.2k|		restore_cont(ms, &c);
 1960|       |
 1961|  59.2k|		if (rv != 1)
  ------------------
  |  Branch (1961:7): [True: 7.05k, False: 52.2k]
  ------------------
 1962|  7.05k|		    *need_separator = oneed_separator;
 1963|  59.2k|		ms->offset = offset;
 1964|  59.2k|		ms->eoffset = eoffset;
 1965|  59.2k|		return rv || *found_match;
  ------------------
  |  Branch (1965:10): [True: 54.7k, False: 4.52k]
  |  Branch (1965:16): [True: 0, False: 4.52k]
  ------------------
 1966|       |
 1967|  59.2k|	case FILE_NAME:
  ------------------
  |  |  285|  59.2k|#define				FILE_NAME		45
  ------------------
  |  Branch (1967:2): [True: 59.2k, False: 88.3M]
  ------------------
 1968|  59.2k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  59.2k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  59.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  59.2k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  59.2k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  59.2k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  59.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1968:7): [True: 0, False: 59.2k]
  ------------------
 1969|      0|			return 1;
 1970|  59.2k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (1970:7): [True: 0, False: 59.2k]
  ------------------
 1971|      0|			return -1;
 1972|  59.2k|		return 1;
 1973|   368k|	case FILE_DER:
  ------------------
  |  |  288|   368k|#define				FILE_DER		48
  ------------------
  |  Branch (1973:2): [True: 368k, False: 88.0M]
  ------------------
 1974|   375k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  243|   375k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1974:2): [True: 6.89k, False: 88.3M]
  ------------------
 1975|   375k|	case FILE_CLEAR:
  ------------------
  |  |  287|   375k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1975:2): [True: 460, False: 88.3M]
  ------------------
 1976|  1.88M|	default:
  ------------------
  |  Branch (1976:2): [True: 1.50M, False: 86.8M]
  ------------------
 1977|  1.88M|		break;
 1978|  88.3M|	}
 1979|  71.7M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (1979:6): [True: 72, False: 71.7M]
  ------------------
 1980|     72|		return 0;
 1981|  71.7M|	return 1;
 1982|  71.7M|}
softmagic.c:mcopy:
 1325|  88.4M|{
 1326|  88.4M|	size_t size = sizeof(*p);
 1327|       |	/*
 1328|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1329|       |	 * anything, but setup pointers into the source
 1330|       |	 */
 1331|  88.4M|	if (indir == 0) {
  ------------------
  |  Branch (1331:6): [True: 88.3M, False: 121k]
  ------------------
 1332|  88.3M|		switch (type) {
 1333|   368k|		case FILE_DER:
  ------------------
  |  |  288|   368k|#define				FILE_DER		48
  ------------------
  |  Branch (1333:3): [True: 368k, False: 88.0M]
  ------------------
 1334|  1.21M|		case FILE_SEARCH:
  ------------------
  |  |  260|  1.21M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1334:3): [True: 842k, False: 87.5M]
  ------------------
 1335|  1.21M|			if (offset > nbytes)
  ------------------
  |  Branch (1335:8): [True: 64.4k, False: 1.14M]
  ------------------
 1336|  64.4k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  444|  64.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1337|  1.21M|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  445|  1.21M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1338|  1.21M|			ms->search.s_len = nbytes - offset;
 1339|  1.21M|			ms->search.offset = offset;
 1340|  1.21M|			return 0;
 1341|       |
 1342|   215k|		case FILE_REGEX: {
  ------------------
  |  |  257|   215k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1342:3): [True: 215k, False: 88.1M]
  ------------------
 1343|   215k|			const char *b;
 1344|   215k|			const char *c;
 1345|   215k|			const char *last;	/* end of search region */
 1346|   215k|			const char *buf;	/* start of search region */
 1347|   215k|			const char *end;
 1348|   215k|			size_t lines, linecnt, bytecnt;
 1349|       |
 1350|   215k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1350:8): [True: 0, False: 215k]
  |  Branch (1350:21): [True: 1.62k, False: 214k]
  ------------------
 1351|  1.62k|				ms->search.s_len = 0;
 1352|  1.62k|				ms->search.s = NULL;
 1353|  1.62k|				return 0;
 1354|  1.62k|			}
 1355|       |
 1356|   214k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  375|   214k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  402|   214k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  388|   214k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1356:8): [True: 55.0k, False: 159k]
  ------------------
 1357|  55.0k|				linecnt = m->str_range;
  ------------------
  |  |  374|  55.0k|#define str_range _u._s._count
  ------------------
 1358|  55.0k|				bytecnt = linecnt * 80;
 1359|   159k|			} else {
 1360|   159k|				linecnt = 0;
 1361|   159k|				bytecnt = m->str_range;
  ------------------
  |  |  374|   159k|#define str_range _u._s._count
  ------------------
 1362|   159k|			}
 1363|       |
 1364|   214k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1364:8): [True: 136k, False: 78.2k]
  |  Branch (1364:24): [True: 68.0k, False: 10.1k]
  ------------------
 1365|   204k|				bytecnt = nbytes - offset;
 1366|   214k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1366:8): [True: 20.1k, False: 194k]
  ------------------
 1367|  20.1k|				bytecnt = ms->regex_max;
 1368|       |
 1369|   214k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  445|   214k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1370|   214k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  445|   214k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1371|       |			/* mget() guarantees buf <= last */
 1372|   471k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1372:35): [True: 309k, False: 161k]
  |  Branch (1372:44): [True: 306k, False: 3.13k]
  ------------------
 1373|   471k|			     ((b = CAST(const char *,
  ------------------
  |  |  444|   306k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1373:10): [True: 192k, False: 114k]
  ------------------
 1374|   306k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1375|   306k|			     || (b = CAST(const char *,
  ------------------
  |  |  444|   114k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1375:12): [True: 64.8k, False: 49.4k]
  ------------------
 1376|   114k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1377|   256k|			     lines--, b++) {
 1378|   256k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1378:9): [True: 254k, False: 2.18k]
  |  Branch (1378:24): [True: 64.3k, False: 190k]
  |  Branch (1378:40): [True: 0, False: 64.3k]
  ------------------
 1379|      0|					b++;
 1380|   256k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1380:9): [True: 254k, False: 2.18k]
  |  Branch (1380:24): [True: 190k, False: 64.3k]
  ------------------
 1381|   190k|					b++;
 1382|   256k|				last = b;
 1383|   256k|			}
 1384|   214k|			if (lines)
  ------------------
  |  Branch (1384:8): [True: 52.5k, False: 161k]
  ------------------
 1385|  52.5k|				last = end;
 1386|       |
 1387|   214k|			ms->search.s = buf;
 1388|   214k|			ms->search.s_len = last - buf;
 1389|   214k|			ms->search.offset = offset;
 1390|   214k|			ms->search.rm_len = 0;
 1391|   214k|			return 0;
 1392|   215k|		}
 1393|     98|		case FILE_BESTRING16:
  ------------------
  |  |  258|     98|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1393:3): [True: 98, False: 88.3M]
  ------------------
 1394|  54.8k|		case FILE_LESTRING16: {
  ------------------
  |  |  259|  54.8k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1394:3): [True: 54.7k, False: 88.3M]
  ------------------
 1395|  54.8k|			const unsigned char *src = s + offset;
 1396|  54.8k|			const unsigned char *esrc = s + nbytes;
 1397|  54.8k|			char *dst = p->s;
 1398|  54.8k|			char *edst = &p->s[sizeof(p->s) - 1];
 1399|       |
 1400|  54.8k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  258|  54.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1400:8): [True: 98, False: 54.7k]
  ------------------
 1401|     98|				src++;
 1402|       |
 1403|       |			/* check that offset is within range */
 1404|  54.8k|			if (offset >= nbytes)
  ------------------
  |  Branch (1404:8): [True: 2.02k, False: 52.7k]
  ------------------
 1405|  2.02k|				break;
 1406|  2.39M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1406:20): [True: 2.35M, False: 39.7k]
  ------------------
 1407|  2.35M|				if (dst < edst)
  ------------------
  |  Branch (1407:9): [True: 2.33M, False: 13.0k]
  ------------------
 1408|  2.33M|					*dst = *src;
 1409|  13.0k|				else
 1410|  13.0k|					break;
 1411|  2.33M|				if (*dst == '\0') {
  ------------------
  |  Branch (1411:9): [True: 1.08M, False: 1.25M]
  ------------------
 1412|  1.08M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  258|  1.08M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1412:10): [True: 3.22k, False: 1.08M]
  |  Branch (1412:10): [True: 212k, False: 873k]
  ------------------
 1413|  3.22k|					    *(src - 1) != '\0' :
 1414|  1.08M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1414:11): [True: 1.08M, False: 2.23k]
  ------------------
 1415|  1.08M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1415:10): [True: 211k, False: 868k]
  ------------------
 1416|   212k|						*dst = ' ';
 1417|  1.08M|				}
 1418|  2.33M|			}
 1419|  52.7k|			*edst = '\0';
 1420|  52.7k|			return 0;
 1421|  54.8k|		}
 1422|  57.8M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  245|  57.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (1422:3): [True: 57.8M, False: 30.5M]
  ------------------
 1423|  57.8M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  253|  57.8M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1423:3): [True: 29.3k, False: 88.3M]
  ------------------
 1424|  57.8M|			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  374|  57.8M|#define str_range _u._s._count
  ------------------
              			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  374|     32|#define str_range _u._s._count
  ------------------
  |  Branch (1424:8): [True: 32, False: 57.8M]
  |  Branch (1424:29): [True: 32, False: 0]
  ------------------
 1425|     32|				size = m->str_range;
  ------------------
  |  |  374|     32|#define str_range _u._s._count
  ------------------
 1426|  57.8M|			break;
 1427|  28.9M|		default:
  ------------------
  |  Branch (1427:3): [True: 28.9M, False: 59.3M]
  ------------------
 1428|  28.9M|			break;
 1429|  88.3M|		}
 1430|  88.3M|	}
 1431|       |
 1432|  87.0M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  290|  87.0M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1432:6): [True: 0, False: 87.0M]
  ------------------
 1433|      0|		(void)memset(p, '\0', sizeof(*p));
 1434|      0|		p->q = offset;
 1435|      0|		return 0;
 1436|      0|	}
 1437|       |
 1438|  87.0M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1438:6): [True: 7.17M, False: 79.8M]
  ------------------
 1439|  7.17M|		(void)memset(p, '\0', sizeof(*p));
 1440|  7.17M|		return 0;
 1441|  7.17M|	}
 1442|  79.8M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1442:6): [True: 57.0M, False: 22.7M]
  ------------------
 1443|  57.0M|		nbytes = nbytes - offset;
 1444|  22.7M|	else
 1445|  22.7M|		nbytes = size;
 1446|       |
 1447|  79.8M|	(void)memcpy(p, s + offset, nbytes);
 1448|       |
 1449|       |	/*
 1450|       |	 * the usefulness of padding with zeroes eludes me, it
 1451|       |	 * might even cause problems
 1452|       |	 */
 1453|  79.8M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1453:6): [True: 57.0M, False: 22.7M]
  ------------------
 1454|  57.0M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  445|  57.0M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1455|  57.0M|		    sizeof(*p) - nbytes);
 1456|  79.8M|	return 0;
 1457|  87.0M|}
softmagic.c:cvt_flip:
 1001|  71.8M|{
 1002|  71.8M|	if (flip == 0)
  ------------------
  |  Branch (1002:6): [True: 71.8M, False: 15.7k]
  ------------------
 1003|  71.8M|		return type;
 1004|  15.7k|	switch (type) {
 1005|     79|	case FILE_BESHORT:
  ------------------
  |  |  247|     79|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1005:2): [True: 79, False: 15.6k]
  ------------------
 1006|     79|		return FILE_LESHORT;
  ------------------
  |  |  250|     79|#define				FILE_LESHORT		10
  ------------------
 1007|  1.68k|	case FILE_BELONG:
  ------------------
  |  |  248|  1.68k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1007:2): [True: 1.68k, False: 14.0k]
  ------------------
 1008|  1.68k|		return FILE_LELONG;
  ------------------
  |  |  251|  1.68k|#define				FILE_LELONG		11
  ------------------
 1009|     32|	case FILE_BEDATE:
  ------------------
  |  |  249|     32|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1009:2): [True: 32, False: 15.7k]
  ------------------
 1010|     32|		return FILE_LEDATE;
  ------------------
  |  |  252|     32|#define				FILE_LEDATE		12
  ------------------
 1011|      0|	case FILE_BELDATE:
  ------------------
  |  |  255|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1011:2): [True: 0, False: 15.7k]
  ------------------
 1012|      0|		return FILE_LELDATE;
  ------------------
  |  |  256|      0|#define				FILE_LELDATE		16
  ------------------
 1013|     30|	case FILE_BEQUAD:
  ------------------
  |  |  266|     30|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1013:2): [True: 30, False: 15.7k]
  ------------------
 1014|     30|		return FILE_LEQUAD;
  ------------------
  |  |  265|     30|#define				FILE_LEQUAD		25
  ------------------
 1015|    130|	case FILE_BEQDATE:
  ------------------
  |  |  269|    130|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1015:2): [True: 130, False: 15.6k]
  ------------------
 1016|    130|		return FILE_LEQDATE;
  ------------------
  |  |  268|    130|#define				FILE_LEQDATE		28
  ------------------
 1017|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1017:2): [True: 0, False: 15.7k]
  ------------------
 1018|      0|		return FILE_LEQLDATE;
  ------------------
  |  |  271|      0|#define				FILE_LEQLDATE		31
  ------------------
 1019|      0|	case FILE_BEQWDATE:
  ------------------
  |  |  284|      0|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1019:2): [True: 0, False: 15.7k]
  ------------------
 1020|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  283|      0|#define				FILE_LEQWDATE		43
  ------------------
 1021|  12.5k|	case FILE_LESHORT:
  ------------------
  |  |  250|  12.5k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1021:2): [True: 12.5k, False: 3.17k]
  ------------------
 1022|  12.5k|		return FILE_BESHORT;
  ------------------
  |  |  247|  12.5k|#define				FILE_BESHORT		7
  ------------------
 1023|    343|	case FILE_LELONG:
  ------------------
  |  |  251|    343|#define				FILE_LELONG		11
  ------------------
  |  Branch (1023:2): [True: 343, False: 15.4k]
  ------------------
 1024|    343|		return FILE_BELONG;
  ------------------
  |  |  248|    343|#define				FILE_BELONG		8
  ------------------
 1025|     37|	case FILE_LEDATE:
  ------------------
  |  |  252|     37|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1025:2): [True: 37, False: 15.7k]
  ------------------
 1026|     37|		return FILE_BEDATE;
  ------------------
  |  |  249|     37|#define				FILE_BEDATE		9
  ------------------
 1027|      0|	case FILE_LELDATE:
  ------------------
  |  |  256|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1027:2): [True: 0, False: 15.7k]
  ------------------
 1028|      0|		return FILE_BELDATE;
  ------------------
  |  |  255|      0|#define				FILE_BELDATE		15
  ------------------
 1029|     92|	case FILE_LEQUAD:
  ------------------
  |  |  265|     92|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1029:2): [True: 92, False: 15.6k]
  ------------------
 1030|     92|		return FILE_BEQUAD;
  ------------------
  |  |  266|     92|#define				FILE_BEQUAD		26
  ------------------
 1031|      0|	case FILE_LEQDATE:
  ------------------
  |  |  268|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1031:2): [True: 0, False: 15.7k]
  ------------------
 1032|      0|		return FILE_BEQDATE;
  ------------------
  |  |  269|      0|#define				FILE_BEQDATE		29
  ------------------
 1033|     18|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     18|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1033:2): [True: 18, False: 15.7k]
  ------------------
 1034|     18|		return FILE_BEQLDATE;
  ------------------
  |  |  272|     18|#define				FILE_BEQLDATE		32
  ------------------
 1035|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  283|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1035:2): [True: 0, False: 15.7k]
  ------------------
 1036|      0|		return FILE_BEQWDATE;
  ------------------
  |  |  284|      0|#define				FILE_BEQWDATE		44
  ------------------
 1037|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1037:2): [True: 0, False: 15.7k]
  ------------------
 1038|      0|		return FILE_LEFLOAT;
  ------------------
  |  |  275|      0|#define				FILE_LEFLOAT		35
  ------------------
 1039|      0|	case FILE_LEFLOAT:
  ------------------
  |  |  275|      0|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1039:2): [True: 0, False: 15.7k]
  ------------------
 1040|      0|		return FILE_BEFLOAT;
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
 1041|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1041:2): [True: 0, False: 15.7k]
  ------------------
 1042|      0|		return FILE_LEDOUBLE;
  ------------------
  |  |  278|      0|#define				FILE_LEDOUBLE		38
  ------------------
 1043|      0|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|      0|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1043:2): [True: 0, False: 15.7k]
  ------------------
 1044|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1045|    723|	default:
  ------------------
  |  Branch (1045:2): [True: 723, False: 15.0k]
  ------------------
 1046|    723|		return type;
 1047|  15.7k|	}
 1048|  15.7k|}
softmagic.c:do_ops:
 1462|   113k|{
 1463|   113k|	intmax_t offset;
 1464|       |	// On purpose not INTMAX_MAX
 1465|   113k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1465:6): [True: 798, False: 113k]
  |  Branch (1465:25): [True: 105, False: 112k]
  ------------------
 1466|   113k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1466:6): [True: 210, False: 112k]
  |  Branch (1466:25): [True: 0, False: 112k]
  ------------------
 1467|  1.11k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.11k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1467:7): [True: 0, False: 1.11k]
  ------------------
 1468|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1469|  1.11k|		return 1;
 1470|  1.11k|	}
 1471|       |	   
 1472|   112k|	if (off) {
  ------------------
  |  Branch (1472:6): [True: 76.1k, False: 36.6k]
  ------------------
 1473|  76.1k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  345|  76.1k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1473:11): [True: 0, False: 76.1k]
  ------------------
 1474|     68|		case FILE_OPAND:
  ------------------
  |  |  337|     68|#define				FILE_OPAND	0
  ------------------
  |  Branch (1474:3): [True: 68, False: 76.0k]
  ------------------
 1475|     68|			offset = lhs & off;
 1476|     68|			break;
 1477|      0|		case FILE_OPOR:
  ------------------
  |  |  338|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1477:3): [True: 0, False: 76.1k]
  ------------------
 1478|      0|			offset = lhs | off;
 1479|      0|			break;
 1480|      0|		case FILE_OPXOR:
  ------------------
  |  |  339|      0|#define				FILE_OPXOR	2
  ------------------
  |  Branch (1480:3): [True: 0, False: 76.1k]
  ------------------
 1481|      0|			offset = lhs ^ off;
 1482|      0|			break;
 1483|  69.7k|		case FILE_OPADD:
  ------------------
  |  |  340|  69.7k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1483:3): [True: 69.7k, False: 6.34k]
  ------------------
 1484|  69.7k|			offset = lhs + off;
 1485|  69.7k|			break;
 1486|  1.73k|		case FILE_OPMINUS:
  ------------------
  |  |  341|  1.73k|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1486:3): [True: 1.73k, False: 74.3k]
  ------------------
 1487|  1.73k|			offset = lhs - off;
 1488|  1.73k|			break;
 1489|  4.50k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  342|  4.50k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1489:3): [True: 4.50k, False: 71.6k]
  ------------------
 1490|  4.50k|			offset = lhs * off;
 1491|  4.50k|			break;
 1492|     34|		case FILE_OPDIVIDE:
  ------------------
  |  |  343|     34|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1492:3): [True: 34, False: 76.0k]
  ------------------
 1493|     34|			offset = lhs / off;
 1494|     34|			break;
 1495|      0|		case FILE_OPMODULO:
  ------------------
  |  |  344|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1495:3): [True: 0, False: 76.1k]
  ------------------
 1496|      0|			offset = lhs % off;
 1497|      0|			break;
 1498|  76.1k|		}
 1499|  76.1k|	} else
 1500|  36.6k|		offset = lhs;
 1501|   112k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  349|   112k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1501:6): [True: 0, False: 112k]
  ------------------
 1502|      0|		offset = ~offset;
 1503|   112k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1503:6): [True: 591, False: 112k]
  ------------------
 1504|    591|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    591|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1504:7): [True: 0, False: 591]
  ------------------
 1505|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1506|    591|		return 1;
 1507|    591|	}
 1508|   112k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  444|   112k|#define CAST(T, b)	((T)(b))
  ------------------
 1509|   112k|	return 0;
 1510|   112k|}
softmagic.c:cvt_id3:
  989|     96|{
  990|     96|	v = ((((v >>  0) & 0x7f) <<  0) |
  991|     96|	     (((v >>  8) & 0x7f) <<  7) |
  992|     96|	     (((v >> 16) & 0x7f) << 14) |
  993|     96|	     (((v >> 24) & 0x7f) << 21));
  994|     96|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     96|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (994:6): [True: 0, False: 96]
  ------------------
  995|      0|		fprintf(stderr, "id3 offs=%u\n", v);
  996|     96|	return v;
  997|     96|}
softmagic.c:file_fmtcheck:
  163|   116k|{
  164|   116k|	const char *ptr;
  165|       |
  166|   116k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (166:6): [True: 83.9k, False: 32.3k]
  ------------------
  167|  83.9k|		return desc;
  168|       |
  169|  32.3k|	ptr = fmtcheck(desc, def);
  170|  32.3k|	if (ptr == def)
  ------------------
  |  Branch (170:6): [True: 0, False: 32.3k]
  ------------------
  171|      0|		file_magerror(ms,
  172|      0|		    "%s, %" SIZE_T_FORMAT "u: format `%s' does not match"
  173|      0|		    " with `%s'", file, line, desc, def);
  174|  32.3k|	return ptr;
  175|   116k|}
softmagic.c:save_cont:
 1564|  59.2k|{
 1565|  59.2k|	size_t len;
 1566|  59.2k|	*c = ms->c;
 1567|  59.2k|	len = c->len * sizeof(*c->li);
 1568|  59.2k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  444|  59.2k|#define CAST(T, b)	((T)(b))
  ------------------
 1569|  59.2k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1569:6): [True: 0, False: 59.2k]
  ------------------
 1570|      0|		ms->c = *c;
 1571|      0|		return -1;
 1572|      0|	}
 1573|  59.2k|	memcpy(ms->c.li, c->li, len);
 1574|  59.2k|	return 0;
 1575|  59.2k|}
softmagic.c:restore_cont:
 1579|  59.2k|{
 1580|  59.2k|	free(ms->c.li);
 1581|  59.2k|	ms->c = *c;
 1582|  59.2k|}
softmagic.c:mconvert:
 1152|  71.7M|{
 1153|  71.7M|	union VALUETYPE *p = &ms->ms_value;
 1154|       |
 1155|  71.7M|	switch (cvt_flip(m->type, flip)) {
 1156|  1.14M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.14M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1156:2): [True: 1.14M, False: 70.6M]
  ------------------
 1157|  1.14M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1157:7): [True: 0, False: 1.14M]
  ------------------
 1158|      0|			goto out;
 1159|  1.14M|		return 1;
 1160|   853k|	case FILE_SHORT:
  ------------------
  |  |  242|   853k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1160:2): [True: 853k, False: 70.9M]
  ------------------
 1161|   853k|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|   853k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1161:2): [True: 0, False: 71.7M]
  ------------------
 1162|   853k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|   853k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1162:2): [True: 67, False: 71.7M]
  ------------------
 1163|   853k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|   853k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1163:2): [True: 0, False: 71.7M]
  ------------------
 1164|   853k|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|   853k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1164:2): [True: 0, False: 71.7M]
  ------------------
 1165|   853k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|   853k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1165:2): [True: 67, False: 71.7M]
  ------------------
 1166|   853k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|   853k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1166:2): [True: 0, False: 71.7M]
  ------------------
 1167|   853k|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1167:7): [True: 0, False: 853k]
  ------------------
 1168|      0|			goto out;
 1169|   853k|		return 1;
 1170|  1.22M|	case FILE_LONG:
  ------------------
  |  |  244|  1.22M|#define				FILE_LONG		4
  ------------------
  |  Branch (1170:2): [True: 1.22M, False: 70.5M]
  ------------------
 1171|  1.22M|	case FILE_DATE:
  ------------------
  |  |  246|  1.22M|#define				FILE_DATE		6
  ------------------
  |  Branch (1171:2): [True: 0, False: 71.7M]
  ------------------
 1172|  1.22M|	case FILE_LDATE:
  ------------------
  |  |  254|  1.22M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1172:2): [True: 0, False: 71.7M]
  ------------------
 1173|  1.22M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1173:7): [True: 0, False: 1.22M]
  ------------------
 1174|      0|			goto out;
 1175|  1.22M|		return 1;
 1176|  55.9k|	case FILE_QUAD:
  ------------------
  |  |  264|  55.9k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1176:2): [True: 55.9k, False: 71.7M]
  ------------------
 1177|  55.9k|	case FILE_QDATE:
  ------------------
  |  |  267|  55.9k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1177:2): [True: 0, False: 71.7M]
  ------------------
 1178|  55.9k|	case FILE_QLDATE:
  ------------------
  |  |  270|  55.9k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1178:2): [True: 0, False: 71.7M]
  ------------------
 1179|  56.1k|	case FILE_QWDATE:
  ------------------
  |  |  282|  56.1k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1179:2): [True: 175, False: 71.7M]
  ------------------
 1180|  56.1k|	case FILE_OFFSET:
  ------------------
  |  |  290|  56.1k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1180:2): [True: 0, False: 71.7M]
  ------------------
 1181|  56.1k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1181:7): [True: 0, False: 56.1k]
  ------------------
 1182|      0|			goto out;
 1183|  56.1k|		return 1;
 1184|  44.8M|	case FILE_STRING:
  ------------------
  |  |  245|  44.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (1184:2): [True: 44.8M, False: 26.9M]
  ------------------
 1185|  44.8M|	case FILE_BESTRING16:
  ------------------
  |  |  258|  44.8M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1185:2): [True: 98, False: 71.7M]
  ------------------
 1186|  44.9M|	case FILE_LESTRING16:
  ------------------
  |  |  259|  44.9M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1186:2): [True: 54.7k, False: 71.7M]
  ------------------
 1187|  44.9M|	case FILE_OCTAL: {
  ------------------
  |  |  299|  44.9M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1187:2): [True: 0, False: 71.7M]
  ------------------
 1188|       |		/* Null terminate and eat *trailing* return */
 1189|  44.9M|		p->s[sizeof(p->s) - 1] = '\0';
 1190|  44.9M|		return 1;
 1191|  44.9M|	}
 1192|  19.6k|	case FILE_PSTRING: {
  ------------------
  |  |  253|  19.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1192:2): [True: 19.6k, False: 71.7M]
  ------------------
 1193|  19.6k|		char *ptr1, *ptr2;
 1194|  19.6k|		size_t len, sz = file_pstring_length_size(ms, m);
 1195|  19.6k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  175|  19.6k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1195:7): [True: 0, False: 19.6k]
  ------------------
 1196|      0|			return 0;
 1197|  19.6k|		ptr1 = p->s;
 1198|  19.6k|		ptr2 = ptr1 + sz;
 1199|  19.6k|		len = file_pstring_get_length(ms, m, ptr1);
 1200|  19.6k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  175|  19.6k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1200:7): [True: 72, False: 19.6k]
  ------------------
 1201|     72|			return 0;
 1202|  19.6k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1203|  19.6k|		if (len >= sz) {
  ------------------
  |  Branch (1203:7): [True: 11.2k, False: 8.31k]
  ------------------
 1204|       |			/*
 1205|       |			 * The size of the pascal string length (sz)
 1206|       |			 * is 1, 2, or 4. We need at least 1 byte for NUL
 1207|       |			 * termination, but we've already truncated the
 1208|       |			 * string by p->s, so we need to deduct sz.
 1209|       |			 * Because we can use one of the bytes of the length
 1210|       |			 * after we shifted as NUL termination.
 1211|       |			 */
 1212|  11.2k|			len = sz;
 1213|  11.2k|		}
 1214|  1.77M|		while (len--)
  ------------------
  |  Branch (1214:10): [True: 1.75M, False: 19.6k]
  ------------------
 1215|  1.75M|			*ptr1++ = *ptr2++;
 1216|  19.6k|		*ptr1 = '\0';
 1217|  19.6k|		return 1;
 1218|  19.6k|	}
 1219|  3.60M|	case FILE_BESHORT:
  ------------------
  |  |  247|  3.60M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1219:2): [True: 3.60M, False: 68.1M]
  ------------------
 1220|  3.60M|		p->h = CAST(short, BE16(p));
  ------------------
  |  |  444|  3.60M|#define CAST(T, b)	((T)(b))
  ------------------
 1221|  3.60M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1221:7): [True: 0, False: 3.60M]
  ------------------
 1222|      0|			goto out;
 1223|  3.60M|		return 1;
 1224|  10.3M|	case FILE_BELONG:
  ------------------
  |  |  248|  10.3M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1224:2): [True: 10.3M, False: 61.4M]
  ------------------
 1225|  10.3M|	case FILE_BEDATE:
  ------------------
  |  |  249|  10.3M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1225:2): [True: 173, False: 71.7M]
  ------------------
 1226|  10.3M|	case FILE_BELDATE:
  ------------------
  |  |  255|  10.3M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1226:2): [True: 574, False: 71.7M]
  ------------------
 1227|  10.3M|		p->l = CAST(int32_t, BE32(p));
  ------------------
  |  |  444|  10.3M|#define CAST(T, b)	((T)(b))
  ------------------
 1228|  10.3M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1228:7): [True: 0, False: 10.3M]
  ------------------
 1229|      0|			goto out;
 1230|  10.3M|		return 1;
 1231|   739k|	case FILE_BEQUAD:
  ------------------
  |  |  266|   739k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1231:2): [True: 739k, False: 71.0M]
  ------------------
 1232|   739k|	case FILE_BEQDATE:
  ------------------
  |  |  269|   739k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1232:2): [True: 64, False: 71.7M]
  ------------------
 1233|   739k|	case FILE_BEQLDATE:
  ------------------
  |  |  272|   739k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1233:2): [True: 18, False: 71.7M]
  ------------------
 1234|   739k|	case FILE_BEQWDATE:
  ------------------
  |  |  284|   739k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1234:2): [True: 0, False: 71.7M]
  ------------------
 1235|   739k|		p->q = CAST(uint64_t, BE64(p));
  ------------------
  |  |  444|   739k|#define CAST(T, b)	((T)(b))
  ------------------
 1236|   739k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1236:7): [True: 0, False: 739k]
  ------------------
 1237|      0|			goto out;
 1238|   739k|		return 1;
 1239|  2.38M|	case FILE_LESHORT:
  ------------------
  |  |  250|  2.38M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1239:2): [True: 2.38M, False: 69.3M]
  ------------------
 1240|  2.38M|		p->h = CAST(short, LE16(p));
  ------------------
  |  |  444|  2.38M|#define CAST(T, b)	((T)(b))
  ------------------
 1241|  2.38M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1241:7): [True: 0, False: 2.38M]
  ------------------
 1242|      0|			goto out;
 1243|  2.38M|		return 1;
 1244|  4.64M|	case FILE_LELONG:
  ------------------
  |  |  251|  4.64M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1244:2): [True: 4.64M, False: 67.1M]
  ------------------
 1245|  4.64M|	case FILE_LEDATE:
  ------------------
  |  |  252|  4.64M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1245:2): [True: 344, False: 71.7M]
  ------------------
 1246|  4.64M|	case FILE_LELDATE:
  ------------------
  |  |  256|  4.64M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1246:2): [True: 34, False: 71.7M]
  ------------------
 1247|  4.64M|		p->l = CAST(int32_t, LE32(p));
  ------------------
  |  |  444|  4.64M|#define CAST(T, b)	((T)(b))
  ------------------
 1248|  4.64M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1248:7): [True: 0, False: 4.64M]
  ------------------
 1249|      0|			goto out;
 1250|  4.64M|		return 1;
 1251|   655k|	case FILE_LEQUAD:
  ------------------
  |  |  265|   655k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1251:2): [True: 655k, False: 71.1M]
  ------------------
 1252|   655k|	case FILE_LEQDATE:
  ------------------
  |  |  268|   655k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1252:2): [True: 237, False: 71.7M]
  ------------------
 1253|   655k|	case FILE_LEQLDATE:
  ------------------
  |  |  271|   655k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1253:2): [True: 18, False: 71.7M]
  ------------------
 1254|   657k|	case FILE_LEQWDATE:
  ------------------
  |  |  283|   657k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1254:2): [True: 1.29k, False: 71.7M]
  ------------------
 1255|   657k|		p->q = CAST(uint64_t, LE64(p));
  ------------------
  |  |  444|   657k|#define CAST(T, b)	((T)(b))
  ------------------
 1256|   657k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1256:7): [True: 0, False: 657k]
  ------------------
 1257|      0|			goto out;
 1258|   657k|		return 1;
 1259|     34|	case FILE_MELONG:
  ------------------
  |  |  263|     34|#define				FILE_MELONG		23
  ------------------
  |  Branch (1259:2): [True: 34, False: 71.7M]
  ------------------
 1260|    102|	case FILE_MEDATE:
  ------------------
  |  |  261|    102|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1260:2): [True: 68, False: 71.7M]
  ------------------
 1261|    102|	case FILE_MELDATE:
  ------------------
  |  |  262|    102|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1261:2): [True: 0, False: 71.7M]
  ------------------
 1262|    102|		p->l = CAST(int32_t, ME32(p));
  ------------------
  |  |  444|    102|#define CAST(T, b)	((T)(b))
  ------------------
 1263|    102|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1263:7): [True: 0, False: 102]
  ------------------
 1264|      0|			goto out;
 1265|    102|		return 1;
 1266|      0|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1266:2): [True: 0, False: 71.7M]
  ------------------
 1267|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1267:7): [True: 0, False: 0]
  ------------------
 1268|      0|			goto out;
 1269|      0|		return 1;
 1270|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1270:2): [True: 0, False: 71.7M]
  ------------------
 1271|      0|		p->l = BE32(p);
  ------------------
  |  |   96|      0|#define BE32(p) ( \
  |  |   97|      0|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|      0|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|      0|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  100|      0|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1272|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1272:7): [True: 0, False: 0]
  ------------------
 1273|      0|			goto out;
 1274|      0|		return 1;
 1275|  4.30k|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  4.30k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1275:2): [True: 4.30k, False: 71.7M]
  ------------------
 1276|  4.30k|		p->l = LE32(p);
  ------------------
  |  |   91|  4.30k|#define LE32(p) ( \
  |  |   92|  4.30k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  4.30k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  4.30k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  4.30k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  4.30k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  4.30k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   95|  4.30k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  444|  4.30k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1277|  4.30k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1277:7): [True: 0, False: 4.30k]
  ------------------
 1278|      0|			goto out;
 1279|  4.30k|		return 1;
 1280|      0|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1280:2): [True: 0, False: 71.7M]
  ------------------
 1281|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1281:7): [True: 0, False: 0]
  ------------------
 1282|      0|			goto out;
 1283|      0|		return 1;
 1284|    118|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    118|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1284:2): [True: 118, False: 71.7M]
  ------------------
 1285|    118|		p->q = BE64(p);
  ------------------
  |  |   73|    118|#define BE64(p) ( \
  |  |   74|    118|    (CAST(uint64_t, (p)->hq[0])<<56)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    118|    (CAST(uint64_t, (p)->hq[1])<<48)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    118|    (CAST(uint64_t, (p)->hq[2])<<40)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    118|    (CAST(uint64_t, (p)->hq[3])<<32)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    118|    (CAST(uint64_t, (p)->hq[4])<<24)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    118|    (CAST(uint64_t, (p)->hq[5])<<16)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   80|    118|    (CAST(uint64_t, (p)->hq[6])<<8)| \
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   81|    118|    (CAST(uint64_t, (p)->hq[7])))
  |  |  ------------------
  |  |  |  |  444|    118|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1286|    118|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1286:7): [True: 0, False: 118]
  ------------------
 1287|      0|			goto out;
 1288|    118|		return 1;
 1289|    360|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    360|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1289:2): [True: 360, False: 71.7M]
  ------------------
 1290|    360|		p->q = LE64(p);
  ------------------
  |  |   82|    360|#define LE64(p) ( \
  |  |   83|    360|    (CAST(uint64_t, (p)->hq[7])<<56)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    360|    (CAST(uint64_t, (p)->hq[6])<<48)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    360|    (CAST(uint64_t, (p)->hq[5])<<40)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    360|    (CAST(uint64_t, (p)->hq[4])<<32)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    360|    (CAST(uint64_t, (p)->hq[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    360|    (CAST(uint64_t, (p)->hq[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    360|    (CAST(uint64_t, (p)->hq[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   90|    360|    (CAST(uint64_t, (p)->hq[0])))
  |  |  ------------------
  |  |  |  |  444|    360|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1291|    360|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1291:7): [True: 0, False: 360]
  ------------------
 1292|      0|			goto out;
 1293|    360|		return 1;
 1294|   214k|	case FILE_REGEX:
  ------------------
  |  |  257|   214k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1294:2): [True: 214k, False: 71.5M]
  ------------------
 1295|   694k|	case FILE_SEARCH:
  ------------------
  |  |  260|   694k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1295:2): [True: 480k, False: 71.2M]
  ------------------
 1296|   701k|	case FILE_DEFAULT:
  ------------------
  |  |  243|   701k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1296:2): [True: 6.89k, False: 71.7M]
  ------------------
 1297|   701k|	case FILE_CLEAR:
  ------------------
  |  |  287|   701k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1297:2): [True: 460, False: 71.7M]
  ------------------
 1298|   701k|	case FILE_NAME:
  ------------------
  |  |  285|   701k|#define				FILE_NAME		45
  ------------------
  |  Branch (1298:2): [True: 0, False: 71.7M]
  ------------------
 1299|   701k|	case FILE_USE:
  ------------------
  |  |  286|   701k|#define				FILE_USE		46
  ------------------
  |  Branch (1299:2): [True: 0, False: 71.7M]
  ------------------
 1300|  1.07M|	case FILE_DER:
  ------------------
  |  |  288|  1.07M|#define				FILE_DER		48
  ------------------
  |  Branch (1300:2): [True: 368k, False: 71.3M]
  ------------------
 1301|  1.20M|	case FILE_GUID:
  ------------------
  |  |  289|  1.20M|#define				FILE_GUID		49
  ------------------
  |  Branch (1301:2): [True: 137k, False: 71.6M]
  ------------------
 1302|  1.20M|		return 1;
 1303|      0|	default:
  ------------------
  |  Branch (1303:2): [True: 0, False: 71.7M]
  ------------------
 1304|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1305|      0|		return 0;
 1306|  71.7M|	}
 1307|      0|out:
 1308|      0|	file_magerror(ms, "zerodivide in mconvert()");
 1309|      0|	return 0;
 1310|  71.7M|}
softmagic.c:cvt_8:
 1086|  1.14M|{
 1087|  1.14M|	DO_CVT(b, uint8_t);
  ------------------
  |  | 1050|  1.14M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.14M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 112k, False: 1.02M]
  |  |  ------------------
  |  | 1051|  1.14M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   112k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 112k]
  |  |  ------------------
  |  | 1052|  94.5k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|  94.5k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 94.5k, False: 17.8k]
  |  |  ------------------
  |  | 1053|  94.5k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  94.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|  94.5k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 112k]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 112k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 0, False: 112k]
  |  |  ------------------
  |  | 1062|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|      0|			break; \
  |  | 1064|  17.6k|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|  17.6k|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 17.6k, False: 94.7k]
  |  |  ------------------
  |  | 1065|  17.6k|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  17.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|  17.6k|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 112k]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|    152|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    152|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 152, False: 112k]
  |  |  ------------------
  |  | 1071|    152|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    152|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 152]
  |  |  ------------------
  |  | 1072|    152|				return -1; \
  |  | 1073|    152|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    152|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    152|			break; \
  |  | 1075|    152|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|     70|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 70, False: 112k]
  |  |  ------------------
  |  | 1076|     70|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|     70|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 70]
  |  |  ------------------
  |  | 1077|     70|				return -1; \
  |  | 1078|     70|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     70|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|     70|			break; \
  |  | 1080|   112k|		} \
  |  | 1081|  1.14M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  1.14M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 1.14M]
  |  |  ------------------
  |  | 1082|  1.14M|		p->fld = ~p->fld \
  ------------------
 1088|  1.14M|	return 0;
 1089|  1.14M|}
softmagic.c:cvt_16:
 1093|  6.85M|{
 1094|  6.85M|	DO_CVT(h, uint16_t);
  ------------------
  |  | 1050|  6.85M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  6.85M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 506k, False: 6.34M]
  |  |  ------------------
  |  | 1051|  6.85M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   506k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 506k]
  |  |  ------------------
  |  | 1052|   482k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|   482k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 482k, False: 24.3k]
  |  |  ------------------
  |  | 1053|   482k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|   482k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|   482k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 506k]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 506k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|     94|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|     94|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 94, False: 506k]
  |  |  ------------------
  |  | 1062|     94|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     94|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     94|			break; \
  |  | 1064|     98|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|     98|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 98, False: 506k]
  |  |  ------------------
  |  | 1065|     98|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     98|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|     98|			break; \
  |  | 1067|    101|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|    101|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 101, False: 506k]
  |  |  ------------------
  |  | 1068|    101|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    101|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|    101|			break; \
  |  | 1070|    129|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    129|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 129, False: 506k]
  |  |  ------------------
  |  | 1071|    129|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    129|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 129]
  |  |  ------------------
  |  | 1072|    129|				return -1; \
  |  | 1073|    129|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    129|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    129|			break; \
  |  | 1075|  23.9k|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|  23.9k|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 23.9k, False: 482k]
  |  |  ------------------
  |  | 1076|  23.9k|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|  23.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 23.9k]
  |  |  ------------------
  |  | 1077|  23.9k|				return -1; \
  |  | 1078|  23.9k|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  23.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|  23.9k|			break; \
  |  | 1080|   506k|		} \
  |  | 1081|  6.85M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  6.85M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 6.85M]
  |  |  ------------------
  |  | 1082|  6.85M|		p->fld = ~p->fld \
  ------------------
 1095|  6.85M|	return 0;
 1096|  6.85M|}
softmagic.c:cvt_32:
 1100|  16.1M|{
 1101|  16.1M|	DO_CVT(l, uint32_t);
  ------------------
  |  | 1050|  16.1M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  16.1M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 3.04M, False: 13.1M]
  |  |  ------------------
  |  | 1051|  16.1M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|  3.04M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 3.04M]
  |  |  ------------------
  |  | 1052|  3.04M|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|  3.04M|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 3.04M, False: 1.44k]
  |  |  ------------------
  |  | 1053|  3.04M|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  3.04M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|  3.04M|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 3.04M]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|     69|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|     69|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 69, False: 3.04M]
  |  |  ------------------
  |  | 1059|     69|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     69|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|     69|			break; \
  |  | 1061|     78|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|     78|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 78, False: 3.04M]
  |  |  ------------------
  |  | 1062|     78|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     78|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     78|			break; \
  |  | 1064|    513|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|    513|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 513, False: 3.04M]
  |  |  ------------------
  |  | 1065|    513|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    513|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|    513|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 3.04M]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|    506|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    506|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 506, False: 3.04M]
  |  |  ------------------
  |  | 1071|    506|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    506|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 506]
  |  |  ------------------
  |  | 1072|    506|				return -1; \
  |  | 1073|    506|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    506|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    506|			break; \
  |  | 1075|    506|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|    276|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 276, False: 3.04M]
  |  |  ------------------
  |  | 1076|    276|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    276|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 276]
  |  |  ------------------
  |  | 1077|    276|				return -1; \
  |  | 1078|    276|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    276|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|    276|			break; \
  |  | 1080|  3.04M|		} \
  |  | 1081|  16.1M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  16.1M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 16.1M]
  |  |  ------------------
  |  | 1082|  16.1M|		p->fld = ~p->fld \
  ------------------
 1102|  16.1M|	return 0;
 1103|  16.1M|}
softmagic.c:cvt_64:
 1107|  1.45M|{
 1108|  1.45M|	DO_CVT(q, uint64_t);
  ------------------
  |  | 1050|  1.45M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.45M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 136k, False: 1.31M]
  |  |  ------------------
  |  | 1051|  1.45M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   136k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 136k]
  |  |  ------------------
  |  | 1052|   136k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|   136k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 136k, False: 135]
  |  |  ------------------
  |  | 1053|   136k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|   136k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|   136k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 136k]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 136k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|     34|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|     34|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 34, False: 136k]
  |  |  ------------------
  |  | 1062|     34|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     34|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     34|			break; \
  |  | 1064|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 136k]
  |  |  ------------------
  |  | 1065|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 136k]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|    101|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    101|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 101, False: 136k]
  |  |  ------------------
  |  | 1071|    101|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    101|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 101]
  |  |  ------------------
  |  | 1072|    101|				return -1; \
  |  | 1073|    101|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    101|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    101|			break; \
  |  | 1075|    101|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|      0|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 0, False: 136k]
  |  |  ------------------
  |  | 1076|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1077|      0|				return -1; \
  |  | 1078|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|      0|			break; \
  |  | 1080|   136k|		} \
  |  | 1081|  1.45M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  1.45M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 1.45M]
  |  |  ------------------
  |  | 1082|  1.45M|		p->fld = ~p->fld \
  ------------------
 1109|  1.45M|	return 0;
 1110|  1.45M|}
softmagic.c:cvt_float:
 1133|  4.30k|{
 1134|  4.30k|	DO_CVT2(f, float);
  ------------------
  |  | 1113|  4.30k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  4.30k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1113:6): [True: 0, False: 4.30k]
  |  |  ------------------
  |  | 1114|  4.30k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1114:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1115|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1115:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1116|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1117|      0|			break; \
  |  | 1118|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1118:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1119|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1120|      0|			break; \
  |  | 1121|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1121:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1122|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1123|      0|			break; \
  |  | 1124|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1124:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1125|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1125:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1126|      0|				return -1; \
  |  | 1127|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1128|      0|			break; \
  |  | 1129|      0|		} \
  ------------------
 1135|  4.30k|	return 0;
 1136|  4.30k|}
softmagic.c:cvt_double:
 1140|    478|{
 1141|    478|	DO_CVT2(d, double);
  ------------------
  |  | 1113|    478|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|    478|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1113:6): [True: 0, False: 478]
  |  |  ------------------
  |  | 1114|    478|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1114:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1115|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1115:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1116|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1117|      0|			break; \
  |  | 1118|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1118:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1119|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1120|      0|			break; \
  |  | 1121|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1121:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1122|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1123|      0|			break; \
  |  | 1124|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1124:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1125|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1125:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1126|      0|				return -1; \
  |  | 1127|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1128|      0|			break; \
  |  | 1129|      0|		} \
  ------------------
 1142|    478|	return 0;
 1143|    478|}
softmagic.c:magiccheck:
 2097|  71.8M|{
 2098|  71.8M|	uint64_t l = m->value.q;
 2099|  71.8M|	uint64_t v;
 2100|  71.8M|	float fl, fv;
 2101|  71.8M|	double dl, dv;
 2102|  71.8M|	int matched;
 2103|  71.8M|	union VALUETYPE *p = &ms->ms_value;
 2104|       |
 2105|  71.8M|	switch (m->type) {
 2106|  1.14M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.14M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2106:2): [True: 1.14M, False: 70.7M]
  ------------------
 2107|  1.14M|		v = p->b;
 2108|  1.14M|		break;
 2109|       |
 2110|   853k|	case FILE_SHORT:
  ------------------
  |  |  242|   853k|#define				FILE_SHORT		2
  ------------------
  |  Branch (2110:2): [True: 853k, False: 71.0M]
  ------------------
 2111|  4.44M|	case FILE_BESHORT:
  ------------------
  |  |  247|  4.44M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2111:2): [True: 3.59M, False: 68.2M]
  ------------------
 2112|  6.85M|	case FILE_LESHORT:
  ------------------
  |  |  250|  6.85M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2112:2): [True: 2.40M, False: 69.4M]
  ------------------
 2113|  6.85M|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|  6.85M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (2113:2): [True: 0, False: 71.8M]
  ------------------
 2114|  6.85M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  6.85M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (2114:2): [True: 67, False: 71.8M]
  ------------------
 2115|  6.85M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  6.85M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (2115:2): [True: 0, False: 71.8M]
  ------------------
 2116|  6.85M|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|  6.85M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (2116:2): [True: 0, False: 71.8M]
  ------------------
 2117|  6.85M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  6.85M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (2117:2): [True: 67, False: 71.8M]
  ------------------
 2118|  6.85M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  6.85M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (2118:2): [True: 0, False: 71.8M]
  ------------------
 2119|  6.85M|		v = p->h;
 2120|  6.85M|		break;
 2121|       |
 2122|  1.22M|	case FILE_LONG:
  ------------------
  |  |  244|  1.22M|#define				FILE_LONG		4
  ------------------
  |  Branch (2122:2): [True: 1.22M, False: 70.6M]
  ------------------
 2123|  11.5M|	case FILE_BELONG:
  ------------------
  |  |  248|  11.5M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2123:2): [True: 10.3M, False: 61.5M]
  ------------------
 2124|  16.1M|	case FILE_LELONG:
  ------------------
  |  |  251|  16.1M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2124:2): [True: 4.64M, False: 67.2M]
  ------------------
 2125|  16.1M|	case FILE_MELONG:
  ------------------
  |  |  263|  16.1M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2125:2): [True: 34, False: 71.8M]
  ------------------
 2126|  16.1M|	case FILE_DATE:
  ------------------
  |  |  246|  16.1M|#define				FILE_DATE		6
  ------------------
  |  Branch (2126:2): [True: 0, False: 71.8M]
  ------------------
 2127|  16.1M|	case FILE_BEDATE:
  ------------------
  |  |  249|  16.1M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2127:2): [True: 168, False: 71.8M]
  ------------------
 2128|  16.1M|	case FILE_LEDATE:
  ------------------
  |  |  252|  16.1M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2128:2): [True: 349, False: 71.8M]
  ------------------
 2129|  16.1M|	case FILE_MEDATE:
  ------------------
  |  |  261|  16.1M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2129:2): [True: 68, False: 71.8M]
  ------------------
 2130|  16.1M|	case FILE_LDATE:
  ------------------
  |  |  254|  16.1M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2130:2): [True: 0, False: 71.8M]
  ------------------
 2131|  16.1M|	case FILE_BELDATE:
  ------------------
  |  |  255|  16.1M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2131:2): [True: 574, False: 71.8M]
  ------------------
 2132|  16.1M|	case FILE_LELDATE:
  ------------------
  |  |  256|  16.1M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2132:2): [True: 34, False: 71.8M]
  ------------------
 2133|  16.1M|	case FILE_MELDATE:
  ------------------
  |  |  262|  16.1M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2133:2): [True: 0, False: 71.8M]
  ------------------
 2134|  16.1M|		v = p->l;
 2135|  16.1M|		break;
 2136|       |
 2137|  55.9k|	case FILE_QUAD:
  ------------------
  |  |  264|  55.9k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2137:2): [True: 55.9k, False: 71.8M]
  ------------------
 2138|   711k|	case FILE_LEQUAD:
  ------------------
  |  |  265|   711k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2138:2): [True: 655k, False: 71.2M]
  ------------------
 2139|  1.45M|	case FILE_BEQUAD:
  ------------------
  |  |  266|  1.45M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2139:2): [True: 739k, False: 71.1M]
  ------------------
 2140|  1.45M|	case FILE_QDATE:
  ------------------
  |  |  267|  1.45M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2140:2): [True: 0, False: 71.8M]
  ------------------
 2141|  1.45M|	case FILE_BEQDATE:
  ------------------
  |  |  269|  1.45M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2141:2): [True: 194, False: 71.8M]
  ------------------
 2142|  1.45M|	case FILE_LEQDATE:
  ------------------
  |  |  268|  1.45M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2142:2): [True: 107, False: 71.8M]
  ------------------
 2143|  1.45M|	case FILE_QLDATE:
  ------------------
  |  |  270|  1.45M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2143:2): [True: 0, False: 71.8M]
  ------------------
 2144|  1.45M|	case FILE_BEQLDATE:
  ------------------
  |  |  272|  1.45M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2144:2): [True: 0, False: 71.8M]
  ------------------
 2145|  1.45M|	case FILE_LEQLDATE:
  ------------------
  |  |  271|  1.45M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2145:2): [True: 36, False: 71.8M]
  ------------------
 2146|  1.45M|	case FILE_QWDATE:
  ------------------
  |  |  282|  1.45M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2146:2): [True: 175, False: 71.8M]
  ------------------
 2147|  1.45M|	case FILE_BEQWDATE:
  ------------------
  |  |  284|  1.45M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2147:2): [True: 0, False: 71.8M]
  ------------------
 2148|  1.45M|	case FILE_LEQWDATE:
  ------------------
  |  |  283|  1.45M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2148:2): [True: 1.29k, False: 71.8M]
  ------------------
 2149|  1.45M|	case FILE_OFFSET:
  ------------------
  |  |  290|  1.45M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (2149:2): [True: 0, False: 71.8M]
  ------------------
 2150|  1.45M|		v = p->q;
 2151|  1.45M|		break;
 2152|       |
 2153|      0|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2153:2): [True: 0, False: 71.8M]
  ------------------
 2154|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2154:2): [True: 0, False: 71.8M]
  ------------------
 2155|  4.30k|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  4.30k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2155:2): [True: 4.30k, False: 71.8M]
  ------------------
 2156|  4.30k|		fl = m->value.f;
 2157|  4.30k|		fv = p->f;
 2158|  4.30k|		switch (m->reln) {
 2159|    429|		case 'x':
  ------------------
  |  Branch (2159:3): [True: 429, False: 3.87k]
  ------------------
 2160|    429|			matched = 1;
 2161|    429|			break;
 2162|       |
 2163|      0|		case '!':
  ------------------
  |  Branch (2163:3): [True: 0, False: 4.30k]
  ------------------
 2164|      0|			matched = isunordered(fl, fv) ? 1 : fv != fl;
 2165|      0|			break;
 2166|       |
 2167|      0|		case '=':
  ------------------
  |  Branch (2167:3): [True: 0, False: 4.30k]
  ------------------
 2168|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
 2169|      0|			break;
 2170|       |
 2171|  3.87k|		case '>':
  ------------------
  |  Branch (2171:3): [True: 3.87k, False: 429]
  ------------------
 2172|  3.87k|			matched = isgreater(fv, fl);
 2173|  3.87k|			break;
 2174|       |
 2175|      0|		case '<':
  ------------------
  |  Branch (2175:3): [True: 0, False: 4.30k]
  ------------------
 2176|      0|			matched = isless(fv, fl);
 2177|      0|			break;
 2178|       |
 2179|      0|		default:
  ------------------
  |  Branch (2179:3): [True: 0, False: 4.30k]
  ------------------
 2180|      0|			file_magerror(ms, "cannot happen with float: "
 2181|      0|			    "invalid relation `%c'", m->reln);
 2182|      0|			return -1;
 2183|  4.30k|		}
 2184|  4.30k|		return matched;
 2185|       |
 2186|      0|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2186:2): [True: 0, False: 71.8M]
  ------------------
 2187|    118|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    118|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2187:2): [True: 118, False: 71.8M]
  ------------------
 2188|    478|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    478|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2188:2): [True: 360, False: 71.8M]
  ------------------
 2189|    478|		dl = m->value.d;
 2190|    478|		dv = p->d;
 2191|    478|		switch (m->reln) {
 2192|    288|		case 'x':
  ------------------
  |  Branch (2192:3): [True: 288, False: 190]
  ------------------
 2193|    288|			matched = 1;
 2194|    288|			break;
 2195|       |
 2196|      0|		case '!':
  ------------------
  |  Branch (2196:3): [True: 0, False: 478]
  ------------------
 2197|      0|			matched = isunordered(dv, dl) ? 1 : dv != dl;
 2198|      0|			break;
 2199|       |
 2200|    190|		case '=':
  ------------------
  |  Branch (2200:3): [True: 190, False: 288]
  ------------------
 2201|    190|			matched = isunordered(dv, dl) ? 0 : dv == dl;
 2202|    190|			break;
 2203|       |
 2204|      0|		case '>':
  ------------------
  |  Branch (2204:3): [True: 0, False: 478]
  ------------------
 2205|      0|			matched = isgreater(dv, dl);
 2206|      0|			break;
 2207|       |
 2208|      0|		case '<':
  ------------------
  |  Branch (2208:3): [True: 0, False: 478]
  ------------------
 2209|      0|			matched = isless(dv, dl);
 2210|      0|			break;
 2211|       |
 2212|      0|		default:
  ------------------
  |  Branch (2212:3): [True: 0, False: 478]
  ------------------
 2213|      0|			file_magerror(ms, "cannot happen with double: "
 2214|      0|			    "invalid relation `%c'", m->reln);
 2215|      0|			return -1;
 2216|    478|		}
 2217|    478|		return matched;
 2218|       |
 2219|  6.89k|	case FILE_DEFAULT:
  ------------------
  |  |  243|  6.89k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2219:2): [True: 6.89k, False: 71.8M]
  ------------------
 2220|  7.35k|	case FILE_CLEAR:
  ------------------
  |  |  287|  7.35k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2220:2): [True: 460, False: 71.8M]
  ------------------
 2221|  7.35k|		l = 0;
 2222|  7.35k|		v = 0;
 2223|  7.35k|		break;
 2224|       |
 2225|  44.8M|	case FILE_STRING:
  ------------------
  |  |  245|  44.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (2225:2): [True: 44.8M, False: 27.0M]
  ------------------
 2226|  44.8M|	case FILE_PSTRING:
  ------------------
  |  |  253|  44.8M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2226:2): [True: 19.6k, False: 71.8M]
  ------------------
 2227|  44.8M|	case FILE_OCTAL:
  ------------------
  |  |  299|  44.8M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (2227:2): [True: 0, False: 71.8M]
  ------------------
 2228|  44.8M|		l = 0;
 2229|  44.8M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  444|  44.8M|#define CAST(T, b)	((T)(b))
  ------------------
 2230|  44.8M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  375|  44.8M|#define str_flags _u._s._flags
  ------------------
 2231|  44.8M|		break;
 2232|       |
 2233|     98|	case FILE_BESTRING16:
  ------------------
  |  |  258|     98|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2233:2): [True: 98, False: 71.8M]
  ------------------
 2234|  54.8k|	case FILE_LESTRING16:
  ------------------
  |  |  259|  54.8k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2234:2): [True: 54.7k, False: 71.8M]
  ------------------
 2235|  54.8k|		l = 0;
 2236|  54.8k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  444|  54.8k|#define CAST(T, b)	((T)(b))
  ------------------
 2237|  54.8k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  375|  54.8k|#define str_flags _u._s._flags
  ------------------
 2238|  54.8k|		break;
 2239|       |
 2240|   480k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  260|   480k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2240:2): [True: 480k, False: 71.4M]
  ------------------
 2241|   480k|		size_t slen;
 2242|   480k|		size_t idx;
 2243|       |
 2244|   480k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2244:7): [True: 0, False: 480k]
  ------------------
 2245|      0|			return 0;
 2246|       |
 2247|   480k|		slen = MIN(m->vallen, sizeof(m->value.s));
 2248|   480k|		l = 0;
 2249|   480k|		v = 0;
 2250|   480k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   480k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2250:7): [True: 0, False: 480k]
  ------------------
 2251|      0|			size_t xlen = ms->search.s_len > 100 ? 100
  ------------------
  |  Branch (2251:18): [True: 0, False: 0]
  ------------------
 2252|      0|			    : ms->search.s_len;
 2253|       |
 2254|      0|			fprintf(stderr, "search: [");
 2255|      0|			file_showstr(stderr, ms->search.s, xlen);
 2256|      0|			fprintf(stderr, "%s] for [", ms->search.s_len == xlen
  ------------------
  |  Branch (2256:33): [True: 0, False: 0]
  ------------------
 2257|      0|			    ? "" : "...");
 2258|      0|			file_showstr(stderr, m->value.s, slen);
 2259|      0|		}
 2260|   480k|#ifdef HAVE_MEMMEM
 2261|   480k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  375|   480k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2261:7): [True: 480k, False: 0]
  |  Branch (2261:19): [True: 280k, False: 199k]
  ------------------
 2262|   280k|			const char *found;
 2263|   280k|			idx = m->str_range + slen;
  ------------------
  |  |  374|   280k|#define str_range _u._s._count
  ------------------
 2264|   280k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  374|   280k|#define str_range _u._s._count
  ------------------
  |  Branch (2264:8): [True: 4.24k, False: 276k]
  |  Branch (2264:29): [True: 108k, False: 168k]
  ------------------
 2265|   112k|				idx = ms->search.s_len;
 2266|   280k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  444|   280k|#define CAST(T, b)	((T)(b))
  ------------------
 2267|   280k|			    m->value.s, slen));
 2268|   280k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   280k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2268:8): [True: 0, False: 280k]
  ------------------
 2269|      0|				fprintf(stderr, "] %sfound\n",
 2270|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2270:9): [True: 0, False: 0]
  ------------------
 2271|      0|			}
 2272|   280k|			if (!found) {
  ------------------
  |  Branch (2272:8): [True: 278k, False: 2.52k]
  ------------------
 2273|   278k|				v = 1;
 2274|   278k|				break;
 2275|   278k|			}
 2276|  2.52k|			idx = found - ms->search.s;
 2277|  2.52k|			ms->search.offset += idx;
 2278|  2.52k|			ms->search.rm_len = ms->search.s_len - idx;
 2279|  2.52k|			break;
 2280|   280k|		}
 2281|   199k|#endif
 2282|       |
 2283|   391M|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  374|   391M|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  374|   391M|#define str_range _u._s._count
  ------------------
  |  Branch (2283:17): [True: 0, False: 391M]
  |  Branch (2283:38): [True: 391M, False: 95.6k]
  ------------------
 2284|   391M|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2284:8): [True: 103k, False: 391M]
  ------------------
 2285|   103k|				v = 1;
 2286|   103k|				break;
 2287|   103k|			}
 2288|       |
 2289|   391M|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2290|   391M|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  375|   391M|#define str_flags _u._s._flags
  ------------------
 2291|   391M|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2291:8): [True: 194, False: 391M]
  ------------------
 2292|    194|				ms->search.offset += idx;
 2293|    194|				ms->search.rm_len = ms->search.s_len - idx;
 2294|    194|				break;
 2295|    194|			}
 2296|   391M|		}
 2297|   199k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   199k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2297:7): [True: 0, False: 199k]
  ------------------
 2298|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2298:35): [True: 0, False: 0]
  ------------------
 2299|      0|		}
 2300|   199k|		break;
 2301|   480k|	}
 2302|   214k|	case FILE_REGEX: {
  ------------------
  |  |  257|   214k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2302:2): [True: 214k, False: 71.6M]
  ------------------
 2303|   214k|		int rc;
 2304|   214k|		file_regex_t *rx = *m_cache;
 2305|   214k|		const char *search;
 2306|   214k|		regmatch_t pmatch;
 2307|   214k|		size_t slen = ms->search.s_len;
 2308|   214k|		char *copy;
 2309|       |
 2310|   214k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2310:7): [True: 31, False: 214k]
  ------------------
 2311|     31|			return 0;
 2312|       |
 2313|   214k|		if (rx == NULL) {
  ------------------
  |  Branch (2313:7): [True: 158, False: 214k]
  ------------------
 2314|    158|			rx = *m_cache = alloc_regex(ms, m);
 2315|    158|			if (rx == NULL)
  ------------------
  |  Branch (2315:8): [True: 0, False: 158]
  ------------------
 2316|      0|				return -1;
 2317|    158|		}
 2318|   214k|		l = 0;
 2319|   214k|		if (slen != 0) {
  ------------------
  |  Branch (2319:7): [True: 211k, False: 2.25k]
  ------------------
 2320|   211k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  444|   211k|#define CAST(T, b)	((T)(b))
  ------------------
 2321|   211k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2321:11): [True: 0, False: 211k]
  ------------------
 2322|      0|			file_error(ms, errno,
 2323|      0|			    "can't allocate %" SIZE_T_FORMAT "u bytes",
 2324|      0|			    slen);
 2325|      0|			return -1;
 2326|      0|		    }
 2327|   211k|		    memcpy(copy, ms->search.s, slen);
 2328|   211k|		    copy[--slen] = '\0';
 2329|   211k|		    search = copy;
 2330|   211k|		} else {
 2331|  2.25k|		    search = CCAST(char *, "");
  ------------------
  |  |  446|  2.25k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2332|  2.25k|		    copy = NULL;
 2333|  2.25k|		}
 2334|   214k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  445|   214k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2335|   214k|		    1, &pmatch, 0);
 2336|   214k|		free(copy);
 2337|   214k|		switch (rc) {
 2338|  3.00k|		case 0:
  ------------------
  |  Branch (2338:3): [True: 3.00k, False: 211k]
  ------------------
 2339|  3.00k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  444|  3.00k|#define CAST(T, b)	((T)(b))
  ------------------
 2340|  3.00k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  444|  3.00k|#define CAST(T, b)	((T)(b))
  ------------------
 2341|  3.00k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  444|  3.00k|#define CAST(T, b)	((T)(b))
  ------------------
 2342|  3.00k|			    pmatch.rm_eo - pmatch.rm_so);
 2343|  3.00k|			v = 0;
 2344|  3.00k|			break;
 2345|       |
 2346|   211k|		case REG_NOMATCH:
  ------------------
  |  Branch (2346:3): [True: 211k, False: 3.00k]
  ------------------
 2347|   211k|			v = 1;
 2348|   211k|			break;
 2349|       |
 2350|      0|		default:
  ------------------
  |  Branch (2350:3): [True: 0, False: 214k]
  ------------------
 2351|      0|			return -1;
 2352|   214k|		}
 2353|   214k|		break;
 2354|   214k|	}
 2355|   214k|	case FILE_USE:
  ------------------
  |  |  286|  54.7k|#define				FILE_USE		46
  ------------------
  |  Branch (2355:2): [True: 54.7k, False: 71.8M]
  ------------------
 2356|  54.7k|		return ms->ms_value.q != 0;
 2357|  59.2k|	case FILE_NAME:
  ------------------
  |  |  285|  59.2k|#define				FILE_NAME		45
  ------------------
  |  Branch (2357:2): [True: 59.2k, False: 71.8M]
  ------------------
 2358|  71.6k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  71.6k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2358:2): [True: 12.3k, False: 71.8M]
  ------------------
 2359|  71.6k|		return 1;
 2360|   368k|	case FILE_DER:
  ------------------
  |  |  288|   368k|#define				FILE_DER		48
  ------------------
  |  Branch (2360:2): [True: 368k, False: 71.5M]
  ------------------
 2361|   368k|		matched = der_cmp(ms, m);
 2362|   368k|		if (matched == -1) {
  ------------------
  |  Branch (2362:7): [True: 143k, False: 224k]
  ------------------
 2363|   143k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   143k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2363:8): [True: 0, False: 143k]
  ------------------
 2364|      0|				(void) fprintf(stderr,
 2365|      0|				    "EOF comparing DER entries\n");
 2366|      0|			}
 2367|   143k|			return 0;
 2368|   143k|		}
 2369|   224k|		return matched;
 2370|   137k|	case FILE_GUID:
  ------------------
  |  |  289|   137k|#define				FILE_GUID		49
  ------------------
  |  Branch (2370:2): [True: 137k, False: 71.7M]
  ------------------
 2371|   137k|		l = 0;
 2372|   137k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2373|   137k|		break;
 2374|      0|	default:
  ------------------
  |  Branch (2374:2): [True: 0, False: 71.8M]
  ------------------
 2375|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2376|      0|		return -1;
 2377|  71.8M|	}
 2378|       |
 2379|  71.3M|	v = file_signextend(ms, m, v);
 2380|       |
 2381|  71.3M|	switch (m->reln) {
 2382|  73.6k|	case 'x':
  ------------------
  |  Branch (2382:2): [True: 73.6k, False: 71.3M]
  ------------------
 2383|  73.6k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  73.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2383:7): [True: 0, False: 73.6k]
  ------------------
 2384|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT
 2385|      0|			    "u == *any* = 1", CAST(unsigned long long, v));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2386|  73.6k|		matched = 1;
 2387|  73.6k|		break;
 2388|       |
 2389|  51.0k|	case '!':
  ------------------
  |  Branch (2389:2): [True: 51.0k, False: 71.3M]
  ------------------
 2390|  51.0k|		matched = v != l;
 2391|  51.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  51.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2391:7): [True: 0, False: 51.0k]
  ------------------
 2392|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u != %"
 2393|      0|			    INT64_T_FORMAT "u = %d",
 2394|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2395|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2396|  51.0k|		break;
 2397|       |
 2398|  70.7M|	case '=':
  ------------------
  |  Branch (2398:2): [True: 70.7M, False: 612k]
  ------------------
 2399|  70.7M|		matched = v == l;
 2400|  70.7M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  70.7M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2400:7): [True: 0, False: 70.7M]
  ------------------
 2401|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u == %"
 2402|      0|			    INT64_T_FORMAT "u = %d",
 2403|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2404|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2405|  70.7M|		break;
 2406|       |
 2407|   188k|	case '>':
  ------------------
  |  Branch (2407:2): [True: 188k, False: 71.1M]
  ------------------
 2408|   188k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  226|   188k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2408:7): [True: 150k, False: 38.5k]
  ------------------
 2409|   150k|			matched = v > l;
 2410|   150k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   150k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2410:8): [True: 0, False: 150k]
  ------------------
 2411|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2412|      0|				    "u > %" INT64_T_FORMAT "u = %d",
 2413|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2414|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2415|   150k|		}
 2416|  38.5k|		else {
 2417|  38.5k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  444|  38.5k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  444|  38.5k|#define CAST(T, b)	((T)(b))
  ------------------
 2418|  38.5k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  38.5k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2418:8): [True: 0, False: 38.5k]
  ------------------
 2419|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2420|      0|				    "d > %" INT64_T_FORMAT "d = %d",
 2421|      0|				    CAST(long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2422|      0|				    CAST(long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2423|  38.5k|		}
 2424|   188k|		break;
 2425|       |
 2426|   269k|	case '<':
  ------------------
  |  Branch (2426:2): [True: 269k, False: 71.1M]
  ------------------
 2427|   269k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  226|   269k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2427:7): [True: 233k, False: 36.6k]
  ------------------
 2428|   233k|			matched = v < l;
 2429|   233k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   233k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2429:8): [True: 0, False: 233k]
  ------------------
 2430|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2431|      0|				    "u < %" INT64_T_FORMAT "u = %d",
 2432|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2433|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2434|   233k|		}
 2435|  36.6k|		else {
 2436|  36.6k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  444|  36.6k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  444|  36.6k|#define CAST(T, b)	((T)(b))
  ------------------
 2437|  36.6k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  36.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2437:8): [True: 0, False: 36.6k]
  ------------------
 2438|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2439|      0|				    "d < %" INT64_T_FORMAT "d = %d",
 2440|      0|				     CAST(long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2441|      0|				     CAST(long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2442|  36.6k|		}
 2443|   269k|		break;
 2444|       |
 2445|  28.0k|	case '&':
  ------------------
  |  Branch (2445:2): [True: 28.0k, False: 71.3M]
  ------------------
 2446|  28.0k|		matched = (v & l) == l;
 2447|  28.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  28.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2447:7): [True: 0, False: 28.0k]
  ------------------
 2448|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2449|      0|			    INT64_T_FORMAT "x) == %" INT64_T_FORMAT
 2450|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2451|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2452|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2453|      0|			    matched);
 2454|  28.0k|		break;
 2455|       |
 2456|  1.12k|	case '^':
  ------------------
  |  Branch (2456:2): [True: 1.12k, False: 71.3M]
  ------------------
 2457|  1.12k|		matched = (v & l) != l;
 2458|  1.12k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.12k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2458:7): [True: 0, False: 1.12k]
  ------------------
 2459|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2460|      0|			    INT64_T_FORMAT "x) != %" INT64_T_FORMAT
 2461|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2462|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2463|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2464|  1.12k|		break;
 2465|       |
 2466|      0|	default:
  ------------------
  |  Branch (2466:2): [True: 0, False: 71.3M]
  ------------------
 2467|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2468|      0|		    m->reln);
 2469|      0|		return -1;
 2470|  71.3M|	}
 2471|  71.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  71.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2471:6): [True: 0, False: 71.3M]
  ------------------
 2472|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2473|      0|		    file_magic_strength(m, 1));
 2474|      0|	}
 2475|       |
 2476|  71.3M|	return matched;
 2477|  71.3M|}
softmagic.c:file_strncmp:
 1987|   436M|{
 1988|       |	/*
 1989|       |	 * Convert the source args to unsigned here so that (1) the
 1990|       |	 * compare will be unsigned as it is in strncmp() and (2) so
 1991|       |	 * the ctype functions will work correctly without extra
 1992|       |	 * casting.
 1993|       |	 */
 1994|   436M|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  445|   436M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1995|   436M|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  445|   436M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1996|   436M|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  389|   436M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  388|   436M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1997|   436M|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  390|   436M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  388|   436M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1998|   436M|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (1998:33): [True: 40.0M, False: 396M]
  ------------------
 1999|   436M|	uint64_t v;
 2000|       |
 2001|       |	/*
 2002|       |	 * What we want here is v = strncmp(s1, s2, len),
 2003|       |	 * but ignoring any nulls.
 2004|       |	 */
 2005|   436M|	v = 0;
 2006|   436M|	len++;
 2007|   436M|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2007:6): [True: 42.6M, False: 393M]
  ------------------
 2008|  43.3M|		while (--len > 0)
  ------------------
  |  Branch (2008:10): [True: 43.2M, False: 41.0k]
  ------------------
 2009|  43.2M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2009:8): [True: 42.5M, False: 673k]
  ------------------
 2010|  42.5M|				break;
 2011|  42.6M|	}
 2012|   393M|	else { /* combine the others */
 2013|   394M|		while (--len > 0) {
  ------------------
  |  Branch (2013:10): [True: 394M, False: 29.2k]
  ------------------
 2014|   394M|			if (b >= eb) {
  ------------------
  |  Branch (2014:8): [True: 281k, False: 393M]
  ------------------
 2015|   281k|				v = 1;
 2016|   281k|				break;
 2017|   281k|			}
 2018|   393M|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  391|   393M|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  388|   393M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2018:8): [True: 39.1M, False: 354M]
  ------------------
 2019|   393M|			    islower(*a)) {
 2020|  2.12M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2020:9): [True: 2.10M, False: 19.0k]
  ------------------
 2021|  2.10M|					break;
 2022|  2.12M|			}
 2023|   391M|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  392|   391M|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  388|   391M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2023:13): [True: 14.2k, False: 391M]
  ------------------
 2024|   391M|			    isupper(*a)) {
 2025|  14.0k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2025:9): [True: 13.9k, False: 148]
  ------------------
 2026|  13.9k|					break;
 2027|  14.0k|			}
 2028|   391M|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  389|   391M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  388|   391M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2028:13): [True: 28.8M, False: 362M]
  ------------------
 2029|   391M|			    isspace(*a)) {
 2030|  1.31M|				a++;
 2031|  1.31M|				if (isspace(*b)) {
 2032|   337k|					b++;
 2033|   337k|					if (!isspace(*a))
  ------------------
  |  Branch (2033:10): [True: 337k, False: 0]
  ------------------
 2034|  12.6G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2034:14): [True: 12.6G, False: 281k]
  ------------------
 2035|  12.6G|							b++;
 2036|   337k|				}
 2037|   975k|				else {
 2038|   975k|					v = 1;
 2039|   975k|					break;
 2040|   975k|				}
 2041|  1.31M|			}
 2042|   390M|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  390|   390M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  388|   390M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2042:13): [True: 11.1M, False: 379M]
  ------------------
 2043|   390M|			    isspace(*a)) {
 2044|  1.69k|				a++;
 2045|  7.44k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2045:12): [True: 7.38k, False: 53]
  ------------------
 2046|  5.75k|					b++;
 2047|  1.69k|			}
 2048|   390M|			else {
 2049|   390M|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2049:9): [True: 390M, False: 93.9k]
  ------------------
 2050|   390M|					break;
 2051|   390M|			}
 2052|   393M|		}
 2053|   393M|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  407|  29.2k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  388|  29.2k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2053:7): [True: 29.2k, False: 393M]
  |  Branch (2053:19): [True: 29.2k, False: 0]
  |  Branch (2053:29): [True: 104, False: 29.1k]
  ------------------
 2054|    104|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2054:8): [True: 70, False: 34]
  |  Branch (2054:14): [True: 36, False: 34]
  ------------------
 2055|     36|				v = 1;
 2056|    104|		}
 2057|   393M|	}
 2058|   436M|	return v;
 2059|   436M|}
softmagic.c:file_strncmp16:
 2064|  54.8k|{
 2065|       |	/*
 2066|       |	 * XXX - The 16-bit string compare probably needs to be done
 2067|       |	 * differently, especially if the flags are to be supported.
 2068|       |	 * At the moment, I am unsure.
 2069|       |	 */
 2070|  54.8k|	flags = 0;
 2071|  54.8k|	return file_strncmp(a, b, len, maxlen, flags);
 2072|  54.8k|}
softmagic.c:alloc_regex:
 2076|    158|{
 2077|    158|	int rc;
 2078|    158|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  444|    158|#define CAST(T, b)	((T)(b))
  ------------------
 2079|       |
 2080|    158|	if (rx == NULL) {
  ------------------
  |  Branch (2080:6): [True: 0, False: 158]
  ------------------
 2081|      0|		file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT
 2082|      0|		    "u bytes", sizeof(*rx));
 2083|      0|		return NULL;
 2084|      0|	}
 2085|       |
 2086|    158|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2087|    158|	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  375|    158|#define str_flags _u._s._flags
  ------------------
              	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  424|    158|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  391|    158|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|    158|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  392|    158|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|    158|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2087:7): [True: 19, False: 139]
  ------------------
 2088|    158|	if (rc == 0)
  ------------------
  |  Branch (2088:6): [True: 158, False: 0]
  ------------------
 2089|    158|		return rx;
 2090|       |
 2091|      0|	free(rx);
 2092|      0|	return NULL;
 2093|    158|}
softmagic.c:handle_annotation:
 2481|   634k|{
 2482|   634k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   634k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2482:6): [True: 0, False: 634k]
  |  Branch (2482:35): [True: 0, False: 0]
  ------------------
 2483|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2483:7): [True: 0, False: 0]
  ------------------
 2484|      0|			return -1;
 2485|      0|		if (file_printf(ms, "%.8s", m->apple) == -1)
  ------------------
  |  Branch (2485:7): [True: 0, False: 0]
  ------------------
 2486|      0|			return -1;
 2487|      0|		return 1;
 2488|      0|	}
 2489|   634k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   634k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2489:6): [True: 0, False: 634k]
  |  Branch (2489:39): [True: 0, False: 0]
  ------------------
 2490|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2490:7): [True: 0, False: 0]
  ------------------
 2491|      0|			return -1;
 2492|      0|		if (file_printf(ms, "%s", m->ext) == -1)
  ------------------
  |  Branch (2492:7): [True: 0, False: 0]
  ------------------
 2493|      0|			return -1;
 2494|      0|		return 1;
 2495|      0|	}
 2496|   634k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   634k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2496:6): [True: 0, False: 634k]
  |  Branch (2496:39): [True: 0, False: 0]
  ------------------
 2497|      0|		char buf[1024];
 2498|      0|		const char *p;
 2499|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2499:7): [True: 0, False: 0]
  ------------------
 2500|      0|			return -1;
 2501|      0|		if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
  ------------------
  |  Branch (2501:7): [True: 0, False: 0]
  ------------------
 2502|      0|			p = m->mimetype;
 2503|      0|		else
 2504|      0|			p = buf;
 2505|      0|		if (file_printf(ms, "%s", p) == -1)
  ------------------
  |  Branch (2505:7): [True: 0, False: 0]
  ------------------
 2506|      0|			return -1;
 2507|      0|		return 1;
 2508|      0|	}
 2509|   634k|	return 0;
 2510|   634k|}
softmagic.c:varexpand:
  530|   116k|{
  531|   116k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  532|   116k|	size_t l;
  533|       |
  534|   116k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (534:19): [True: 15, False: 116k]
  ------------------
  535|     15|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  444|     15|#define CAST(T, b)	((T)(b))
  ------------------
  536|     15|		if (l >= len)
  ------------------
  |  Branch (536:7): [True: 0, False: 15]
  ------------------
  537|      0|			return -1;
  538|     15|		memcpy(buf, sptr, l);
  539|     15|		buf += l;
  540|     15|		len -= l;
  541|     15|		ptr += 2;
  542|     15|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (542:7): [True: 0, False: 15]
  |  Branch (542:16): [True: 0, False: 15]
  ------------------
  543|      0|			return -1;
  544|    225|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (544:26): [True: 225, False: 0]
  |  Branch (544:33): [True: 210, False: 15]
  ------------------
  545|    210|			continue;
  546|     15|		if (*et != ':')
  ------------------
  |  Branch (546:7): [True: 0, False: 15]
  ------------------
  547|      0|			return -1;
  548|    210|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (548:25): [True: 210, False: 0]
  |  Branch (548:32): [True: 195, False: 15]
  ------------------
  549|    195|			continue;
  550|     15|		if (*ee != '}')
  ------------------
  |  Branch (550:7): [True: 0, False: 15]
  ------------------
  551|      0|			return -1;
  552|     15|		switch (*ptr) {
  553|     15|		case 'x':
  ------------------
  |  Branch (553:3): [True: 15, False: 0]
  ------------------
  554|     15|			if (ms->mode & 0111) {
  ------------------
  |  Branch (554:8): [True: 0, False: 15]
  ------------------
  555|      0|				ptr = t;
  556|      0|				l = et - t;
  557|     15|			} else {
  558|     15|				ptr = e;
  559|     15|				l = ee - e;
  560|     15|			}
  561|     15|			break;
  562|      0|		default:
  ------------------
  |  Branch (562:3): [True: 0, False: 15]
  ------------------
  563|      0|			return -1;
  564|     15|		}
  565|     15|		if (l >= len)
  ------------------
  |  Branch (565:7): [True: 0, False: 15]
  ------------------
  566|      0|			return -1;
  567|     15|		memcpy(buf, ptr, l);
  568|     15|		buf += l;
  569|     15|		len -= l;
  570|     15|		sptr = ee + 1;
  571|     15|	}
  572|       |
  573|   116k|	l = strlen(sptr);
  574|   116k|	if (l >= len)
  ------------------
  |  Branch (574:6): [True: 0, False: 116k]
  ------------------
  575|      0|		return -1;
  576|       |
  577|   116k|	memcpy(buf, sptr, l);
  578|   116k|	buf[l] = '\0';
  579|   116k|	return 0;
  580|   116k|}
softmagic.c:print_sep:
 2514|  46.5k|{
 2515|  46.5k|	if (firstline)
  ------------------
  |  Branch (2515:6): [True: 9.48k, False: 37.1k]
  ------------------
 2516|  9.48k|		return 0;
 2517|       |	/*
 2518|       |	 * we found another match
 2519|       |	 * put a newline and '-' to do some simple formatting
 2520|       |	 */
 2521|  37.1k|	return file_separator(ms);
 2522|  46.5k|}
softmagic.c:mprint:
  585|   116k|{
  586|   116k|	uint64_t v;
  587|   116k|	float vf;
  588|   116k|	double vd;
  589|   116k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  590|   116k|	const char *desc;
  591|   116k|	union VALUETYPE *p = &ms->ms_value;
  592|       |
  593|   116k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (593:6): [True: 0, False: 116k]
  ------------------
  594|      0|		desc = m->desc;
  595|   116k|	else
  596|   116k|		desc = ebuf;
  597|       |
  598|   116k|#define	PRINTER(value, format, stype, utype)	\
  599|   116k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  600|   116k|	switch (check_fmt(ms, desc)) { \
  601|   116k|	case -1: \
  602|   116k|		return -1; \
  603|   116k|	case 1: \
  604|   116k|		if (m->flag & UNSIGNED) { \
  605|   116k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  606|   116k|			    CAST(utype, v)); \
  607|   116k|		} else { \
  608|   116k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  609|   116k|			    CAST(stype, v)); \
  610|   116k|		} \
  611|   116k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  612|   116k|			return -1; \
  613|   116k|		break; \
  614|   116k|	default: \
  615|   116k|		if (m->flag & UNSIGNED) { \
  616|   116k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  617|   116k|			   CAST(utype, v)) == -1) \
  618|   116k|			   return -1; \
  619|   116k|		} else { \
  620|   116k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  621|   116k|			   CAST(stype, v)) == -1) \
  622|   116k|			   return -1; \
  623|   116k|		} \
  624|   116k|		break; \
  625|   116k|	} \
  626|   116k|	break
  627|       |
  628|   116k|  	switch (m->type) {
  629|  7.23k|  	case FILE_BYTE:
  ------------------
  |  |  241|  7.23k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (629:4): [True: 7.23k, False: 109k]
  ------------------
  630|  7.23k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  599|  7.23k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  7.23k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  7.23k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 7.23k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 7.23k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  7.23k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 7.23k, False: 0]
  |  |  ------------------
  |  |  615|  7.23k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  7.23k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 4.25k, False: 2.98k]
  |  |  ------------------
  |  |  616|  4.25k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  4.25k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 4.25k]
  |  |  ------------------
  |  |  617|  4.25k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  4.25k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  4.25k|			   return -1; \
  |  |  619|  4.25k|		} else { \
  |  |  620|  2.98k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  2.98k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 2.98k]
  |  |  ------------------
  |  |  621|  2.98k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  2.98k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  2.98k|			   return -1; \
  |  |  623|  2.98k|		} \
  |  |  624|  7.23k|		break; \
  |  |  625|  7.23k|	} \
  |  |  626|  7.23k|	break
  ------------------
  631|       |
  632|  7.23k|  	case FILE_SHORT:
  ------------------
  |  |  242|  2.38k|#define				FILE_SHORT		2
  ------------------
  |  Branch (632:4): [True: 2.38k, False: 113k]
  ------------------
  633|  7.38k|  	case FILE_BESHORT:
  ------------------
  |  |  247|  7.38k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (633:4): [True: 4.99k, False: 111k]
  ------------------
  634|  14.5k|  	case FILE_LESHORT:
  ------------------
  |  |  250|  14.5k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (634:4): [True: 7.20k, False: 109k]
  ------------------
  635|  14.5k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  599|  14.5k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  14.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  14.5k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 14.5k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 14.5k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  14.5k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 14.5k, False: 0]
  |  |  ------------------
  |  |  615|  14.5k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  14.5k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 9.95k, False: 4.62k]
  |  |  ------------------
  |  |  616|  9.95k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  9.95k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 9.95k]
  |  |  ------------------
  |  |  617|  9.95k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  9.95k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  9.95k|			   return -1; \
  |  |  619|  9.95k|		} else { \
  |  |  620|  4.62k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  4.62k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 4.62k]
  |  |  ------------------
  |  |  621|  4.62k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  4.62k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  4.62k|			   return -1; \
  |  |  623|  4.62k|		} \
  |  |  624|  14.5k|		break; \
  |  |  625|  14.5k|	} \
  |  |  626|  14.5k|	break
  ------------------
  636|       |
  637|  14.5k|  	case FILE_LONG:
  ------------------
  |  |  244|    740|#define				FILE_LONG		4
  ------------------
  |  Branch (637:4): [True: 740, False: 115k]
  ------------------
  638|  29.4k|  	case FILE_BELONG:
  ------------------
  |  |  248|  29.4k|#define				FILE_BELONG		8
  ------------------
  |  Branch (638:4): [True: 28.7k, False: 87.6k]
  ------------------
  639|  38.4k|  	case FILE_LELONG:
  ------------------
  |  |  251|  38.4k|#define				FILE_LELONG		11
  ------------------
  |  Branch (639:4): [True: 8.99k, False: 107k]
  ------------------
  640|  38.5k|  	case FILE_MELONG:
  ------------------
  |  |  263|  38.5k|#define				FILE_MELONG		23
  ------------------
  |  Branch (640:4): [True: 34, False: 116k]
  ------------------
  641|  38.5k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  599|  38.5k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  38.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  38.5k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 38.5k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 38.5k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  38.5k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 38.5k, False: 0]
  |  |  ------------------
  |  |  615|  38.5k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  38.5k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 9.80k, False: 28.7k]
  |  |  ------------------
  |  |  616|  9.80k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  9.80k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 9.80k]
  |  |  ------------------
  |  |  617|  9.80k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  9.80k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  9.80k|			   return -1; \
  |  |  619|  28.7k|		} else { \
  |  |  620|  28.7k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  28.7k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 28.7k]
  |  |  ------------------
  |  |  621|  28.7k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  28.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  28.7k|			   return -1; \
  |  |  623|  28.7k|		} \
  |  |  624|  38.5k|		break; \
  |  |  625|  38.5k|	} \
  |  |  626|  38.5k|	break
  ------------------
  642|       |
  643|  38.5k|  	case FILE_QUAD:
  ------------------
  |  |  264|    139|#define				FILE_QUAD		24
  ------------------
  |  Branch (643:4): [True: 139, False: 116k]
  ------------------
  644|  1.10k|  	case FILE_BEQUAD:
  ------------------
  |  |  266|  1.10k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (644:4): [True: 962, False: 115k]
  ------------------
  645|  1.60k|  	case FILE_LEQUAD:
  ------------------
  |  |  265|  1.60k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (645:4): [True: 506, False: 115k]
  ------------------
  646|  1.60k|	case FILE_OFFSET:
  ------------------
  |  |  290|  1.60k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (646:2): [True: 0, False: 116k]
  ------------------
  647|  1.60k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  599|  1.60k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  1.60k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  1.60k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 1.60k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 1.60k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  1.60k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 1.60k, False: 0]
  |  |  ------------------
  |  |  615|  1.60k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  1.60k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 1.11k, False: 489]
  |  |  ------------------
  |  |  616|  1.11k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  1.11k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 1.11k]
  |  |  ------------------
  |  |  617|  1.11k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  1.11k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  1.11k|			   return -1; \
  |  |  619|  1.11k|		} else { \
  |  |  620|    489|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|    489|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 489]
  |  |  ------------------
  |  |  621|    489|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|    489|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|    489|			   return -1; \
  |  |  623|    489|		} \
  |  |  624|  1.60k|		break; \
  |  |  625|  1.60k|	} \
  |  |  626|  1.60k|	break
  ------------------
  648|       |
  649|  34.9k|  	case FILE_STRING:
  ------------------
  |  |  245|  34.9k|#define				FILE_STRING		5
  ------------------
  |  Branch (649:4): [True: 34.9k, False: 81.4k]
  ------------------
  650|  36.7k|  	case FILE_PSTRING:
  ------------------
  |  |  253|  36.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (650:4): [True: 1.73k, False: 114k]
  ------------------
  651|  36.8k|  	case FILE_BESTRING16:
  ------------------
  |  |  258|  36.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (651:4): [True: 98, False: 116k]
  ------------------
  652|  37.1k|  	case FILE_LESTRING16:
  ------------------
  |  |  259|  37.1k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (652:4): [True: 349, False: 116k]
  ------------------
  653|  37.1k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (653:7): [True: 19.1k, False: 18.0k]
  |  Branch (653:25): [True: 749, False: 17.2k]
  ------------------
  654|  19.8k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|  19.8k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (654:8): [True: 0, False: 19.8k]
  ------------------
  655|  19.8k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  656|  19.8k|			    sizeof(m->value.s))) == -1)
  657|      0|				return -1;
  658|  19.8k|		}
  659|  17.2k|		else {
  660|  17.2k|			char *str = p->s;
  661|       |
  662|       |			/* compute t before we mangle the string? */
  663|       |
  664|  17.2k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (664:8): [True: 17.1k, False: 167]
  ------------------
  665|  17.1k|				str[strcspn(str, "\r\n")] = '\0';
  666|       |
  667|  17.2k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  375|  17.2k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  406|  17.2k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  388|  17.2k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (667:8): [True: 256, False: 17.0k]
  ------------------
  668|    256|				str = file_strtrim(str);
  669|       |
  670|  17.2k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|  17.2k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (670:8): [True: 0, False: 17.2k]
  ------------------
  671|  17.2k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  672|  17.2k|				sizeof(p->s) - (str - p->s))) == -1)
  673|      0|				return -1;
  674|       |
  675|  17.2k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  253|  17.2k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (675:8): [True: 1.73k, False: 15.5k]
  ------------------
  676|  1.73k|				size_t l = file_pstring_length_size(ms, m);
  677|  1.73k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.73k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  1.73k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (677:9): [True: 0, False: 1.73k]
  ------------------
  678|      0|					return -1;
  679|  1.73k|			}
  680|  17.2k|		}
  681|  37.1k|		break;
  682|       |
  683|  37.1k|	case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (683:2): [True: 0, False: 116k]
  ------------------
  684|    100|	case FILE_BEDATE:
  ------------------
  |  |  249|    100|#define				FILE_BEDATE		9
  ------------------
  |  Branch (684:2): [True: 100, False: 116k]
  ------------------
  685|    405|	case FILE_LEDATE:
  ------------------
  |  |  252|    405|#define				FILE_LEDATE		12
  ------------------
  |  Branch (685:2): [True: 305, False: 116k]
  ------------------
  686|    473|	case FILE_MEDATE:
  ------------------
  |  |  261|    473|#define				FILE_MEDATE		21
  ------------------
  |  Branch (686:2): [True: 68, False: 116k]
  ------------------
  687|    473|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    473|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (687:7): [True: 0, False: 473]
  ------------------
  688|    473|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  689|      0|			return -1;
  690|    473|		break;
  691|       |
  692|    473|	case FILE_LDATE:
  ------------------
  |  |  254|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (692:2): [True: 0, False: 116k]
  ------------------
  693|    574|	case FILE_BELDATE:
  ------------------
  |  |  255|    574|#define				FILE_BELDATE		15
  ------------------
  |  Branch (693:2): [True: 574, False: 115k]
  ------------------
  694|    608|	case FILE_LELDATE:
  ------------------
  |  |  256|    608|#define				FILE_LELDATE		16
  ------------------
  |  Branch (694:2): [True: 34, False: 116k]
  ------------------
  695|    608|	case FILE_MELDATE:
  ------------------
  |  |  262|    608|#define				FILE_MELDATE		22
  ------------------
  |  Branch (695:2): [True: 0, False: 116k]
  ------------------
  696|    608|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    608|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (696:7): [True: 0, False: 608]
  ------------------
  697|    608|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  528|    608|#define FILE_T_LOCAL	1
  ------------------
  698|    608|			== -1)
  699|      0|			return -1;
  700|    608|		break;
  701|       |
  702|    608|	case FILE_QDATE:
  ------------------
  |  |  267|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (702:2): [True: 0, False: 116k]
  ------------------
  703|    194|	case FILE_BEQDATE:
  ------------------
  |  |  269|    194|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (703:2): [True: 194, False: 116k]
  ------------------
  704|    301|	case FILE_LEQDATE:
  ------------------
  |  |  268|    301|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (704:2): [True: 107, False: 116k]
  ------------------
  705|    301|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    301|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (705:7): [True: 0, False: 301]
  ------------------
  706|    301|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  707|      0|			return -1;
  708|    301|		break;
  709|       |
  710|    301|	case FILE_QLDATE:
  ------------------
  |  |  270|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (710:2): [True: 0, False: 116k]
  ------------------
  711|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (711:2): [True: 0, False: 116k]
  ------------------
  712|     36|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     36|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (712:2): [True: 36, False: 116k]
  ------------------
  713|     36|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     36|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (713:7): [True: 0, False: 36]
  ------------------
  714|     36|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  528|     36|#define FILE_T_LOCAL	1
  ------------------
  715|      0|			return -1;
  716|     36|		break;
  717|       |
  718|    175|	case FILE_QWDATE:
  ------------------
  |  |  282|    175|#define				FILE_QWDATE		42
  ------------------
  |  Branch (718:2): [True: 175, False: 116k]
  ------------------
  719|    175|	case FILE_BEQWDATE:
  ------------------
  |  |  284|    175|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (719:2): [True: 0, False: 116k]
  ------------------
  720|    912|	case FILE_LEQWDATE:
  ------------------
  |  |  283|    912|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (720:2): [True: 737, False: 115k]
  ------------------
  721|    912|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    912|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (721:7): [True: 0, False: 912]
  ------------------
  722|    912|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  529|    912|#define FILE_T_WINDOWS	2
  ------------------
  723|    912|		    == -1)
  724|      0|			return -1;
  725|    912|		break;
  726|       |
  727|    912|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (727:2): [True: 0, False: 116k]
  ------------------
  728|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (728:2): [True: 0, False: 116k]
  ------------------
  729|    561|	case FILE_LEFLOAT:
  ------------------
  |  |  275|    561|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (729:2): [True: 561, False: 115k]
  ------------------
  730|    561|		vf = p->f;
  731|    561|		switch (check_fmt(ms, desc)) {
  732|      0|		case -1:
  ------------------
  |  Branch (732:3): [True: 0, False: 561]
  ------------------
  733|      0|			return -1;
  734|      0|		case 1:
  ------------------
  |  Branch (734:3): [True: 0, False: 561]
  ------------------
  735|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  736|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (736:8): [True: 0, False: 0]
  ------------------
  737|      0|				return -1;
  738|      0|			break;
  739|    561|		default:
  ------------------
  |  Branch (739:3): [True: 561, False: 0]
  ------------------
  740|    561|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  158|    561|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (740:8): [True: 0, False: 561]
  ------------------
  741|      0|				return -1;
  742|    561|			break;
  743|    561|		}
  744|    561|  		break;
  745|       |
  746|    561|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (746:2): [True: 0, False: 116k]
  ------------------
  747|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (747:2): [True: 0, False: 116k]
  ------------------
  748|    288|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    288|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (748:2): [True: 288, False: 116k]
  ------------------
  749|    288|		vd = p->d;
  750|    288|		switch (check_fmt(ms, desc)) {
  751|      0|		case -1:
  ------------------
  |  Branch (751:3): [True: 0, False: 288]
  ------------------
  752|      0|			return -1;
  753|      0|		case 1:
  ------------------
  |  Branch (753:3): [True: 0, False: 288]
  ------------------
  754|      0|			(void)snprintf(buf, sizeof(buf), "%g", vd);
  755|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|      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|    288|		default:
  ------------------
  |  Branch (758:3): [True: 288, False: 0]
  ------------------
  759|    288|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  158|    288|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (759:8): [True: 0, False: 288]
  ------------------
  760|      0|				return -1;
  761|    288|			break;
  762|    288|		}
  763|    288|  		break;
  764|       |
  765|    288|	case FILE_SEARCH:
  ------------------
  |  |  260|    261|#define				FILE_SEARCH		20
  ------------------
  |  Branch (765:2): [True: 261, False: 116k]
  ------------------
  766|    755|	case FILE_REGEX: {
  ------------------
  |  |  257|    755|#define				FILE_REGEX		17
  ------------------
  |  Branch (766:2): [True: 494, False: 115k]
  ------------------
  767|    755|		char *cp, *scp;
  768|    755|		int rval;
  769|       |
  770|    755|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  445|    755|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  771|    755|		    ms->search.rm_len);
  772|    755|		if (cp == NULL) {
  ------------------
  |  Branch (772:7): [True: 0, False: 755]
  ------------------
  773|      0|			file_oomem(ms, ms->search.rm_len);
  774|      0|			return -1;
  775|      0|		}
  776|    755|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  375|    755|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  406|    755|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  388|    755|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (776:9): [True: 34, False: 721]
  ------------------
  777|       |
  778|    755|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  158|    755|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  779|    755|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  780|    755|		free(cp);
  781|       |
  782|    755|		if (rval == -1)
  ------------------
  |  Branch (782:7): [True: 0, False: 755]
  ------------------
  783|      0|			return -1;
  784|    755|		break;
  785|    755|	}
  786|       |
  787|    927|	case FILE_DEFAULT:
  ------------------
  |  |  243|    927|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (787:2): [True: 927, False: 115k]
  ------------------
  788|    929|	case FILE_CLEAR:
  ------------------
  |  |  287|    929|#define				FILE_CLEAR		47
  ------------------
  |  Branch (788:2): [True: 2, False: 116k]
  ------------------
  789|    929|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (789:9): [True: 0, False: 929]
  ------------------
  790|      0|			return -1;
  791|    929|		break;
  792|       |
  793|  2.42k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  2.42k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (793:2): [True: 2.42k, False: 113k]
  ------------------
  794|  2.42k|	case FILE_USE:
  ------------------
  |  |  286|  2.42k|#define				FILE_USE		46
  ------------------
  |  Branch (794:2): [True: 0, False: 116k]
  ------------------
  795|  11.6k|	case FILE_NAME:
  ------------------
  |  |  285|  11.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (795:2): [True: 9.23k, False: 107k]
  ------------------
  796|  11.6k|		break;
  797|    320|	case FILE_DER:
  ------------------
  |  |  288|    320|#define				FILE_DER		48
  ------------------
  |  Branch (797:2): [True: 320, False: 116k]
  ------------------
  798|    320|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    320|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (798:7): [True: 0, False: 320]
  ------------------
  799|    320|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  800|    320|			sizeof(ms->ms_value.s))) == -1)
  801|      0|			return -1;
  802|    320|		break;
  803|    320|	case FILE_GUID:
  ------------------
  |  |  289|    313|#define				FILE_GUID		49
  ------------------
  |  Branch (803:2): [True: 313, False: 116k]
  ------------------
  804|    313|		(void) file_print_guid(buf, sizeof(buf), ms->ms_value.guid);
  805|    313|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|    313|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (805:7): [True: 0, False: 313]
  ------------------
  806|      0|			return -1;
  807|    313|		break;
  808|    313|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|      0|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (808:2): [True: 0, False: 116k]
  ------------------
  809|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|      0|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (809:2): [True: 0, False: 116k]
  ------------------
  810|     67|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|     67|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (810:2): [True: 67, False: 116k]
  ------------------
  811|     67|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     67|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (811:7): [True: 0, False: 67]
  ------------------
  812|     67|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  813|      0|			return -1;
  814|     67|		break;
  815|     67|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|      0|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (815:2): [True: 0, False: 116k]
  ------------------
  816|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|      0|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (816:2): [True: 0, False: 116k]
  ------------------
  817|     67|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|     67|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (817:2): [True: 67, False: 116k]
  ------------------
  818|     67|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     67|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (818:7): [True: 0, False: 67]
  ------------------
  819|     67|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  820|      0|			return -1;
  821|     67|		break;
  822|     67|	case FILE_OCTAL:
  ------------------
  |  |  299|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (822:2): [True: 0, False: 116k]
  ------------------
  823|      0|		file_fmtnum(buf, sizeof(buf), m->value.s, 8);
  824|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (824:7): [True: 0, False: 0]
  ------------------
  825|      0|			return -1;
  826|      0|		break;
  827|      0|	default:
  ------------------
  |  Branch (827:2): [True: 0, False: 116k]
  ------------------
  828|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  829|      0|		return -1;
  830|   116k|	}
  831|   116k|	return 0;
  832|   116k|}
softmagic.c:check_fmt:
  489|  62.7k|{
  490|  62.7k|	file_regex_t rx;
  491|  62.7k|	int rc, rv = -1;
  492|  62.7k|        const char* pat = "%[-0-9\\.]*s";
  493|       |
  494|  62.7k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (494:6): [True: 38.1k, False: 24.6k]
  ------------------
  495|  38.1k|		return 0;
  496|       |
  497|  24.6k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  498|  24.6k|	if (rc == 0) {
  ------------------
  |  Branch (498:6): [True: 24.6k, False: 0]
  ------------------
  499|  24.6k|		rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
  500|  24.6k|		rv = !rc;
  501|  24.6k|	}
  502|  24.6k|	file_regfree(&rx);
  503|  24.6k|	return rv;
  504|  62.7k|}
softmagic.c:moffset:
  837|   634k|{
  838|   634k|	size_t nbytes = b->flen;
  839|   634k|	int32_t o;
  840|       |
  841|   634k|  	switch (m->type) {
  842|   172k|  	case FILE_BYTE:
  ------------------
  |  |  241|   172k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (842:4): [True: 172k, False: 462k]
  ------------------
  843|   172k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  444|   172k|#define CAST(T, b)	((T)(b))
  ------------------
  844|   172k|		break;
  845|       |
  846|  17.2k|  	case FILE_SHORT:
  ------------------
  |  |  242|  17.2k|#define				FILE_SHORT		2
  ------------------
  |  Branch (846:4): [True: 17.2k, False: 617k]
  ------------------
  847|  57.1k|  	case FILE_BESHORT:
  ------------------
  |  |  247|  57.1k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (847:4): [True: 39.9k, False: 594k]
  ------------------
  848|  79.6k|  	case FILE_LESHORT:
  ------------------
  |  |  250|  79.6k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (848:4): [True: 22.4k, False: 612k]
  ------------------
  849|  79.6k|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|  79.6k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (849:2): [True: 0, False: 634k]
  ------------------
  850|  79.7k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  79.7k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (850:2): [True: 67, False: 634k]
  ------------------
  851|  79.7k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  79.7k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (851:2): [True: 0, False: 634k]
  ------------------
  852|  79.7k|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|  79.7k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (852:2): [True: 0, False: 634k]
  ------------------
  853|  79.7k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  79.7k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (853:2): [True: 67, False: 634k]
  ------------------
  854|  79.7k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  79.7k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (854:2): [True: 0, False: 634k]
  ------------------
  855|  79.7k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  444|  79.7k|#define CAST(T, b)	((T)(b))
  ------------------
  856|  79.7k|		break;
  857|       |
  858|  5.91k|  	case FILE_LONG:
  ------------------
  |  |  244|  5.91k|#define				FILE_LONG		4
  ------------------
  |  Branch (858:4): [True: 5.91k, False: 628k]
  ------------------
  859|  97.2k|  	case FILE_BELONG:
  ------------------
  |  |  248|  97.2k|#define				FILE_BELONG		8
  ------------------
  |  Branch (859:4): [True: 91.3k, False: 543k]
  ------------------
  860|   119k|  	case FILE_LELONG:
  ------------------
  |  |  251|   119k|#define				FILE_LELONG		11
  ------------------
  |  Branch (860:4): [True: 22.1k, False: 612k]
  ------------------
  861|   119k|  	case FILE_MELONG:
  ------------------
  |  |  263|   119k|#define				FILE_MELONG		23
  ------------------
  |  Branch (861:4): [True: 34, False: 634k]
  ------------------
  862|   119k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  444|   119k|#define CAST(T, b)	((T)(b))
  ------------------
  863|   119k|		break;
  864|       |
  865|  25.5k|  	case FILE_QUAD:
  ------------------
  |  |  264|  25.5k|#define				FILE_QUAD		24
  ------------------
  |  Branch (865:4): [True: 25.5k, False: 609k]
  ------------------
  866|  30.3k|  	case FILE_BEQUAD:
  ------------------
  |  |  266|  30.3k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (866:4): [True: 4.86k, False: 629k]
  ------------------
  867|  31.2k|  	case FILE_LEQUAD:
  ------------------
  |  |  265|  31.2k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (867:4): [True: 911, False: 633k]
  ------------------
  868|  31.2k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  444|  31.2k|#define CAST(T, b)	((T)(b))
  ------------------
  869|  31.2k|		break;
  870|       |
  871|  75.1k|  	case FILE_STRING:
  ------------------
  |  |  245|  75.1k|#define				FILE_STRING		5
  ------------------
  |  Branch (871:4): [True: 75.1k, False: 559k]
  ------------------
  872|  76.8k|  	case FILE_PSTRING:
  ------------------
  |  |  253|  76.8k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (872:4): [True: 1.73k, False: 632k]
  ------------------
  873|  76.9k|  	case FILE_BESTRING16:
  ------------------
  |  |  258|  76.9k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (873:4): [True: 98, False: 634k]
  ------------------
  874|  77.3k|  	case FILE_LESTRING16:
  ------------------
  |  |  259|  77.3k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (874:4): [True: 349, False: 634k]
  ------------------
  875|  77.3k|	case FILE_OCTAL:
  ------------------
  |  |  299|  77.3k|#define				FILE_OCTAL		59
  ------------------
  |  Branch (875:2): [True: 0, False: 634k]
  ------------------
  876|  77.3k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (876:7): [True: 28.1k, False: 49.1k]
  |  Branch (876:25): [True: 1.45k, False: 47.7k]
  ------------------
  877|  29.5k|			o = ms->offset + m->vallen;
  878|  47.7k|		} else {
  879|  47.7k|			union VALUETYPE *p = &ms->ms_value;
  880|       |
  881|  47.7k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (881:8): [True: 41.7k, False: 6.02k]
  ------------------
  882|  41.7k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  883|  47.7k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  444|  47.7k|#define CAST(T, b)	((T)(b))
  ------------------
  884|  47.7k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  253|  47.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (884:8): [True: 1.73k, False: 45.9k]
  ------------------
  885|  1.73k|				size_t l = file_pstring_length_size(ms, m);
  886|  1.73k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.73k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  1.73k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (886:9): [True: 0, False: 1.73k]
  ------------------
  887|      0|					return -1;
  888|  1.73k|				o += CAST(uint32_t, l);
  ------------------
  |  |  444|  1.73k|#define CAST(T, b)	((T)(b))
  ------------------
  889|  1.73k|			}
  890|  47.7k|		}
  891|  77.3k|		break;
  892|       |
  893|  77.3k|	case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (893:2): [True: 0, False: 634k]
  ------------------
  894|    100|	case FILE_BEDATE:
  ------------------
  |  |  249|    100|#define				FILE_BEDATE		9
  ------------------
  |  Branch (894:2): [True: 100, False: 634k]
  ------------------
  895|    405|	case FILE_LEDATE:
  ------------------
  |  |  252|    405|#define				FILE_LEDATE		12
  ------------------
  |  Branch (895:2): [True: 305, False: 634k]
  ------------------
  896|    473|	case FILE_MEDATE:
  ------------------
  |  |  261|    473|#define				FILE_MEDATE		21
  ------------------
  |  Branch (896:2): [True: 68, False: 634k]
  ------------------
  897|    473|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  444|    473|#define CAST(T, b)	((T)(b))
  ------------------
  898|    473|		break;
  899|       |
  900|      0|	case FILE_LDATE:
  ------------------
  |  |  254|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (900:2): [True: 0, False: 634k]
  ------------------
  901|    574|	case FILE_BELDATE:
  ------------------
  |  |  255|    574|#define				FILE_BELDATE		15
  ------------------
  |  Branch (901:2): [True: 574, False: 634k]
  ------------------
  902|    608|	case FILE_LELDATE:
  ------------------
  |  |  256|    608|#define				FILE_LELDATE		16
  ------------------
  |  Branch (902:2): [True: 34, False: 634k]
  ------------------
  903|    608|	case FILE_MELDATE:
  ------------------
  |  |  262|    608|#define				FILE_MELDATE		22
  ------------------
  |  Branch (903:2): [True: 0, False: 634k]
  ------------------
  904|    608|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  444|    608|#define CAST(T, b)	((T)(b))
  ------------------
  905|    608|		break;
  906|       |
  907|      0|	case FILE_QDATE:
  ------------------
  |  |  267|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (907:2): [True: 0, False: 634k]
  ------------------
  908|    194|	case FILE_BEQDATE:
  ------------------
  |  |  269|    194|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (908:2): [True: 194, False: 634k]
  ------------------
  909|    301|	case FILE_LEQDATE:
  ------------------
  |  |  268|    301|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (909:2): [True: 107, False: 634k]
  ------------------
  910|    301|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  444|    301|#define CAST(T, b)	((T)(b))
  ------------------
  911|    301|		break;
  912|       |
  913|      0|	case FILE_QLDATE:
  ------------------
  |  |  270|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (913:2): [True: 0, False: 634k]
  ------------------
  914|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (914:2): [True: 0, False: 634k]
  ------------------
  915|     36|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     36|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (915:2): [True: 36, False: 634k]
  ------------------
  916|     36|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  444|     36|#define CAST(T, b)	((T)(b))
  ------------------
  917|     36|		break;
  918|       |
  919|      0|  	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (919:4): [True: 0, False: 634k]
  ------------------
  920|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (920:4): [True: 0, False: 634k]
  ------------------
  921|    561|  	case FILE_LEFLOAT:
  ------------------
  |  |  275|    561|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (921:4): [True: 561, False: 634k]
  ------------------
  922|    561|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  444|    561|#define CAST(T, b)	((T)(b))
  ------------------
  923|    561|		break;
  924|       |
  925|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (925:4): [True: 0, False: 634k]
  ------------------
  926|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (926:4): [True: 0, False: 634k]
  ------------------
  927|    288|  	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    288|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (927:4): [True: 288, False: 634k]
  ------------------
  928|    288|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  444|    288|#define CAST(T, b)	((T)(b))
  ------------------
  929|    288|		break;
  930|       |
  931|  1.18k|	case FILE_REGEX:
  ------------------
  |  |  257|  1.18k|#define				FILE_REGEX		17
  ------------------
  |  Branch (931:2): [True: 1.18k, False: 633k]
  ------------------
  932|  1.18k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  1.18k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  393|  1.18k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  388|  1.18k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (932:7): [True: 35, False: 1.15k]
  ------------------
  933|     35|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  444|     35|#define CAST(T, b)	((T)(b))
  ------------------
  934|  1.15k|		else
  935|  1.15k|			o = CAST(int32_t,
  ------------------
  |  |  444|  1.15k|#define CAST(T, b)	((T)(b))
  ------------------
  936|  1.18k|			    (ms->search.offset + ms->search.rm_len));
  937|  1.18k|		break;
  938|       |
  939|  6.79k|	case FILE_SEARCH:
  ------------------
  |  |  260|  6.79k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (939:2): [True: 6.79k, False: 627k]
  ------------------
  940|  6.79k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  6.79k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  393|  6.79k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  388|  6.79k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (940:7): [True: 102, False: 6.69k]
  ------------------
  941|    102|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  444|    102|#define CAST(T, b)	((T)(b))
  ------------------
  942|  6.69k|		else
  943|  6.69k|			o = CAST(int32_t, (ms->search.offset + m->vallen));
  ------------------
  |  |  444|  6.69k|#define CAST(T, b)	((T)(b))
  ------------------
  944|  6.79k|		break;
  945|       |
  946|    460|	case FILE_CLEAR:
  ------------------
  |  |  287|    460|#define				FILE_CLEAR		47
  ------------------
  |  Branch (946:2): [True: 460, False: 634k]
  ------------------
  947|  5.90k|	case FILE_DEFAULT:
  ------------------
  |  |  243|  5.90k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (947:2): [True: 5.44k, False: 629k]
  ------------------
  948|  18.2k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  18.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (948:2): [True: 12.3k, False: 622k]
  ------------------
  949|  18.2k|	case FILE_OFFSET:
  ------------------
  |  |  290|  18.2k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (949:2): [True: 0, False: 634k]
  ------------------
  950|  53.7k|	case FILE_USE:
  ------------------
  |  |  286|  53.7k|#define				FILE_USE		46
  ------------------
  |  Branch (950:2): [True: 35.4k, False: 599k]
  ------------------
  951|  53.7k|		o = ms->offset;
  952|  53.7k|		break;
  953|       |
  954|  29.9k|	case FILE_DER:
  ------------------
  |  |  288|  29.9k|#define				FILE_DER		48
  ------------------
  |  Branch (954:2): [True: 29.9k, False: 604k]
  ------------------
  955|  29.9k|		o = der_offs(ms, m, nbytes);
  956|  29.9k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  444|  29.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (956:7): [True: 0, False: 29.9k]
  |  Branch (956:18): [True: 0, False: 29.9k]
  ------------------
  957|      0|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (957:8): [True: 0, False: 0]
  ------------------
  958|      0|				(void)fprintf(stderr,
  959|      0|				    "Bad DER offset %d nbytes=%"
  960|      0|				    SIZE_T_FORMAT "u", o, nbytes);
  961|      0|			}
  962|      0|			*op = 0;
  963|      0|			return 0;
  964|      0|		}
  965|  29.9k|		break;
  966|       |
  967|  29.9k|	case FILE_GUID:
  ------------------
  |  |  289|    313|#define				FILE_GUID		49
  ------------------
  |  Branch (967:2): [True: 313, False: 634k]
  ------------------
  968|    313|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  444|    313|#define CAST(T, b)	((T)(b))
  ------------------
  969|    313|		break;
  970|       |
  971|  60.2k|	default:
  ------------------
  |  Branch (971:2): [True: 60.2k, False: 574k]
  ------------------
  972|  60.2k|		o = 0;
  973|  60.2k|		break;
  974|   634k|	}
  975|       |
  976|   634k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  444|   634k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (976:6): [True: 27.4k, False: 607k]
  ------------------
  977|       |#if 0
  978|       |		file_error(ms, 0, "Offset out of range %" SIZE_T_FORMAT
  979|       |		    "u > %" SIZE_T_FORMAT "u", (size_t)o, nbytes);
  980|       |#endif
  981|  27.4k|		return -1;
  982|  27.4k|	}
  983|   607k|	*op = o;
  984|   607k|	return 1;
  985|   634k|}

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

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

