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|  64.4M|{
 1632|  64.4M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  226|  64.4M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1632:6): [True: 60.8M, False: 3.62M]
  ------------------
 1633|  60.8M|		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|   622k|		case FILE_BYTE:
  ------------------
  |  |  241|   622k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1639:3): [True: 622k, False: 60.2M]
  ------------------
 1640|   622k|			v = CAST(signed char,  v);
  ------------------
  |  |  444|   622k|#define CAST(T, b)	((T)(b))
  ------------------
 1641|   622k|			break;
 1642|   694k|		case FILE_SHORT:
  ------------------
  |  |  242|   694k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1642:3): [True: 694k, False: 60.1M]
  ------------------
 1643|  3.45M|		case FILE_BESHORT:
  ------------------
  |  |  247|  3.45M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1643:3): [True: 2.76M, False: 58.0M]
  ------------------
 1644|  5.33M|		case FILE_LESHORT:
  ------------------
  |  |  250|  5.33M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1644:3): [True: 1.87M, False: 58.9M]
  ------------------
 1645|  5.33M|			v = CAST(short, v);
  ------------------
  |  |  444|  5.33M|#define CAST(T, b)	((T)(b))
  ------------------
 1646|  5.33M|			break;
 1647|      0|		case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1647:3): [True: 0, False: 60.8M]
  ------------------
 1648|    180|		case FILE_BEDATE:
  ------------------
  |  |  249|    180|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1648:3): [True: 180, False: 60.8M]
  ------------------
 1649|    278|		case FILE_LEDATE:
  ------------------
  |  |  252|    278|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1649:3): [True: 98, False: 60.8M]
  ------------------
 1650|    312|		case FILE_MEDATE:
  ------------------
  |  |  261|    312|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1650:3): [True: 34, False: 60.8M]
  ------------------
 1651|    312|		case FILE_LDATE:
  ------------------
  |  |  254|    312|#define				FILE_LDATE		14
  ------------------
  |  Branch (1651:3): [True: 0, False: 60.8M]
  ------------------
 1652|    525|		case FILE_BELDATE:
  ------------------
  |  |  255|    525|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1652:3): [True: 213, False: 60.8M]
  ------------------
 1653|    525|		case FILE_LELDATE:
  ------------------
  |  |  256|    525|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1653:3): [True: 0, False: 60.8M]
  ------------------
 1654|    525|		case FILE_MELDATE:
  ------------------
  |  |  262|    525|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1654:3): [True: 0, False: 60.8M]
  ------------------
 1655|  1.08M|		case FILE_LONG:
  ------------------
  |  |  244|  1.08M|#define				FILE_LONG		4
  ------------------
  |  Branch (1655:3): [True: 1.08M, False: 59.7M]
  ------------------
 1656|  9.50M|		case FILE_BELONG:
  ------------------
  |  |  248|  9.50M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1656:3): [True: 8.42M, False: 52.4M]
  ------------------
 1657|  12.4M|		case FILE_LELONG:
  ------------------
  |  |  251|  12.4M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1657:3): [True: 2.98M, False: 57.8M]
  ------------------
 1658|  12.4M|		case FILE_MELONG:
  ------------------
  |  |  263|  12.4M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1658:3): [True: 56, False: 60.8M]
  ------------------
 1659|  12.4M|		case FILE_FLOAT:
  ------------------
  |  |  273|  12.4M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1659:3): [True: 0, False: 60.8M]
  ------------------
 1660|  12.4M|		case FILE_BEFLOAT:
  ------------------
  |  |  274|  12.4M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1660:3): [True: 0, False: 60.8M]
  ------------------
 1661|  12.4M|		case FILE_LEFLOAT:
  ------------------
  |  |  275|  12.4M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1661:3): [True: 0, False: 60.8M]
  ------------------
 1662|  12.4M|		case FILE_MSDOSDATE:
  ------------------
  |  |  293|  12.4M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1662:3): [True: 0, False: 60.8M]
  ------------------
 1663|  12.4M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  12.4M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1663:3): [True: 0, False: 60.8M]
  ------------------
 1664|  12.4M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  12.4M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1664:3): [True: 20, False: 60.8M]
  ------------------
 1665|  12.4M|		case FILE_MSDOSTIME:
  ------------------
  |  |  296|  12.4M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1665:3): [True: 0, False: 60.8M]
  ------------------
 1666|  12.4M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  12.4M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1666:3): [True: 0, False: 60.8M]
  ------------------
 1667|  12.4M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  12.4M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1667:3): [True: 20, False: 60.8M]
  ------------------
 1668|  12.4M|			v = CAST(int32_t, v);
  ------------------
  |  |  444|  12.4M|#define CAST(T, b)	((T)(b))
  ------------------
 1669|  12.4M|			break;
 1670|  47.7k|		case FILE_QUAD:
  ------------------
  |  |  264|  47.7k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1670:3): [True: 47.7k, False: 60.7M]
  ------------------
 1671|   513k|		case FILE_BEQUAD:
  ------------------
  |  |  266|   513k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1671:3): [True: 465k, False: 60.3M]
  ------------------
 1672|   764k|		case FILE_LEQUAD:
  ------------------
  |  |  265|   764k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1672:3): [True: 251k, False: 60.5M]
  ------------------
 1673|   764k|		case FILE_QDATE:
  ------------------
  |  |  267|   764k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1673:3): [True: 0, False: 60.8M]
  ------------------
 1674|   764k|		case FILE_QLDATE:
  ------------------
  |  |  270|   764k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1674:3): [True: 0, False: 60.8M]
  ------------------
 1675|   765k|		case FILE_QWDATE:
  ------------------
  |  |  282|   765k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1675:3): [True: 268, False: 60.8M]
  ------------------
 1676|   765k|		case FILE_BEQDATE:
  ------------------
  |  |  269|   765k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1676:3): [True: 216, False: 60.8M]
  ------------------
 1677|   765k|		case FILE_BEQLDATE:
  ------------------
  |  |  272|   765k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1677:3): [True: 0, False: 60.8M]
  ------------------
 1678|   765k|		case FILE_BEQWDATE:
  ------------------
  |  |  284|   765k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1678:3): [True: 0, False: 60.8M]
  ------------------
 1679|   765k|		case FILE_LEQDATE:
  ------------------
  |  |  268|   765k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1679:3): [True: 0, False: 60.8M]
  ------------------
 1680|   765k|		case FILE_LEQLDATE:
  ------------------
  |  |  271|   765k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1680:3): [True: 12, False: 60.8M]
  ------------------
 1681|   766k|		case FILE_LEQWDATE:
  ------------------
  |  |  283|   766k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1681:3): [True: 876, False: 60.8M]
  ------------------
 1682|   766k|		case FILE_DOUBLE:
  ------------------
  |  |  276|   766k|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1682:3): [True: 0, False: 60.8M]
  ------------------
 1683|   766k|		case FILE_BEDOUBLE:
  ------------------
  |  |  277|   766k|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1683:3): [True: 0, False: 60.8M]
  ------------------
 1684|   766k|		case FILE_LEDOUBLE:
  ------------------
  |  |  278|   766k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1684:3): [True: 0, False: 60.8M]
  ------------------
 1685|   768k|		case FILE_OFFSET:
  ------------------
  |  |  290|   768k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1685:3): [True: 2.08k, False: 60.8M]
  ------------------
 1686|   768k|		case FILE_BEVARINT:
  ------------------
  |  |  291|   768k|#define				FILE_BEVARINT		51
  ------------------
  |  Branch (1686:3): [True: 0, False: 60.8M]
  ------------------
 1687|   768k|		case FILE_LEVARINT:
  ------------------
  |  |  292|   768k|#define				FILE_LEVARINT		52
  ------------------
  |  Branch (1687:3): [True: 0, False: 60.8M]
  ------------------
 1688|   768k|			v = CAST(int64_t, v);
  ------------------
  |  |  444|   768k|#define CAST(T, b)	((T)(b))
  ------------------
 1689|   768k|			break;
 1690|  40.8M|		case FILE_STRING:
  ------------------
  |  |  245|  40.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (1690:3): [True: 40.8M, False: 19.9M]
  ------------------
 1691|  40.8M|		case FILE_PSTRING:
  ------------------
  |  |  253|  40.8M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1691:3): [True: 18.0k, False: 60.8M]
  ------------------
 1692|  40.8M|		case FILE_BESTRING16:
  ------------------
  |  |  258|  40.8M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1692:3): [True: 126, False: 60.8M]
  ------------------
 1693|  40.9M|		case FILE_LESTRING16:
  ------------------
  |  |  259|  40.9M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1693:3): [True: 47.6k, False: 60.7M]
  ------------------
 1694|  41.0M|		case FILE_REGEX:
  ------------------
  |  |  257|  41.0M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1694:3): [True: 160k, False: 60.6M]
  ------------------
 1695|  41.4M|		case FILE_SEARCH:
  ------------------
  |  |  260|  41.4M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1695:3): [True: 399k, False: 60.4M]
  ------------------
 1696|  41.4M|		case FILE_DEFAULT:
  ------------------
  |  |  243|  41.4M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1696:3): [True: 6.52k, False: 60.8M]
  ------------------
 1697|  41.4M|		case FILE_INDIRECT:
  ------------------
  |  |  281|  41.4M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1697:3): [True: 0, False: 60.8M]
  ------------------
 1698|  41.4M|		case FILE_NAME:
  ------------------
  |  |  285|  41.4M|#define				FILE_NAME		45
  ------------------
  |  Branch (1698:3): [True: 0, False: 60.8M]
  ------------------
 1699|  41.4M|		case FILE_USE:
  ------------------
  |  |  286|  41.4M|#define				FILE_USE		46
  ------------------
  |  Branch (1699:3): [True: 0, False: 60.8M]
  ------------------
 1700|  41.4M|		case FILE_CLEAR:
  ------------------
  |  |  287|  41.4M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1700:3): [True: 754, False: 60.8M]
  ------------------
 1701|  41.4M|		case FILE_DER:
  ------------------
  |  |  288|  41.4M|#define				FILE_DER		48
  ------------------
  |  Branch (1701:3): [True: 0, False: 60.8M]
  ------------------
 1702|  41.6M|		case FILE_GUID:
  ------------------
  |  |  289|  41.6M|#define				FILE_GUID		49
  ------------------
  |  Branch (1702:3): [True: 140k, False: 60.6M]
  ------------------
 1703|  41.6M|		case FILE_OCTAL:
  ------------------
  |  |  299|  41.6M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1703:3): [True: 0, False: 60.8M]
  ------------------
 1704|  41.6M|			break;
 1705|      0|		default:
  ------------------
  |  Branch (1705:3): [True: 0, False: 60.8M]
  ------------------
 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|  60.8M|		}
 1711|  60.8M|	}
 1712|  64.4M|	return v;
 1713|  64.4M|}
file_pstring_length_size:
 3635|  19.5k|{
 3636|  19.5k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  375|  19.5k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  404|  19.5k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|  19.5k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|  19.5k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|  19.5k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|  19.5k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|  19.5k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.5k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3637|  17.7k|	case PSTRING_1_LE:
  ------------------
  |  |  397|  17.7k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  388|  17.7k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3637:2): [True: 17.7k, False: 1.81k]
  ------------------
 3638|  17.7k|		return 1;
 3639|    342|	case PSTRING_2_LE:
  ------------------
  |  |  399|    342|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  388|    342|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3639:2): [True: 342, False: 19.2k]
  ------------------
 3640|  1.43k|	case PSTRING_2_BE:
  ------------------
  |  |  398|  1.43k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  388|  1.43k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3640:2): [True: 1.09k, False: 18.5k]
  ------------------
 3641|  1.43k|		return 2;
 3642|     45|	case PSTRING_4_LE:
  ------------------
  |  |  401|     45|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  388|     45|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3642:2): [True: 45, False: 19.5k]
  ------------------
 3643|    378|	case PSTRING_4_BE:
  ------------------
  |  |  400|    378|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  388|    378|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3643:2): [True: 333, False: 19.2k]
  ------------------
 3644|    378|		return 4;
 3645|      0|	default:
  ------------------
  |  Branch (3645:2): [True: 0, False: 19.5k]
  ------------------
 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|  19.5k|	}
 3651|  19.5k|}
file_pstring_get_length:
 3655|  18.0k|{
 3656|  18.0k|	size_t len = 0;
 3657|  18.0k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  445|  18.0k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3658|  18.0k|	unsigned int s3, s2, s1, s0;
 3659|       |
 3660|  18.0k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  375|  18.0k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  404|  18.0k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|  18.0k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|  18.0k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|  18.0k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|  18.0k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|  18.0k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  18.0k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3661|  17.4k|	case PSTRING_1_LE:
  ------------------
  |  |  397|  17.4k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  388|  17.4k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3661:2): [True: 17.4k, False: 585]
  ------------------
 3662|  17.4k|		len = *s;
 3663|  17.4k|		break;
 3664|    114|	case PSTRING_2_LE:
  ------------------
  |  |  399|    114|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  388|    114|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3664:2): [True: 114, False: 17.9k]
  ------------------
 3665|    114|		s0 = s[0];
 3666|    114|		s1 = s[1];
 3667|    114|		len = (s1 << 8) | s0;
 3668|    114|		break;
 3669|    343|	case PSTRING_2_BE:
  ------------------
  |  |  398|    343|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  388|    343|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3669:2): [True: 343, False: 17.7k]
  ------------------
 3670|    343|		s0 = s[0];
 3671|    343|		s1 = s[1];
 3672|    343|		len = (s0 << 8) | s1;
 3673|    343|		break;
 3674|     17|	case PSTRING_4_LE:
  ------------------
  |  |  401|     17|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  388|     17|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3674:2): [True: 17, False: 18.0k]
  ------------------
 3675|     17|		s0 = s[0];
 3676|     17|		s1 = s[1];
 3677|     17|		s2 = s[2];
 3678|     17|		s3 = s[3];
 3679|     17|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3680|     17|		break;
 3681|    111|	case PSTRING_4_BE:
  ------------------
  |  |  400|    111|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  388|    111|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3681:2): [True: 111, False: 17.9k]
  ------------------
 3682|    111|		s0 = s[0];
 3683|    111|		s1 = s[1];
 3684|    111|		s2 = s[2];
 3685|    111|		s3 = s[3];
 3686|    111|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3687|    111|		break;
 3688|      0|	default:
  ------------------
  |  Branch (3688:2): [True: 0, False: 18.0k]
  ------------------
 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|  18.0k|	}
 3694|       |
 3695|  18.0k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  375|  18.0k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  405|  18.0k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  388|  18.0k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3695:6): [True: 97, False: 17.9k]
  ------------------
 3696|     97|		size_t l = file_pstring_length_size(ms, m);
 3697|     97|		if (l == FILE_BADSIZE)
  ------------------
  |  |  175|     97|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|     97|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3697:7): [True: 0, False: 97]
  ------------------
 3698|      0|			return l;
 3699|     97|		len -= l;
 3700|     97|	}
 3701|       |
 3702|  18.0k|	return len;
 3703|  18.0k|}
file_magicfind:
 3707|  44.6k|{
 3708|  44.6k|	uint32_t i, j;
 3709|  44.6k|	struct mlist *mlist, *ml;
 3710|       |
 3711|  44.6k|	mlist = ms->mlist[1];
 3712|       |
 3713|  44.6k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3713:25): [True: 44.6k, False: 0]
  ------------------
 3714|  44.6k|		struct magic *ma = ml->magic;
 3715|   148M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3715:15): [True: 148M, False: 0]
  ------------------
 3716|   148M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  285|   148M|#define				FILE_NAME		45
  ------------------
  |  Branch (3716:8): [True: 142M, False: 6.56M]
  ------------------
 3717|   142M|				continue;
 3718|  6.56M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3718:8): [True: 44.6k, False: 6.52M]
  ------------------
 3719|  44.6k|				v->magic = &ma[i];
 3720|  44.6k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3721|  1.69M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3721:21): [True: 1.69M, False: 24]
  ------------------
 3722|  1.69M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3722:13): [True: 44.6k, False: 1.65M]
  ------------------
 3723|  44.6k|					    break;
 3724|  44.6k|				v->nmagic = j - i;
 3725|  44.6k|				return 0;
 3726|  44.6k|			}
 3727|  6.56M|		}
 3728|  44.6k|	}
 3729|      0|	return -1;
 3730|  44.6k|}
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|  9.70k|{
   73|  9.70k|	file_unichar_t *ubuf = NULL;
   74|  9.70k|	size_t ulen = 0;
   75|  9.70k|	int rv = 1;
   76|  9.70k|	struct buffer bb;
   77|       |
   78|  9.70k|	const char *code = NULL;
   79|  9.70k|	const char *code_mime = NULL;
   80|  9.70k|	const char *type = NULL;
   81|       |
   82|  9.70k|	bb = *b;
   83|  9.70k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  444|  9.70k|#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|  9.70k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 4.46k, False: 5.24k]
  |  Branch (88:23): [True: 1.19k, False: 3.27k]
  ------------------
   89|  1.19k|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  9.70k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 8.06k, False: 1.64k]
  ------------------
   93|  9.70k|	    &type) == 0)
   94|  8.06k|		rv = 0;
   95|  1.64k|        else
   96|  1.64k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  1.64k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  9.70k|	free(ubuf);
  100|       |
  101|  9.70k|	return rv;
  102|  9.70k|}
file_ascmagic_with_encoding:
  108|  1.64k|{
  109|  1.64k|	struct buffer bb;
  110|  1.64k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  1.64k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  1.64k|	size_t nbytes = b->flen;
  112|  1.64k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  1.64k|	size_t mlen, i, len;
  114|  1.64k|	int rv = -1;
  115|  1.64k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  1.64k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.64k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.64k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  1.64k|	int need_separator = 0;
  117|       |
  118|  1.64k|	const char *subtype = NULL;
  119|       |
  120|  1.64k|	int has_escapes = 0;
  121|  1.64k|	int has_backspace = 0;
  122|  1.64k|	int seen_cr = 0;
  123|       |
  124|  1.64k|	size_t n_crlf = 0;
  125|  1.64k|	size_t n_lf = 0;
  126|  1.64k|	size_t n_cr = 0;
  127|  1.64k|	size_t n_nel = 0;
  128|  1.64k|	int executable = 0;
  129|       |
  130|  1.64k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  444|  1.64k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  1.64k|	size_t has_long_lines = 0;
  132|       |
  133|  1.64k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  1.64k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 15, False: 1.62k]
  ------------------
  137|     15|		rv = 0;
  138|     15|		goto done;
  139|     15|	}
  140|       |
  141|  1.62k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  1.59k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 1.59k, False: 36]
  |  Branch (141:18): [True: 1.59k, False: 0]
  ------------------
  142|       |		/* Convert ubuf to UTF-8 and try text soft magic */
  143|       |		/* malloc size is a conservative overestimate; could be
  144|       |		   improved, or at least realloced after conversion. */
  145|  1.59k|		mlen = ulen * 6;
  146|  1.59k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  444|  1.59k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (146:7): [True: 0, False: 1.59k]
  ------------------
  147|      0|			file_oomem(ms, mlen);
  148|      0|			goto done;
  149|      0|		}
  150|  1.59k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (150:7): [True: 71, False: 1.52k]
  ------------------
  151|  1.59k|		    == NULL) {
  152|     71|			rv = 0;
  153|     71|			goto done;
  154|     71|		}
  155|  1.52k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  156|  1.52k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  444|  1.52k|#define CAST(T, b)	((T)(b))
  ------------------
  157|       |
  158|  1.52k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (158:7): [True: 1.43k, False: 82]
  ------------------
  159|  1.52k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  230|  1.52k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  160|  1.43k|			rv = -1;
  161|     82|		else
  162|     82|			need_separator = 1;
  163|  1.52k|		buffer_fini(&bb);
  164|  1.52k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.52k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.52k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (164:7): [True: 0, False: 1.52k]
  ------------------
  165|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (165:9): [True: 0, False: 0]
  ------------------
  166|      0|			goto done;
  167|      0|		}
  168|  1.52k|	}
  169|       |
  170|  1.55k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  1.55k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  1.55k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (170:6): [True: 0, False: 1.55k]
  ------------------
  171|      0|		rv = 0;
  172|      0|		goto done;
  173|      0|	}
  174|       |
  175|       |	/* Now try to discover other details about the file. */
  176|  5.25M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (176:14): [True: 5.25M, False: 1.55k]
  ------------------
  177|  5.25M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (177:7): [True: 1.15M, False: 4.09M]
  ------------------
  178|  1.15M|			if (seen_cr)
  ------------------
  |  Branch (178:8): [True: 5.41k, False: 1.15M]
  ------------------
  179|  5.41k|				n_crlf++;
  180|  1.15M|			else
  181|  1.15M|				n_lf++;
  182|  1.15M|			last_line_end = i;
  183|  4.09M|		} else if (seen_cr)
  ------------------
  |  Branch (183:14): [True: 352k, False: 3.74M]
  ------------------
  184|   352k|			n_cr++;
  185|       |
  186|  5.25M|		seen_cr = (ubuf[i] == '\r');
  187|  5.25M|		if (seen_cr)
  ------------------
  |  Branch (187:7): [True: 358k, False: 4.89M]
  ------------------
  188|   358k|			last_line_end = i;
  189|       |
  190|  5.25M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (190:7): [True: 284k, False: 4.96M]
  ------------------
  191|   284k|			n_nel++;
  192|   284k|			last_line_end = i;
  193|   284k|		}
  194|       |
  195|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  196|  5.25M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  5.25M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (196:7): [True: 3.36M, False: 1.88M]
  ------------------
  197|  3.36M|			size_t ll = i - last_line_end;
  198|  3.36M|			if (ll > has_long_lines)
  ------------------
  |  Branch (198:8): [True: 3.35M, False: 13.0k]
  ------------------
  199|  3.35M|				has_long_lines = ll;
  200|  3.36M|		}
  201|       |
  202|  5.25M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (202:7): [True: 1.60k, False: 5.25M]
  ------------------
  203|  1.60k|			has_escapes = 1;
  204|  5.25M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (204:7): [True: 205k, False: 5.04M]
  ------------------
  205|   205k|			has_backspace = 1;
  206|  5.25M|	}
  207|       |
  208|  1.55k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (208:6): [True: 0, False: 1.55k]
  ------------------
  209|      0|		rv = 0;
  210|      0|		goto done;
  211|      0|	}
  212|  1.55k|	len = file_printedlen(ms);
  213|  1.55k|	if (mime) {
  ------------------
  |  Branch (213:6): [True: 0, False: 1.55k]
  ------------------
  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|  1.55k|	} else {
  231|  1.55k|		if (len) {
  ------------------
  |  Branch (231:7): [True: 430, False: 1.12k]
  ------------------
  232|    430|			switch (file_replace(ms, " text$", ", ")) {
  233|    405|			case 0:
  ------------------
  |  Branch (233:4): [True: 405, False: 25]
  ------------------
  234|    405|				switch (file_replace(ms, " text executable$",
  235|    405|				    ", ")) {
  236|    361|				case 0:
  ------------------
  |  Branch (236:5): [True: 361, False: 44]
  ------------------
  237|    361|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (237:10): [True: 0, False: 361]
  ------------------
  238|      0|						goto done;
  239|    361|					break;
  240|    361|				case -1:
  ------------------
  |  Branch (240:5): [True: 0, False: 405]
  ------------------
  241|      0|					goto done;
  242|     44|				default:
  ------------------
  |  Branch (242:5): [True: 44, False: 361]
  ------------------
  243|     44|					executable = 1;
  244|     44|					break;
  245|    405|				}
  246|    405|				break;
  247|    405|			case -1:
  ------------------
  |  Branch (247:4): [True: 0, False: 430]
  ------------------
  248|      0|				goto done;
  249|     25|			default:
  ------------------
  |  Branch (249:4): [True: 25, False: 405]
  ------------------
  250|     25|				break;
  251|    430|			}
  252|    430|		}
  253|       |
  254|  1.55k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (254:7): [True: 0, False: 1.55k]
  ------------------
  255|      0|			goto done;
  256|       |
  257|  1.55k|		if (subtype) {
  ------------------
  |  Branch (257:7): [True: 0, False: 1.55k]
  ------------------
  258|      0|			if (file_printf(ms, " %s", subtype) == -1)
  ------------------
  |  Branch (258:8): [True: 0, False: 0]
  ------------------
  259|      0|				goto done;
  260|      0|		}
  261|       |
  262|  1.55k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (262:7): [True: 0, False: 1.55k]
  ------------------
  263|      0|			goto done;
  264|       |
  265|  1.55k|		if (executable)
  ------------------
  |  Branch (265:7): [True: 44, False: 1.51k]
  ------------------
  266|     44|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (266:8): [True: 0, False: 44]
  ------------------
  267|      0|				goto done;
  268|       |
  269|  1.55k|		if (has_long_lines)
  ------------------
  |  Branch (269:7): [True: 113, False: 1.44k]
  ------------------
  270|    113|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (270:8): [True: 0, False: 113]
  ------------------
  271|    113|			    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|  1.55k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (278:8): [True: 1.50k, False: 56]
  |  Branch (278:23): [True: 1.43k, False: 65]
  |  Branch (278:36): [True: 1.39k, False: 45]
  |  Branch (278:50): [True: 1.29k, False: 98]
  ------------------
  279|  1.55k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (279:8): [True: 56, False: 208]
  |  Branch (279:23): [True: 65, False: 143]
  |  Branch (279:36): [True: 45, False: 98]
  ------------------
  280|  1.45k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (280:8): [True: 0, False: 1.45k]
  ------------------
  281|      0|				goto done;
  282|       |
  283|  1.45k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (283:8): [True: 1.40k, False: 56]
  |  Branch (283:23): [True: 1.33k, False: 65]
  ------------------
  284|  1.45k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (284:8): [True: 1.29k, False: 45]
  |  Branch (284:22): [True: 1.29k, False: 0]
  ------------------
  285|  1.29k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (285:9): [True: 0, False: 1.29k]
  ------------------
  286|      0|					goto done;
  287|  1.29k|			} else {
  288|    166|				if (n_crlf) {
  ------------------
  |  Branch (288:9): [True: 56, False: 110]
  ------------------
  289|     56|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (289:10): [True: 0, False: 56]
  ------------------
  290|      0|						goto done;
  291|     56|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (291:10): [True: 31, False: 25]
  |  Branch (291:18): [True: 13, False: 12]
  |  Branch (291:26): [True: 4, False: 8]
  ------------------
  292|     48|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (292:11): [True: 0, False: 48]
  ------------------
  293|      0|							goto done;
  294|     56|				}
  295|    166|				if (n_cr) {
  ------------------
  |  Branch (295:9): [True: 96, False: 70]
  ------------------
  296|     96|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (296:10): [True: 0, False: 96]
  ------------------
  297|      0|						goto done;
  298|     96|					if (n_lf || n_nel)
  ------------------
  |  Branch (298:10): [True: 31, False: 65]
  |  Branch (298:18): [True: 9, False: 56]
  ------------------
  299|     40|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (299:11): [True: 0, False: 40]
  ------------------
  300|      0|							goto done;
  301|     96|				}
  302|    166|				if (n_lf) {
  ------------------
  |  Branch (302:9): [True: 53, False: 113]
  ------------------
  303|     53|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (303:10): [True: 0, False: 53]
  ------------------
  304|      0|						goto done;
  305|     53|					if (n_nel)
  ------------------
  |  Branch (305:10): [True: 11, False: 42]
  ------------------
  306|     11|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (306:11): [True: 0, False: 11]
  ------------------
  307|      0|							goto done;
  308|     53|				}
  309|    166|				if (n_nel)
  ------------------
  |  Branch (309:9): [True: 60, False: 106]
  ------------------
  310|     60|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (310:10): [True: 0, False: 60]
  ------------------
  311|      0|						goto done;
  312|    166|			}
  313|       |
  314|  1.45k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (314:8): [True: 0, False: 1.45k]
  ------------------
  315|      0|				goto done;
  316|  1.45k|		}
  317|       |
  318|  1.55k|		if (has_escapes)
  ------------------
  |  Branch (318:7): [True: 26, False: 1.53k]
  ------------------
  319|     26|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (319:8): [True: 0, False: 26]
  ------------------
  320|      0|				goto done;
  321|  1.55k|		if (has_backspace)
  ------------------
  |  Branch (321:7): [True: 44, False: 1.51k]
  ------------------
  322|     44|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (322:8): [True: 0, False: 44]
  ------------------
  323|      0|				goto done;
  324|  1.55k|	}
  325|  1.55k|	rv = 1;
  326|  1.64k|done:
  327|  1.64k|	free(utf8_buf);
  328|       |
  329|  1.64k|	return rv;
  330|  1.55k|}
ascmagic.c:trim_nuls:
   63|  11.3k|{
   64|  68.1M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 68.1M, False: 157]
  |  Branch (64:23): [True: 68.1M, False: 11.1k]
  ------------------
   65|  68.1M|		nbytes--;
   66|       |
   67|  11.3k|	return nbytes;
   68|  11.3k|}
ascmagic.c:encode_utf8:
  338|  1.59k|{
  339|  1.59k|	size_t i;
  340|  1.59k|	unsigned char *end = buf + len;
  341|       |
  342|  5.26M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (342:14): [True: 5.26M, False: 1.52k]
  ------------------
  343|  5.26M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (343:7): [True: 4.25M, False: 1.00M]
  ------------------
  344|  4.25M|			if (end - buf < 1)
  ------------------
  |  Branch (344:8): [True: 0, False: 4.25M]
  ------------------
  345|      0|				return NULL;
  346|  4.25M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  444|  4.25M|#define CAST(T, b)	((T)(b))
  ------------------
  347|  4.25M|			continue;
  348|  4.25M|		} 
  349|  1.00M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (349:7): [True: 983k, False: 20.5k]
  ------------------
  350|   983k|			if (end - buf < 2)
  ------------------
  |  Branch (350:8): [True: 0, False: 983k]
  ------------------
  351|      0|				return NULL;
  352|   983k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  444|   983k|#define CAST(T, b)	((T)(b))
  ------------------
  353|   983k|			goto out1;
  354|   983k|		}
  355|  20.5k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (355:7): [True: 8.22k, False: 12.3k]
  ------------------
  356|  8.22k|			if (end - buf < 3)
  ------------------
  |  Branch (356:8): [True: 0, False: 8.22k]
  ------------------
  357|      0|				return NULL;
  358|  8.22k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  444|  8.22k|#define CAST(T, b)	((T)(b))
  ------------------
  359|  8.22k|			goto out2;
  360|  8.22k|		}
  361|  12.3k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (361:7): [True: 427, False: 11.9k]
  ------------------
  362|    427|			if (end - buf < 4)
  ------------------
  |  Branch (362:8): [True: 0, False: 427]
  ------------------
  363|      0|				return NULL;
  364|    427|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  444|    427|#define CAST(T, b)	((T)(b))
  ------------------
  365|    427|			goto out3;
  366|    427|		}
  367|  11.9k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (367:7): [True: 4.50k, False: 7.41k]
  ------------------
  368|  4.50k|			if (end - buf < 5)
  ------------------
  |  Branch (368:8): [True: 0, False: 4.50k]
  ------------------
  369|      0|				return NULL;
  370|  4.50k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  444|  4.50k|#define CAST(T, b)	((T)(b))
  ------------------
  371|  4.50k|			goto out4;
  372|  4.50k|		} 
  373|  7.41k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (373:7): [True: 7.34k, False: 71]
  ------------------
  374|  7.34k|			if (end - buf < 6)
  ------------------
  |  Branch (374:8): [True: 0, False: 7.34k]
  ------------------
  375|      0|				return NULL;
  376|  7.34k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  444|  7.34k|#define CAST(T, b)	((T)(b))
  ------------------
  377|  7.34k|			goto out5;
  378|  7.34k|		} 
  379|       |		/* Invalid character */
  380|     71|		return NULL;
  381|  7.34k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  444|  7.34k|#define CAST(T, b)	((T)(b))
  ------------------
  382|  11.8k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  444|  11.8k|#define CAST(T, b)	((T)(b))
  ------------------
  383|  12.2k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  444|  12.2k|#define CAST(T, b)	((T)(b))
  ------------------
  384|  20.4k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  444|  20.4k|#define CAST(T, b)	((T)(b))
  ------------------
  385|  1.00M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  444|  1.00M|#define CAST(T, b)	((T)(b))
  ------------------
  386|  1.00M|	}
  387|       |
  388|  1.52k|	return buf;
  389|  1.59k|}

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

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

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

file_zmagic:
  270|  10.4k|{
  271|  10.4k|	unsigned char *newbuf = NULL;
  272|  10.4k|	size_t i, nsz;
  273|  10.4k|	char *rbuf;
  274|  10.4k|	file_pushbuf_t *pb;
  275|  10.4k|	int urv, prv, rv = 0;
  276|  10.4k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  277|  10.4k|	int fd = b->fd;
  278|  10.4k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
  279|  10.4k|	size_t nbytes = b->flen;
  280|  10.4k|	int sa_saved = 0;
  281|  10.4k|	struct sigaction sig_act;
  282|       |
  283|  10.4k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  10.4k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (283:6): [True: 1.65k, False: 8.79k]
  ------------------
  284|  1.65k|		return 0;
  285|       |
  286|   140k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (286:14): [True: 131k, False: 8.79k]
  ------------------
  287|   131k|		int zm;
  288|   131k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  444|   131k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (288:7): [True: 4.61k, False: 127k]
  ------------------
  289|  4.61k|			continue;
  290|   127k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (290:7): [True: 15.6k, False: 111k]
  ------------------
  291|  15.6k|			zm = (*compr[i].u.func)(buf);
  292|   111k|		} else {
  293|   111k|			zm = memcmp(buf, compr[i].u.magic,
  294|   111k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  444|   111k|#define CAST(T, b)	((T)(b))
  ------------------
  295|   111k|		}
  296|       |
  297|   127k|		if (!zm)
  ------------------
  |  Branch (297:7): [True: 126k, False: 925]
  ------------------
  298|   126k|			continue;
  299|       |
  300|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  301|    925|		if (!sa_saved) {
  ------------------
  |  Branch (301:7): [True: 697, False: 228]
  ------------------
  302|       |			//We can use sig_act for both new and old, but
  303|    697|			struct sigaction new_act;
  304|    697|			memset(&new_act, 0, sizeof(new_act));
  305|    697|			new_act.sa_handler = SIG_IGN;
  306|    697|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  307|    697|		}
  308|       |
  309|    925|		nsz = nbytes;
  310|    925|		free(newbuf);
  311|    925|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  312|    925|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|    925|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  313|    925|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  314|    925|		    (char *)newbuf, nsz);
  315|    925|		switch (urv) {
  316|    755|		case OKDATA:
  ------------------
  |  |  215|    755|#define OKDATA 	0
  ------------------
  |  Branch (316:3): [True: 755, False: 170]
  ------------------
  317|    925|		case ERRDATA:
  ------------------
  |  |  217|    925|#define ERRDATA	2
  ------------------
  |  Branch (317:3): [True: 170, False: 755]
  ------------------
  318|    925|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|    925|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  319|    925|			if (urv == ERRDATA)
  ------------------
  |  |  217|    925|#define ERRDATA	2
  ------------------
  |  Branch (319:8): [True: 170, False: 755]
  ------------------
  320|    170|				prv = format_decompression_error(ms, i, newbuf);
  321|    755|			else
  322|    755|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  323|    755|				    nsz);
  324|    925|			if (prv == -1)
  ------------------
  |  Branch (324:8): [True: 0, False: 925]
  ------------------
  325|      0|				goto error;
  326|    925|			rv = 1;
  327|    925|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|    925|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (327:8): [True: 0, False: 925]
  ------------------
  328|      0|				goto out;
  329|    925|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  1.85k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    925|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    925|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (329:8): [True: 925, False: 0]
  |  Branch (329:30): [True: 0, False: 925]
  ------------------
  330|      0|				goto out;
  331|    925|			if ((file_printf(ms,
  ------------------
  |  Branch (331:8): [True: 0, False: 925]
  ------------------
  332|    925|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (332:8): [True: 0, False: 925]
  ------------------
  333|      0|				goto error;
  334|    925|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (334:8): [True: 3, False: 922]
  ------------------
  335|      3|				goto error;
  336|       |			/*
  337|       |			 * XXX: If file_buffer fails here, we overwrite
  338|       |			 * the compressed text. FIXME.
  339|       |			 */
  340|    922|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (340:8): [True: 0, False: 922]
  ------------------
  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|    922|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (346:8): [True: 922, False: 0]
  ------------------
  347|    922|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (347:9): [True: 2, False: 920]
  ------------------
  348|      2|					free(rbuf);
  349|      2|					goto error;
  350|      2|				}
  351|    920|				free(rbuf);
  352|    920|			}
  353|    920|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (353:8): [True: 920, False: 0]
  |  Branch (353:17): [True: 0, False: 920]
  ------------------
  354|      0|				goto error;
  355|       |			/*FALLTHROUGH*/
  356|    920|		case NODATA:
  ------------------
  |  |  216|    920|#define NODATA	1
  ------------------
  |  Branch (356:3): [True: 0, False: 925]
  ------------------
  357|    920|			break;
  358|      0|		default:
  ------------------
  |  Branch (358:3): [True: 0, False: 925]
  ------------------
  359|      0|			abort();
  360|       |			/*NOTREACHED*/
  361|      5|		error:
  362|      5|			rv = -1;
  363|      5|			break;
  364|    925|		}
  365|    925|	}
  366|  8.79k|out:
  367|  8.79k|	DPRINTF("rv = %d\n", rv);
  368|       |
  369|  8.79k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (369:6): [True: 697, False: 8.10k]
  |  Branch (369:18): [True: 697, False: 0]
  ------------------
  370|    697|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  371|       |
  372|  8.79k|	free(newbuf);
  373|  8.79k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  8.79k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  374|  8.79k|	DPRINTF("Zmagic returns %d\n", rv);
  375|  8.79k|	return rv;
  376|  8.79k|}
sread:
  408|  1.75k|{
  409|  1.75k|	ssize_t rv;
  410|  1.75k|#if defined(FIONREAD) && !defined(__MINGW32__)
  411|  1.75k|	int t = 0;
  412|  1.75k|#endif
  413|  1.75k|	size_t rn = n;
  414|       |
  415|  1.75k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (415:6): [True: 0, False: 1.75k]
  ------------------
  416|      0|		goto nocheck;
  417|       |
  418|  1.75k|#if defined(FIONREAD) && !defined(__MINGW32__)
  419|  1.75k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (419:6): [True: 0, False: 1.75k]
  |  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|  1.75k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (447:6): [True: 0, False: 1.75k]
  |  Branch (447:15): [True: 0, False: 0]
  ------------------
  448|      0|		n = t;
  449|      0|		rn = n;
  450|      0|	}
  451|  1.75k|#endif
  452|       |
  453|  1.75k|nocheck:
  454|  1.75k|	do
  455|  19.5k|		switch ((rv = read(fd, buf, n))) {
  456|      0|		case -1:
  ------------------
  |  Branch (456:3): [True: 0, False: 19.5k]
  ------------------
  457|      0|			if (errno == EINTR)
  ------------------
  |  Branch (457:8): [True: 0, False: 0]
  ------------------
  458|      0|				continue;
  459|      0|			return -1;
  460|  1.74k|		case 0:
  ------------------
  |  Branch (460:3): [True: 1.74k, False: 17.7k]
  ------------------
  461|  1.74k|			return rn - n;
  462|  17.7k|		default:
  ------------------
  |  Branch (462:3): [True: 17.7k, False: 1.74k]
  ------------------
  463|  17.7k|			n -= rv;
  464|  17.7k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  444|  17.7k|#define CAST(T, b)	((T)(b))
  ------------------
  465|  17.7k|			break;
  466|  19.5k|		}
  467|  17.7k|	while (n > 0);
  ------------------
  |  Branch (467:9): [True: 17.7k, False: 9]
  ------------------
  468|      9|	return rn;
  469|  1.75k|}
compress.c:lzmacmp:
  137|  6.85k|{
  138|  6.85k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (138:6): [True: 6.83k, False: 21]
  |  Branch (138:24): [True: 3, False: 18]
  |  Branch (138:34): [True: 8, False: 10]
  ------------------
  139|  6.84k|		return 0;
  140|     10|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (140:6): [True: 9, False: 1]
  |  Branch (140:17): [True: 8, False: 1]
  ------------------
  141|      8|		return 0;
  142|      2|	return 1;
  143|     10|}
compress.c:zlibcmp:
  119|  8.79k|{
  120|  8.79k|	unsigned short x = 1;
  121|  8.79k|	unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
  ------------------
  |  |  444|  8.79k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  8.79k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (123:6): [True: 8.66k, False: 134]
  |  Branch (123:29): [True: 20, False: 114]
  ------------------
  124|  8.68k|		return 0;
  125|    114|	if (s[0] != 1)	/* endianness test */
  ------------------
  |  Branch (125:6): [True: 0, False: 114]
  ------------------
  126|      0|		x = buf[0] | (buf[1] << 8);
  127|    114|	else
  128|    114|		x = buf[1] | (buf[0] << 8);
  129|    114|	if (x % 31)
  ------------------
  |  Branch (129:6): [True: 97, False: 17]
  ------------------
  130|     97|		return 0;
  131|     17|	return 1;
  132|    114|}
compress.c:format_decompression_error:
  253|    170|{
  254|    170|	unsigned char *p;
  255|    170|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    170|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    170|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    170|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  256|       |
  257|    170|	if (!mime)
  ------------------
  |  Branch (257:6): [True: 170, False: 0]
  ------------------
  258|    170|		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|    170|}
compress.c:methodname:
  986|    170|{
  987|    170|	switch (method) {
  988|      0|#ifdef BUILTIN_DECOMPRESS
  989|     11|	case METH_FROZEN:
  ------------------
  |  |  185|     11|#define METH_FROZEN	2
  ------------------
  |  Branch (989:2): [True: 11, False: 159]
  ------------------
  990|     28|	case METH_ZLIB:
  ------------------
  |  |  191|     28|#define METH_ZLIB	14
  ------------------
  |  Branch (990:2): [True: 17, False: 153]
  ------------------
  991|     28|		return "zlib";
  992|      0|#endif
  993|      0|#ifdef BUILTIN_BZLIB
  994|     11|	case METH_BZIP:
  ------------------
  |  |  186|     11|#define METH_BZIP	7
  ------------------
  |  Branch (994:2): [True: 11, False: 159]
  ------------------
  995|     11|		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: 168]
  ------------------
  999|      4|	case METH_LZMA:
  ------------------
  |  |  190|      4|#define METH_LZMA	13
  ------------------
  |  Branch (999:2): [True: 2, False: 168]
  ------------------
 1000|      4|		return "xzlib";
 1001|      0|#endif
 1002|      0|#ifdef BUILTIN_ZSTDLIB
 1003|      2|	case METH_ZSTD:
  ------------------
  |  |  189|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (1003:2): [True: 2, False: 168]
  ------------------
 1004|      2|		return "zstd";
 1005|      0|#endif
 1006|       |#ifdef BUILTIN_LZLIB
 1007|       |	case METH_LZIP:
 1008|       |		return "lzlib";
 1009|       |#endif
 1010|    125|	default:
  ------------------
  |  Branch (1010:2): [True: 125, False: 45]
  ------------------
 1011|    125|		return compr[method].argv[0];
 1012|    170|	}
 1013|    170|}
compress.c:uncompressbuf:
 1051|    925|{
 1052|    925|	int fdp[3][2];
 1053|    925|	int status, rv, w;
 1054|    925|	pid_t pid;
 1055|    925|	pid_t writepid = -1;
 1056|    925|	size_t i;
 1057|    925|	ssize_t r, re;
 1058|    925|	char *const *args;
 1059|    925|#ifdef HAVE_POSIX_SPAWNP
 1060|    925|	posix_spawn_file_actions_t fa;
 1061|    925|#endif
 1062|    925|	int (*decompress)(const unsigned char *, unsigned char **,
 1063|    925|	    size_t, size_t *, int) = getdecompressor(method);
 1064|       |
 1065|    925|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  444|    925|#define CAST(T, b)	((T)(b))
  ------------------
 1066|    925|	if (*newch == NULL)
  ------------------
  |  Branch (1066:6): [True: 0, False: 925]
  ------------------
 1067|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1068|       |
 1069|    925|	if (decompress) {
  ------------------
  |  Branch (1069:6): [True: 45, False: 880]
  ------------------
 1070|     45|		if (nofork) {
  ------------------
  |  Branch (1070:7): [True: 45, False: 0]
  ------------------
 1071|     45|			return makeerror(newch, n,
 1072|     45|			    "Fork is required to uncompress, but disabled");
 1073|     45|		}
 1074|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1075|     45|	}
 1076|       |
 1077|    880|	(void)fflush(stdout);
 1078|    880|	(void)fflush(stderr);
 1079|       |
 1080|  3.52k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  3.52k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1080:14): [True: 2.64k, False: 880]
  ------------------
 1081|  2.64k|		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|    880|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1097:7): [True: 0, False: 880]
  |  Branch (1097:19): [True: 0, False: 0]
  ------------------
 1098|    880|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1098:6): [True: 0, False: 880]
  ------------------
 1099|    880|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1099:6): [True: 0, False: 880]
  ------------------
 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|    880|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  445|    880|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1107|    880|#ifdef HAVE_POSIX_SPAWNP
 1108|    880|	posix_spawn_file_actions_init(&fa);
 1109|       |
 1110|    880|	handledesc(&fa, fd, fdp);
 1111|       |
 1112|    880|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1113|    880|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1114|    880|	    args, NULL);
 1115|       |
 1116|    880|	posix_spawn_file_actions_destroy(&fa);
 1117|       |
 1118|    880|	if (status == -1) {
  ------------------
  |  Branch (1118:6): [True: 0, False: 880]
  ------------------
 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|  2.64k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  2.64k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1148:14): [True: 1.76k, False: 880]
  ------------------
 1149|  1.76k|		closefd(fdp[i], 1);
 1150|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1151|    880|	if (fd == -1) {
  ------------------
  |  Branch (1151:6): [True: 0, False: 880]
  ------------------
 1152|      0|		closefd(fdp[STDIN_FILENO], 0);
 1153|      0|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1154|      0|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1154:7): [True: 0, False: 0]
  ------------------
 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|      0|		closefd(fdp[STDIN_FILENO], 1);
 1161|      0|	}
 1162|       |
 1163|    880|	rv = OKDATA;
  ------------------
  |  |  215|    880|#define OKDATA 	0
  ------------------
 1164|    880|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1165|    880|	DPRINTF("read got %zd\n", r);
 1166|    880|	if (r < 0) {
  ------------------
  |  Branch (1166:6): [True: 0, False: 880]
  ------------------
 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|    880|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  444|    880|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1172:6): [True: 9, False: 871]
  ------------------
 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|      9|		DPRINTF("Closing stdout for bytes_max\n");
 1179|      9|		closefd(fdp[STDOUT_FILENO], 0);
 1180|      9|		goto ok;
 1181|      9|	}
 1182|    871|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1182:6): [True: 113, False: 758]
  ------------------
 1183|    113|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1184|    113|		rv = ERRDATA;
  ------------------
  |  |  217|    113|#define ERRDATA	2
  ------------------
 1185|    113|		r = filter_error(*newch, r);
 1186|    113|		goto ok;
 1187|    113|	}
 1188|    758|	if  (re == 0)
  ------------------
  |  Branch (1188:7): [True: 758, False: 0]
  ------------------
 1189|    758|		goto ok;
 1190|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1191|      0|	    strerror(errno));
 1192|      0|	goto err;
 1193|    880|ok:
 1194|    880|	*n = r;
 1195|       |	/* NUL terminate, as every buffer is handled here. */
 1196|    880|	(*newch)[*n] = '\0';
 1197|    880|err:
 1198|    880|	closefd(fdp[STDIN_FILENO], 1);
 1199|    880|	closefd(fdp[STDOUT_FILENO], 0);
 1200|    880|	closefd(fdp[STDERR_FILENO], 0);
 1201|       |
 1202|    880|	w = waitpid(pid, &status, 0);
 1203|    880|wait_err:
 1204|    880|	if (w == -1) {
  ------------------
  |  Branch (1204:6): [True: 12, False: 868]
  ------------------
 1205|     12|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1206|     12|		DPRINTF("Child wait return %#x\n", status);
 1207|    868|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1207:13): [True: 0, False: 868]
  ------------------
 1208|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1209|    868|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1209:13): [True: 122, False: 746]
  ------------------
 1210|    122|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1211|    122|	}
 1212|    880|	if (writepid > 0) {
  ------------------
  |  Branch (1212:6): [True: 0, False: 880]
  ------------------
 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|      0|		w = waitpid(writepid, &status, 0);
 1218|      0|		writepid = -1;
 1219|      0|		goto wait_err;
 1220|      0|	}
 1221|       |
 1222|    880|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1223|    880|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1224|       |
 1225|    880|	return rv;
 1226|    880|}
compress.c:getdecompressor:
 1018|    925|{
 1019|    925|	switch (method) {
 1020|      0|#ifdef BUILTIN_DECOMPRESS
 1021|     11|	case METH_FROZEN:
  ------------------
  |  |  185|     11|#define METH_FROZEN	2
  ------------------
  |  Branch (1021:2): [True: 11, False: 914]
  ------------------
 1022|     11|		return uncompressgzipped;
 1023|     17|	case METH_ZLIB:
  ------------------
  |  |  191|     17|#define METH_ZLIB	14
  ------------------
  |  Branch (1023:2): [True: 17, False: 908]
  ------------------
 1024|     17|		return uncompresszlib;
 1025|      0|#endif
 1026|      0|#ifdef BUILTIN_BZLIB
 1027|     11|	case METH_BZIP:
  ------------------
  |  |  186|     11|#define METH_BZIP	7
  ------------------
  |  Branch (1027:2): [True: 11, False: 914]
  ------------------
 1028|     11|		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: 923]
  ------------------
 1032|      4|	case METH_LZMA:
  ------------------
  |  |  190|      4|#define METH_LZMA	13
  ------------------
  |  Branch (1032:2): [True: 2, False: 923]
  ------------------
 1033|      4|		return uncompressxzlib;
 1034|      0|#endif
 1035|      0|#ifdef BUILTIN_ZSTDLIB
 1036|      2|	case METH_ZSTD:
  ------------------
  |  |  189|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (1036:2): [True: 2, False: 923]
  ------------------
 1037|      2|		return uncompresszstd;
 1038|      0|#endif
 1039|       |#ifdef BUILTIN_LZLIB
 1040|       |	case METH_LZIP:
 1041|       |		return uncompresslzlib;
 1042|       |#endif
 1043|    880|	default:
  ------------------
  |  Branch (1043:2): [True: 880, False: 45]
  ------------------
 1044|    880|		return NULL;
 1045|    925|	}
 1046|    925|}
compress.c:makeerror:
  835|     57|{
  836|     57|	char *msg;
  837|     57|	va_list ap;
  838|     57|	int rv;
  839|       |
  840|     57|	DPRINTF("Makeerror %s\n", fmt);
  841|     57|	free(*buf);
  842|     57|	va_start(ap, fmt);
  843|     57|	rv = vasprintf(&msg, fmt, ap);
  844|     57|	va_end(ap);
  845|     57|	if (rv < 0) {
  ------------------
  |  Branch (845:6): [True: 0, False: 57]
  ------------------
  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|     57|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  445|     57|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  852|     57|	*len = strlen(msg);
  853|     57|	return ERRDATA;
  ------------------
  |  |  217|     57|#define ERRDATA	2
  ------------------
  854|     57|}
compress.c:handledesc:
  904|    880|{
  905|    880|	if (fd != -1) {
  ------------------
  |  Branch (905:6): [True: 880, False: 0]
  ------------------
  906|    880|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  444|    880|#define CAST(T, b)	((T)(b))
  ------------------
  907|    880|		movedesc(v, STDIN_FILENO, fd);
  908|    880|	} else {
  909|      0|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
  910|      0|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (910:7): [True: 0, False: 0]
  ------------------
  911|      0|		    closedesc(v, fdp[STDIN_FILENO][1]);
  912|      0|	}
  913|       |
  914|    880|	file_clear_closexec(STDIN_FILENO);
  915|       |
  916|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
  917|    880|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
  918|    880|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (918:6): [True: 880, False: 0]
  ------------------
  919|    880|		closedesc(v, fdp[STDOUT_FILENO][0]);
  920|       |
  921|    880|	file_clear_closexec(STDOUT_FILENO);
  922|       |
  923|    880|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
  924|    880|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (924:6): [True: 880, False: 0]
  ------------------
  925|    880|		closedesc(v, fdp[STDERR_FILENO][0]);
  926|       |
  927|    880|	file_clear_closexec(STDERR_FILENO);
  928|    880|}
compress.c:movedesc:
  875|  2.64k|{
  876|  2.64k|	if (fd == i)
  ------------------
  |  Branch (876:6): [True: 0, False: 2.64k]
  ------------------
  877|      0|		return; /* "no dup was necessary" */
  878|  2.64k|#ifdef HAVE_POSIX_SPAWNP
  879|  2.64k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  445|  2.64k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  880|  2.64k|	posix_spawn_file_actions_adddup2(fa, fd, i);
  881|  2.64k|	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|  2.64k|}
compress.c:closedesc:
  893|  1.76k|{
  894|  1.76k|#ifdef HAVE_POSIX_SPAWNP
  895|  1.76k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  445|  1.76k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  896|  1.76k|	posix_spawn_file_actions_addclose(fa, fd);
  897|       |#else
  898|       |	close(v ? fd : fd);
  899|       |#endif
  900|  1.76k|}
compress.c:closefd:
  858|  5.28k|{
  859|  5.28k|	if (fd[i] == -1)
  ------------------
  |  Branch (859:6): [True: 1.76k, False: 3.52k]
  ------------------
  860|  1.76k|		return;
  861|  3.52k|	(void) close(fd[i]);
  862|  3.52k|	fd[i] = -1;
  863|  3.52k|}
compress.c:filter_error:
  958|    113|{
  959|    113|	char *p;
  960|    113|	char *buf;
  961|       |
  962|    113|	ubuf[n] = '\0';
  963|    113|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  445|    113|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  964|    113|	while (isspace(CAST(unsigned char, *buf)))
  965|     39|		buf++;
  966|    113|	DPRINTF("Filter error[[[%s]]]\n", buf);
  967|    113|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  444|    113|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (967:6): [True: 8, False: 105]
  ------------------
  968|      8|		*p = '\0';
  969|    113|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  444|    113|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (969:6): [True: 0, False: 113]
  ------------------
  970|      0|		*p = '\0';
  971|    113|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  444|    113|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (971:6): [True: 23, False: 90]
  ------------------
  972|     23|		++p;
  973|     23|		while (isspace(CAST(unsigned char, *p)))
  974|     23|			p++;
  975|     23|		n = strlen(p);
  976|     23|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  444|     23|#define CAST(T, b)	((T)(b))
  ------------------
  977|     23|	}
  978|    113|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
  979|    113|	if (islower(*ubuf))
  980|     18|		*ubuf = toupper(*ubuf);
  981|    113|	return n;
  982|    113|}

der_offs:
  265|  23.1k|{
  266|  23.1k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  445|  23.1k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  23.1k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 23.1k, False: 0]
  ------------------
  268|       |
  269|  23.1k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  23.1k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  23.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 23.1k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  23.1k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  23.1k|	    offs, m->offset));
  275|       |
  276|  23.1k|	uint32_t tlen = getlength(b, &offs, len);
  277|  23.1k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  23.1k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  23.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 23.1k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  23.1k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  23.1k|	    offs, tlen));
  283|       |
  284|  23.1k|	offs += ms->offset + m->offset;
  285|  23.1k|	DPRINTF(("cont_level = %d\n", m->cont_level));
  286|       |#ifdef DEBUG_DER
  287|       |	size_t i;
  288|       |	for (i = 0; i < m->cont_level; i++)
  289|       |		printf("cont_level[%" SIZE_T_FORMAT "u] = %d\n", i,
  290|       |		    ms->c.li[i].off);
  291|       |#endif
  292|  23.1k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 3.67k, False: 19.4k]
  ------------------
  293|  3.67k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 3.67k]
  ------------------
  294|      0|			return -1;
  295|  3.67k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  444|  3.67k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  3.67k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  3.67k|		    ms->c.li[m->cont_level - 1].off));
  298|  3.67k|	}
  299|  23.1k|	return CAST(int32_t, offs);
  ------------------
  |  |  444|  23.1k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  23.1k|}
der_cmp:
  304|   306k|{
  305|   306k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  445|   306k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   306k|	const char *s = m->value.s;
  307|   306k|	size_t offs = 0, len = ms->search.s_len;
  308|   306k|	uint32_t tag, tlen;
  309|   306k|	char buf[128];
  310|       |
  311|   306k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   306k|	tag = gettag(b, &offs, len);
  314|   306k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   306k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   306k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 11.4k, False: 294k]
  ------------------
  315|  11.4k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  11.4k|		return -1;
  317|  11.4k|	}
  318|       |
  319|   294k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   294k|	    offs, m->offset));
  321|       |
  322|   294k|	tlen = getlength(b, &offs, len);
  323|   294k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   294k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   294k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 91.5k, False: 202k]
  ------------------
  324|  91.5k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|  91.5k|		return -1;
  326|  91.5k|	}
  327|       |
  328|   202k|	der_tag(buf, sizeof(buf), tag);
  329|   202k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   202k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 202k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   202k|	size_t slen = strlen(buf);
  333|       |
  334|   202k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 178k, False: 24.5k]
  ------------------
  335|   178k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   178k|		return 0;
  337|   178k|	}
  338|       |
  339|  24.5k|	s += slen;
  340|       |
  341|  25.3k|again:
  342|  25.3k|	switch (*s) {
  343|  22.5k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 22.5k, False: 2.82k]
  ------------------
  344|  22.5k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  22.5k|		return 1;
  346|    987|	case '=':
  ------------------
  |  Branch (346:2): [True: 987, False: 24.3k]
  ------------------
  347|    987|		s++;
  348|    987|		goto val;
  349|  1.83k|	default:
  ------------------
  |  Branch (349:2): [True: 1.83k, False: 23.5k]
  ------------------
  350|  1.83k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 1.83k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  1.83k|		slen = 0;
  356|  1.83k|		do
  357|  2.61k|			slen = slen * 10 + *s - '0';
  358|  1.83k|		while (isdigit(CAST(unsigned char, *++s)));
  359|  1.83k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.83k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 1.83k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  1.83k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 984, False: 851]
  ------------------
  363|    984|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|    984|			return 0;
  365|    984|		}
  366|    851|		goto again;
  367|  25.3k|	}
  368|    987|val:
  369|    987|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|    987|	    tlen));
  371|    987|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|    987|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    987|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 987]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|    987|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 562, False: 425]
  |  Branch (374:29): [True: 375, False: 187]
  ------------------
  375|    375|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|    375|		return 0;
  377|    375|	}
  378|    612|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    612|	DPRINTF(("%s: complete match\n", __func__));
  380|    612|	return 1;
  381|    987|}
der.c:gettag:
  150|   329k|{
  151|   329k|	uint32_t tag;
  152|       |
  153|   329k|	if (*p >= l)
  ------------------
  |  Branch (153:6): [True: 2.39k, False: 326k]
  ------------------
  154|  2.39k|		return DER_BAD;
  ------------------
  |  |   62|  2.39k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  2.39k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   326k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   326k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 188k, False: 138k]
  ------------------
  159|   188k|		return tag;
  160|       |
  161|   138k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 547, False: 138k]
  ------------------
  162|    547|		return DER_BAD;
  ------------------
  |  |   62|    547|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|    547|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  1.32M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 1.18M, False: 136k]
  ------------------
  165|  1.18M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  1.18M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 1.95k, False: 1.18M]
  ------------------
  167|  1.95k|			return DER_BAD;
  ------------------
  |  |   62|  1.95k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  1.95k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  1.18M|	}
  169|   136k|	return tag;
  170|   138k|}
der.c:getlength:
  183|   317k|{
  184|   317k|	uint8_t digits, i;
  185|   317k|	size_t len;
  186|   317k|	int is_onebyte_result;
  187|       |
  188|   317k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 2.80k, False: 314k]
  ------------------
  189|  2.80k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  2.80k|		return DER_BAD;
  ------------------
  |  |   62|  2.80k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  2.80k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  2.80k|	}
  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|   314k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   314k|	digits = c[(*p)++] & 0x7f;
  200|   314k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 78.0k, False: 236k]
  ------------------
  201|  78.0k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|  78.0k|		return DER_BAD;
  ------------------
  |  |   62|  78.0k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  78.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|  78.0k|	}
  204|       |
  205|   236k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 200k, False: 36.6k]
  ------------------
  206|   200k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  36.6k|	len = 0;
  213|  2.25M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 2.22M, False: 36.6k]
  ------------------
  214|  2.22M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  36.6k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 9.35k, False: 27.2k]
  |  Branch (216:31): [True: 1.35k, False: 25.9k]
  ------------------
  217|  10.7k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  10.7k|		    __func__, *p, len, l));
  219|  10.7k|		return DER_BAD;
  ------------------
  |  |   62|  10.7k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  10.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  10.7k|	}
  221|  25.9k|	return CAST(uint32_t, len);
  ------------------
  |  |  444|  25.9k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  36.6k|}
der.c:der_tag:
  226|   202k|{
  227|   202k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   202k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 131k, False: 71.1k]
  ------------------
  228|   131k|		strlcpy(buf, der__tag[tag], len);
  229|  71.1k|	else
  230|  71.1k|		snprintf(buf, len, "%#x", tag);
  231|   202k|	return buf;
  232|   202k|}
der.c:der_data:
  237|    987|{
  238|    987|	uint32_t i;
  239|    987|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  444|    987|#define CAST(T, b)	((T)(b))
  ------------------
  240|    987|	switch (tag) {
  241|     60|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     60|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 60, False: 927]
  ------------------
  242|    136|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    136|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 76, False: 911]
  ------------------
  243|    136|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    136|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 0, False: 987]
  ------------------
  244|    136|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  445|    136|#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: 987]
  ------------------
  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|    851|	default:
  ------------------
  |  Branch (251:2): [True: 851, False: 136]
  ------------------
  252|    851|		break;
  253|    987|	}
  254|       |
  255|  3.90k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 3.05k, False: 851]
  ------------------
  256|  3.05k|		uint32_t z = i << 1;
  257|  3.05k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 2.82k, False: 238]
  ------------------
  258|  2.82k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  3.05k|	}
  260|    851|	return len * 2;
  261|    987|}

file_encoding:
   78|  20.1k|{
   79|  20.1k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  20.1k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  20.1k|	size_t nbytes = b->flen;
   81|  20.1k|	size_t mlen;
   82|  20.1k|	int rv = 1, ucs_type;
   83|  20.1k|	file_unichar_t *udefbuf;
   84|  20.1k|	size_t udeflen;
   85|       |
   86|  20.1k|	if (ubuf == NULL)
  ------------------
  |  Branch (86:6): [True: 10.4k, False: 9.70k]
  ------------------
   87|  10.4k|		ubuf = &udefbuf;
   88|  20.1k|	if (ulen == NULL)
  ------------------
  |  Branch (88:6): [True: 10.4k, False: 9.70k]
  ------------------
   89|  10.4k|		ulen = &udeflen;
   90|       |
   91|  20.1k|	*type = "text";
   92|  20.1k|	*ulen = 0;
   93|  20.1k|	*code = "unknown";
   94|  20.1k|	*code_mime = "binary";
   95|       |
   96|  20.1k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (96:6): [True: 262, False: 19.9k]
  ------------------
   97|    262|		nbytes = ms->encoding_max;
   98|       |
   99|  20.1k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  100|  20.1k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  444|  20.1k|#define CAST(T, b)	((T)(b))
  ------------------
  101|  20.1k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (101:6): [True: 0, False: 20.1k]
  ------------------
  102|      0|		file_oomem(ms, mlen);
  103|      0|		goto done;
  104|      0|	}
  105|  20.1k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (105:6): [True: 1.23k, False: 18.9k]
  ------------------
  106|  1.23k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (106:7): [True: 10, False: 1.22k]
  ------------------
  107|     10|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  108|     10|			*code = "Unicode text, UTF-7";
  109|     10|			*code_mime = "utf-7";
  110|  1.22k|		} else {
  111|  1.22k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  112|  1.22k|			*code = "ASCII";
  113|  1.22k|			*code_mime = "us-ascii";
  114|  1.22k|		}
  115|  18.9k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (115:13): [True: 4, False: 18.9k]
  ------------------
  116|      4|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  117|      4|		*code = "Unicode text, UTF-8 (with BOM)";
  118|      4|		*code_mime = "utf-8";
  119|  18.9k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (119:13): [True: 86, False: 18.8k]
  ------------------
  120|     86|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  121|     86|		*code = "Unicode text, UTF-8";
  122|     86|		*code_mime = "utf-8";
  123|  18.8k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (123:13): [True: 348, False: 18.4k]
  ------------------
  124|    348|		if (ucs_type == 1) {
  ------------------
  |  Branch (124:7): [True: 145, False: 203]
  ------------------
  125|    145|			*code = "Unicode text, UTF-32, little-endian";
  126|    145|			*code_mime = "utf-32le";
  127|    203|		} else {
  128|    203|			*code = "Unicode text, UTF-32, big-endian";
  129|    203|			*code_mime = "utf-32be";
  130|    203|		}
  131|    348|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  132|  18.4k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (132:13): [True: 337, False: 18.1k]
  ------------------
  133|    337|		if (ucs_type == 1) {
  ------------------
  |  Branch (133:7): [True: 175, False: 162]
  ------------------
  134|    175|			*code = "Unicode text, UTF-16, little-endian";
  135|    175|			*code_mime = "utf-16le";
  136|    175|		} else {
  137|    162|			*code = "Unicode text, UTF-16, big-endian";
  138|    162|			*code_mime = "utf-16be";
  139|    162|		}
  140|    337|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  141|  18.1k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (141:13): [True: 680, False: 17.4k]
  ------------------
  142|    680|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  143|    680|		*code = "ISO-8859";
  144|    680|		*code_mime = "iso-8859-1";
  145|  17.4k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (145:13): [True: 341, False: 17.1k]
  ------------------
  146|    341|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  147|    341|		*code = "Non-ISO extended-ASCII";
  148|    341|		*code_mime = "unknown-8bit";
  149|  17.1k|	} else {
  150|  17.1k|		unsigned char *nbuf;
  151|       |
  152|  17.1k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  153|  17.1k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  444|  17.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (153:7): [True: 0, False: 17.1k]
  ------------------
  154|      0|			file_oomem(ms, mlen);
  155|      0|			goto done;
  156|      0|		}
  157|  17.1k|		from_ebcdic(buf, nbytes, nbuf);
  158|       |
  159|  17.1k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (159:7): [True: 54, False: 17.0k]
  ------------------
  160|     54|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  161|     54|			*code = "EBCDIC";
  162|     54|			*code_mime = "ebcdic";
  163|  17.0k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (163:14): [True: 86, False: 16.9k]
  ------------------
  164|     86|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  165|     86|			    *ulen));
  166|     86|			*code = "International EBCDIC";
  167|     86|			*code_mime = "ebcdic";
  168|  16.9k|		} else { /* Doesn't look like text at all */
  169|  16.9k|			DPRINTF(("binary\n"));
  170|  16.9k|			rv = 0;
  171|  16.9k|			*type = "binary";
  172|  16.9k|		}
  173|  17.1k|		free(nbuf);
  174|  17.1k|	}
  175|       |
  176|  20.1k| done:
  177|  20.1k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (177:6): [True: 10.4k, False: 9.70k]
  ------------------
  178|  10.4k|		free(udefbuf);
  179|       |
  180|  20.1k|	return rv;
  181|  20.1k|}
file_looks_utf8:
  352|  18.9k|{
  353|  18.9k|	size_t i;
  354|  18.9k|	int n;
  355|  18.9k|	file_unichar_t c;
  356|  18.9k|	int gotone = 0, ctrl = 0;
  357|       |
  358|  18.9k|	if (ubuf)
  ------------------
  |  Branch (358:6): [True: 18.9k, False: 0]
  ------------------
  359|  18.9k|		*ulen = 0;
  360|       |
  361|  9.72M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (361:14): [True: 9.72M, False: 1.18k]
  ------------------
  362|  9.72M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (362:7): [True: 9.70M, False: 21.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|  9.70M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  236|  9.70M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (368:8): [True: 8.89M, False: 807k]
  ------------------
  369|  8.89M|				ctrl = 1;
  370|       |
  371|  9.70M|			if (ubuf)
  ------------------
  |  Branch (371:8): [True: 9.70M, False: 0]
  ------------------
  372|  9.70M|				ubuf[(*ulen)++] = buf[i];
  373|  9.70M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (373:14): [True: 5.21k, False: 16.1k]
  ------------------
  374|  5.21k|			return -1;
  375|  16.1k|		} else {			   /* 11xxxxxx begins UTF-8 */
  376|  16.1k|			int following;
  377|  16.1k|			uint8_t x = first[buf[i]];
  378|  16.1k|			const struct accept_range *ar =
  379|  16.1k|			    &accept_ranges[(unsigned int)x >> 4];
  380|  16.1k|			if (x == XX)
  ------------------
  |  |  300|  16.1k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (380:8): [True: 5.24k, False: 10.9k]
  ------------------
  381|  5.24k|				return -1;
  382|       |
  383|  10.9k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (383:8): [True: 3.81k, False: 7.12k]
  ------------------
  384|  3.81k|				c = buf[i] & 0x1f;
  385|  3.81k|				following = 1;
  386|  7.12k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (386:15): [True: 6.22k, False: 893]
  ------------------
  387|  6.22k|				c = buf[i] & 0x0f;
  388|  6.22k|				following = 2;
  389|  6.22k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (389:15): [True: 893, False: 0]
  ------------------
  390|    893|				c = buf[i] & 0x07;
  391|    893|				following = 3;
  392|    893|			} 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|  18.5k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (401:16): [True: 14.9k, False: 3.62k]
  ------------------
  402|  14.9k|				i++;
  403|  14.9k|				if (i >= nbytes)
  ------------------
  |  Branch (403:9): [True: 125, False: 14.8k]
  ------------------
  404|    125|					goto done;
  405|       |
  406|  14.8k|				if (n == 0 &&
  ------------------
  |  Branch (406:9): [True: 10.8k, False: 4.02k]
  ------------------
  407|  14.8k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (407:11): [True: 3.77k, False: 7.05k]
  |  Branch (407:30): [True: 3.09k, False: 3.96k]
  ------------------
  408|  6.86k|					return -1;
  409|       |
  410|  7.98k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (410:9): [True: 253, False: 7.73k]
  |  Branch (410:33): [True: 67, False: 7.66k]
  ------------------
  411|    320|					return -1;
  412|       |
  413|  7.66k|				c = (c << 6) + (buf[i] & 0x3f);
  414|  7.66k|			}
  415|       |
  416|  3.62k|			if (ubuf)
  ------------------
  |  Branch (416:8): [True: 3.62k, False: 0]
  ------------------
  417|  3.62k|				ubuf[(*ulen)++] = c;
  418|  3.62k|			gotone = 1;
  419|  3.62k|		}
  420|  9.72M|	}
  421|  1.31k|done:
  422|  1.31k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (422:9): [True: 1.14k, False: 162]
  |  Branch (422:21): [True: 86, False: 76]
  ------------------
  423|  18.9k|}
encoding.c:looks_ascii:
  265|  37.2k|    size_t *ulen) \
  266|  37.2k|{ \
  267|  37.2k|	size_t i; \
  268|  37.2k|\
  269|  37.2k|	*ulen = 0; \
  270|  37.2k|\
  271|  7.57M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 7.57M, False: 1.29k]
  ------------------
  272|  7.57M|		int t = text_chars[buf[i]]; \
  273|  7.57M|\
  274|  7.57M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 36.0k, False: 7.53M]
  ------------------
  275|  7.57M|			return 0; \
  276|  7.57M|\
  277|  7.57M|		ubuf[(*ulen)++] = buf[i]; \
  278|  7.53M|	} \
  279|  37.2k|	return 1; \
  280|  37.2k|}
encoding.c:looks_latin1:
  265|  35.2k|    size_t *ulen) \
  266|  35.2k|{ \
  267|  35.2k|	size_t i; \
  268|  35.2k|\
  269|  35.2k|	*ulen = 0; \
  270|  35.2k|\
  271|  1.71M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 1.71M, False: 766]
  ------------------
  272|  1.71M|		int t = text_chars[buf[i]]; \
  273|  1.71M|\
  274|  4.45M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 1.02M, False: 695k]
  |  Branch (274:7): [True: 34.4k, False: 987k]
  ------------------
  275|  1.71M|			return 0; \
  276|  1.71M|\
  277|  1.71M|		ubuf[(*ulen)++] = buf[i]; \
  278|  1.68M|	} \
  279|  35.2k|	return 1; \
  280|  35.2k|}
encoding.c:looks_extended:
  265|  17.4k|    size_t *ulen) \
  266|  17.4k|{ \
  267|  17.4k|	size_t i; \
  268|  17.4k|\
  269|  17.4k|	*ulen = 0; \
  270|  17.4k|\
  271|  2.17M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 2.17M, False: 341]
  ------------------
  272|  2.17M|		int t = text_chars[buf[i]]; \
  273|  2.17M|\
  274|  7.59M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 658k, False: 1.51M]
  |  Branch (274:7): [True: 415k, False: 242k]
  |  Branch (274:7): [True: 17.1k, False: 398k]
  ------------------
  275|  2.17M|			return 0; \
  276|  2.17M|\
  277|  2.17M|		ubuf[(*ulen)++] = buf[i]; \
  278|  2.15M|	} \
  279|  17.4k|	return 1; \
  280|  17.4k|}
encoding.c:looks_utf8_with_BOM:
  433|  18.9k|{
  434|  18.9k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (434:6): [True: 18.1k, False: 818]
  |  Branch (434:20): [True: 84, False: 18.0k]
  |  Branch (434:38): [True: 47, False: 37]
  |  Branch (434:56): [True: 26, False: 21]
  ------------------
  435|     26|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  436|  18.9k|	else
  437|  18.9k|		return -1;
  438|  18.9k|}
encoding.c:looks_utf7:
  443|  1.23k|{
  444|  1.23k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (444:6): [True: 777, False: 459]
  |  Branch (444:20): [True: 37, False: 740]
  |  Branch (444:37): [True: 18, False: 19]
  |  Branch (444:54): [True: 13, False: 5]
  ------------------
  445|     13|		switch (buf[3]) {
  446|      3|		case '8':
  ------------------
  |  Branch (446:3): [True: 3, False: 10]
  ------------------
  447|      6|		case '9':
  ------------------
  |  Branch (447:3): [True: 3, False: 10]
  ------------------
  448|      7|		case '+':
  ------------------
  |  Branch (448:3): [True: 1, False: 12]
  ------------------
  449|     10|		case '/':
  ------------------
  |  Branch (449:3): [True: 3, False: 10]
  ------------------
  450|     10|			if (ubuf)
  ------------------
  |  Branch (450:8): [True: 10, False: 0]
  ------------------
  451|     10|				*ulen = 0;
  452|     10|			return 1;
  453|      3|		default:
  ------------------
  |  Branch (453:3): [True: 3, False: 10]
  ------------------
  454|      3|			return -1;
  455|     13|		}
  456|  1.22k|	else
  457|  1.22k|		return -1;
  458|  1.23k|}
encoding.c:looks_ucs16:
  467|  18.4k|{
  468|  18.4k|	int bigend;
  469|  18.4k|	uint32_t hi;
  470|  18.4k|	size_t i;
  471|       |
  472|  18.4k|	if (nbytes < 2)
  ------------------
  |  Branch (472:6): [True: 54, False: 18.4k]
  ------------------
  473|     54|		return 0;
  474|       |
  475|  18.4k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (475:6): [True: 1.93k, False: 16.4k]
  |  Branch (475:23): [True: 287, False: 1.64k]
  ------------------
  476|    287|		bigend = 0;
  477|  18.1k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (477:11): [True: 269, False: 17.8k]
  |  Branch (477:28): [True: 230, False: 39]
  ------------------
  478|    230|		bigend = 1;
  479|  17.9k|	else
  480|  17.9k|		return 0;
  481|       |
  482|    517|	*ulen = 0;
  483|    517|	hi = 0;
  484|       |
  485|  17.6k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (485:14): [True: 17.2k, False: 337]
  ------------------
  486|  17.2k|		uint32_t uc;
  487|       |
  488|  17.2k|		if (bigend)
  ------------------
  |  Branch (488:7): [True: 8.20k, False: 9.08k]
  ------------------
  489|  8.20k|			uc = CAST(uint32_t,
  ------------------
  |  |  444|  8.20k|#define CAST(T, b)	((T)(b))
  ------------------
  490|  17.2k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  491|  9.08k|		else
  492|  9.08k|			uc = CAST(uint32_t,
  ------------------
  |  |  444|  9.08k|#define CAST(T, b)	((T)(b))
  ------------------
  493|  17.2k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  494|       |
  495|  17.2k|		uc &= 0xffff;
  496|       |
  497|  17.2k|		switch (uc) {
  498|      4|		case 0xfffe:
  ------------------
  |  Branch (498:3): [True: 4, False: 17.2k]
  ------------------
  499|     12|		case 0xffff:
  ------------------
  |  Branch (499:3): [True: 8, False: 17.2k]
  ------------------
  500|     12|			return 0;
  501|  17.2k|		default:
  ------------------
  |  Branch (501:3): [True: 17.2k, False: 12]
  ------------------
  502|  17.2k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  460|  17.2k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (460:26): [True: 533, False: 16.7k]
  |  |  |  Branch (460:43): [True: 12, False: 521]
  |  |  ------------------
  ------------------
  503|     12|				return 0;
  504|  17.2k|			break;
  505|  17.2k|		}
  506|  17.2k|		if (hi) {
  ------------------
  |  Branch (506:7): [True: 669, False: 16.5k]
  ------------------
  507|    669|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  462|    669|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 623, False: 46]
  |  |  |  Branch (462:43): [True: 613, False: 10]
  |  |  ------------------
  ------------------
  508|     56|				return 0;
  509|    613|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  510|    613|			hi = 0;
  511|    613|		}
  512|  17.2k|		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  444|    240|#define CAST(T, b)	((T)(b))
  ------------------
              		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  236|    240|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (512:7): [True: 240, False: 16.9k]
  |  Branch (512:19): [True: 76, False: 164]
  ------------------
  513|     76|			return 0;
  514|  17.1k|		ubf[(*ulen)++] = uc;
  515|  17.1k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  461|  17.1k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (461:26): [True: 2.55k, False: 14.5k]
  |  |  |  Branch (461:43): [True: 703, False: 1.85k]
  |  |  ------------------
  ------------------
  516|    703|			hi = uc - 0xd800 + 1;
  517|  17.1k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  462|  17.1k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 1.85k, False: 15.2k]
  |  |  |  Branch (462:43): [True: 24, False: 1.83k]
  |  |  ------------------
  ------------------
  518|     24|			return 0;
  519|  17.1k|	}
  520|       |
  521|    337|	return 1 + bigend;
  522|    517|}
encoding.c:looks_ucs32:
  527|  18.8k|{
  528|  18.8k|	int bigend;
  529|  18.8k|	size_t i;
  530|       |
  531|  18.8k|	if (nbytes < 4)
  ------------------
  |  Branch (531:6): [True: 782, False: 18.0k]
  ------------------
  532|    782|		return 0;
  533|       |
  534|  18.0k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (534:6): [True: 2.03k, False: 16.0k]
  |  Branch (534:23): [True: 427, False: 1.60k]
  |  Branch (534:40): [True: 255, False: 172]
  |  Branch (534:54): [True: 185, False: 70]
  ------------------
  535|    185|		bigend = 0;
  536|  17.8k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (536:11): [True: 941, False: 16.9k]
  |  Branch (536:25): [True: 585, False: 356]
  |  Branch (536:39): [True: 236, False: 349]
  |  Branch (536:56): [True: 206, False: 30]
  ------------------
  537|    206|		bigend = 1;
  538|  17.6k|	else
  539|  17.6k|		return 0;
  540|       |
  541|    391|	*ulen = 0;
  542|       |
  543|   160k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (543:14): [True: 159k, False: 348]
  ------------------
  544|       |		/* XXX fix to properly handle chars > 65536 */
  545|       |
  546|   159k|		if (bigend)
  ------------------
  |  Branch (546:7): [True: 141k, False: 18.7k]
  ------------------
  547|   141k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  444|   141k|#define CAST(T, b)	((T)(b))
  ------------------
  548|   141k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  444|   141k|#define CAST(T, b)	((T)(b))
  ------------------
  549|   141k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  444|   141k|#define CAST(T, b)	((T)(b))
  ------------------
  550|   141k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  444|   141k|#define CAST(T, b)	((T)(b))
  ------------------
  551|  18.7k|		else
  552|  18.7k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  444|  18.7k|#define CAST(T, b)	((T)(b))
  ------------------
  553|  18.7k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  444|  18.7k|#define CAST(T, b)	((T)(b))
  ------------------
  554|  18.7k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  444|  18.7k|#define CAST(T, b)	((T)(b))
  ------------------
  555|  18.7k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  444|  18.7k|#define CAST(T, b)	((T)(b))
  ------------------
  556|       |
  557|   159k|		if (ubf[*ulen - 1] == 0xfffe)
  ------------------
  |  Branch (557:7): [True: 3, False: 159k]
  ------------------
  558|      3|			return 0;
  559|   159k|		if (ubf[*ulen - 1] < 128 &&
  ------------------
  |  Branch (559:7): [True: 354, False: 159k]
  ------------------
  560|   159k|		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  444|    354|#define CAST(T, b)	((T)(b))
  ------------------
              		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  236|    354|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (560:7): [True: 40, False: 314]
  ------------------
  561|     40|			return 0;
  562|   159k|	}
  563|       |
  564|    348|	return 1 + bigend;
  565|    391|}
encoding.c:from_ebcdic:
  652|  17.1k|{
  653|  17.1k|	size_t i;
  654|       |
  655|  48.1M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (655:14): [True: 48.1M, False: 17.1k]
  ------------------
  656|  48.1M|		out[i] = ebcdic_to_ascii[buf[i]];
  657|  48.1M|	}
  658|  17.1k|}

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

file_copystr:
   56|    562|{
   57|    562|	if (blen == 0)
  ------------------
  |  Branch (57:6): [True: 0, False: 562]
  ------------------
   58|      0|		return buf;
   59|    562|	if (width >= blen)
  ------------------
  |  Branch (59:6): [True: 6, False: 556]
  ------------------
   60|      6|		width = blen - 1;
   61|    562|	memcpy(buf, str, width);
   62|    562|	buf[width] = '\0';
   63|    562|	return buf;
   64|    562|}
file_checkfmt:
   95|   327k|{
   96|   327k|	const char *p;
   97|  3.99M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (97:16): [True: 3.66M, False: 327k]
  ------------------
   98|  3.66M|		if (*p != '%')
  ------------------
  |  Branch (98:7): [True: 3.44M, False: 225k]
  ------------------
   99|  3.44M|			continue;
  100|   225k|		if (*++p == '%')
  ------------------
  |  Branch (100:7): [True: 0, False: 225k]
  ------------------
  101|      0|			continue;
  102|       |		// Skip uninteresting.
  103|   349k|		while (strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (103:10): [True: 124k, False: 225k]
  ------------------
  104|   124k|			p++;
  105|   225k|		if (*p == '*') {
  ------------------
  |  Branch (105:7): [True: 0, False: 225k]
  ------------------
  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|   225k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (111:7): [True: 0, False: 225k]
  ------------------
  112|      0|			return -1;
  113|       |
  114|   225k|		if (*p == '.') {
  ------------------
  |  Branch (114:7): [True: 1.07k, False: 224k]
  ------------------
  115|  1.07k|			p++;
  116|  1.07k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (116:8): [True: 0, False: 1.07k]
  ------------------
  117|      0|				return -1;
  118|  1.07k|		}
  119|       |
  120|   225k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (120:7): [True: 0, False: 225k]
  ------------------
  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|   225k|	}
  126|   327k|	return 0;
  127|   327k|}
file_vprintf:
  134|   331k|{
  135|   331k|	int len;
  136|   331k|	char *buf, *newstr;
  137|   331k|	char tbuf[1024];
  138|       |
  139|   331k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|   331k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (139:6): [True: 3.92k, False: 327k]
  ------------------
  140|  3.92k|		return 0;
  141|       |
  142|   327k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (142:6): [True: 0, False: 327k]
  ------------------
  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|   327k|	len = vasprintf(&buf, fmt, ap);
  149|   327k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (149:6): [True: 0, False: 327k]
  |  Branch (149:17): [True: 149, False: 327k]
  |  Branch (149:39): [True: 0, False: 327k]
  ------------------
  150|    149|		size_t blen = ms->o.blen;
  151|    149|		free(buf);
  152|    149|		file_clearbuf(ms);
  153|    149|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  154|    149|		    SIZE_T_FORMAT "u", len, blen);
  155|    149|		return -1;
  156|    149|	}
  157|       |
  158|   327k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (158:6): [True: 302k, False: 24.7k]
  ------------------
  159|   302k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  160|   302k|		free(buf);
  161|   302k|		if (len < 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 302k]
  ------------------
  162|      0|			goto out;
  163|   302k|		free(ms->o.buf);
  164|   302k|		buf = newstr;
  165|   302k|	}
  166|   327k|	ms->o.buf = buf;
  167|   327k|	ms->o.blen = len;
  168|   327k|	return 0;
  169|      0|out:
  170|      0|	file_clearbuf(ms);
  171|      0|	file_error(ms, errno, "vasprintf failed");
  172|      0|	return -1;
  173|   327k|}
file_printf:
  177|   330k|{
  178|   330k|	int rv;
  179|   330k|	va_list ap;
  180|       |
  181|   330k|	va_start(ap, fmt);
  182|   330k|	rv = file_vprintf(ms, fmt, ap);
  183|   330k|	va_end(ap);
  184|   330k|	return rv;
  185|   330k|}
file_error:
  215|    718|{
  216|    718|	va_list va;
  217|    718|	va_start(va, f);
  218|    718|	file_error_core(ms, error, f, va, 0);
  219|    718|	va_end(va);
  220|    718|}
file_badseek:
  244|      1|{
  245|      1|	file_error(ms, errno, "error seeking");
  246|      1|}
file_badread:
  250|     90|{
  251|     90|	file_error(ms, errno, "error reading");
  252|     90|}
file_separator:
  259|  36.5k|{
  260|  36.5k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  255|  36.5k|#define FILE_SEPARATOR "\n- "
  ------------------
  261|  36.5k|}
file_default:
  294|  8.17k|{
  295|  8.17k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  8.17k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  8.17k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  8.17k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (295:6): [True: 0, False: 8.17k]
  ------------------
  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.17k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  8.17k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (302:6): [True: 0, False: 8.17k]
  ------------------
  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.17k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  8.17k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (307:6): [True: 0, False: 8.17k]
  ------------------
  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.17k|	return 0;
  313|  8.17k|}
file_buffer:
  326|  10.4k|{
  327|  10.4k|	int m = 0, rv = 0, looks_text = 0;
  328|  10.4k|	const char *code = NULL;
  329|  10.4k|	const char *code_mime = "binary";
  330|  10.4k|	const char *def = "data";
  331|  10.4k|	const char *ftype = NULL;
  332|  10.4k|	char *rbuf = NULL;
  333|  10.4k|	struct buffer b;
  334|       |
  335|  10.4k|	buffer_init(&b, fd, st, buf, nb);
  336|  10.4k|	ms->mode = b.st.st_mode;
  337|       |
  338|  10.4k|	if (nb == 0) {
  ------------------
  |  Branch (338:6): [True: 13, False: 10.4k]
  ------------------
  339|     13|		def = "empty";
  340|     13|		goto simple;
  341|  10.4k|	} else if (nb == 1) {
  ------------------
  |  Branch (341:13): [True: 8, False: 10.4k]
  ------------------
  342|      8|		def = "very short file (no magic)";
  343|      8|		goto simple;
  344|      8|	}
  345|       |
  346|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
  ------------------
  |  |   63|  10.4k|#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
  ------------------
  |  Branch (346:6): [True: 10.4k, False: 0]
  ------------------
  347|  10.4k|		looks_text = file_encoding(ms, &b, NULL, 0,
  348|  10.4k|		    &code, &code_mime, &ftype);
  349|  10.4k|	}
  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|  10.4k|#if HAVE_FORK
  367|       |	/* try compression stuff */
  368|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
  ------------------
  |  |   54|  10.4k|#define	MAGIC_NO_CHECK_COMPRESS	0x0001000 /* Don't check for compressed files */
  ------------------
  |  Branch (368:6): [True: 10.4k, False: 0]
  ------------------
  369|  10.4k|		m = file_zmagic(ms, &b, inname);
  370|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (370:7): [True: 0, False: 10.4k]
  ------------------
  371|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  372|  10.4k|		if (m) {
  ------------------
  |  Branch (372:7): [True: 697, False: 9.75k]
  ------------------
  373|    697|			goto done_encoding;
  374|    697|		}
  375|  10.4k|	}
  376|  9.75k|#endif
  377|       |	/* Check if we have a tar file */
  378|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  9.75k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (378:6): [True: 9.75k, False: 0]
  ------------------
  379|  9.75k|		m = file_is_tar(ms, &b);
  380|  9.75k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.75k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (380:7): [True: 0, False: 9.75k]
  ------------------
  381|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  382|  9.75k|		if (m) {
  ------------------
  |  Branch (382:7): [True: 7, False: 9.75k]
  ------------------
  383|      7|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (383:8): [True: 0, False: 7]
  ------------------
  384|      0|				goto done;
  385|      7|		}
  386|  9.75k|	}
  387|       |
  388|       |	/* Check if we have a JSON file */
  389|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  9.75k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (389:6): [True: 9.75k, False: 0]
  ------------------
  390|  9.75k|		m = file_is_json(ms, &b);
  391|  9.75k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.75k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (391:7): [True: 0, False: 9.75k]
  ------------------
  392|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  393|  9.75k|		if (m) {
  ------------------
  |  Branch (393:7): [True: 15, False: 9.74k]
  ------------------
  394|     15|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (394:8): [True: 0, False: 15]
  ------------------
  395|      0|				goto done;
  396|     15|		}
  397|  9.75k|	}
  398|       |
  399|       |	/* Check if we have a CSV file */
  400|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  9.75k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (400:6): [True: 9.75k, False: 0]
  ------------------
  401|  9.75k|		m = file_is_csv(ms, &b, looks_text, code);
  402|  9.75k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.75k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (402:7): [True: 0, False: 9.75k]
  ------------------
  403|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  404|  9.75k|		if (m) {
  ------------------
  |  Branch (404:7): [True: 7, False: 9.75k]
  ------------------
  405|      7|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (405:8): [True: 0, False: 7]
  ------------------
  406|      0|				goto done;
  407|      7|		}
  408|  9.75k|	}
  409|       |
  410|       |	/* Check if we have a SIMH tape file */
  411|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_SIMH) == 0) {
  ------------------
  |  |   65|  9.75k|#define MAGIC_NO_CHECK_SIMH	0x0800000 /* Don't check for SIMH tape files */
  ------------------
  |  Branch (411:6): [True: 9.75k, False: 0]
  ------------------
  412|  9.75k|		m = file_is_simh(ms, &b);
  413|  9.75k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.75k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (413:7): [True: 0, False: 9.75k]
  ------------------
  414|      0|			(void)fprintf(stderr, "[try simh %d]\n", m);
  415|  9.75k|		if (m) {
  ------------------
  |  Branch (415:7): [True: 30, False: 9.72k]
  ------------------
  416|     30|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 30]
  ------------------
  417|      0|				goto done;
  418|     30|		}
  419|  9.75k|	}
  420|       |
  421|       |	/* Check if we have a CDF file */
  422|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  9.75k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (422:6): [True: 9.75k, False: 0]
  ------------------
  423|  9.75k|		m = file_trycdf(ms, &b);
  424|  9.75k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.75k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (424:7): [True: 0, False: 9.75k]
  ------------------
  425|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  426|  9.75k|		if (m) {
  ------------------
  |  Branch (426:7): [True: 996, False: 8.76k]
  ------------------
  427|    996|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (427:8): [True: 0, False: 996]
  ------------------
  428|      0|				goto done;
  429|    996|		}
  430|  9.75k|	}
  431|  9.75k|#ifdef BUILTIN_ELF
  432|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  9.75k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (432:6): [True: 9.75k, False: 0]
  |  Branch (432:47): [True: 8.72k, False: 1.03k]
  |  Branch (432:57): [True: 7.39k, False: 1.33k]
  ------------------
  433|  7.39k|		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|  7.39k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (444:7): [True: 0, False: 7.39k]
  ------------------
  445|      0|			return -1;
  446|       |
  447|  7.39k|		rv = file_tryelf(ms, &b);
  448|  7.39k|		rbuf = file_pop_buffer(ms, pb);
  449|  7.39k|		if (rv == -1) {
  ------------------
  |  Branch (449:7): [True: 95, False: 7.29k]
  ------------------
  450|     95|			free(rbuf);
  451|     95|			rbuf = NULL;
  452|     95|		}
  453|  7.39k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  7.39k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (453:7): [True: 0, False: 7.39k]
  ------------------
  454|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  455|  7.39k|	}
  456|  9.75k|#endif
  457|       |
  458|       |	/* try soft magic tests */
  459|  9.75k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  9.75k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (459:6): [True: 9.75k, False: 0]
  ------------------
  460|  9.75k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  228|  9.75k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  461|  9.75k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.75k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (461:7): [True: 0, False: 9.75k]
  ------------------
  462|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  463|  9.75k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (463:7): [True: 7.37k, False: 2.38k]
  |  Branch (463:17): [True: 3.24k, False: 4.12k]
  ------------------
  464|  3.24k|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (464:8): [True: 53, False: 3.19k]
  ------------------
  465|     53|				goto done;
  466|  3.24k|		}
  467|  9.70k|		if (m) {
  ------------------
  |  Branch (467:7): [True: 7.40k, False: 2.30k]
  ------------------
  468|  7.40k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (468:8): [True: 0, False: 7.40k]
  ------------------
  469|      0|				goto done;
  470|  7.40k|		}
  471|  9.70k|	}
  472|       |
  473|       |	/* try text properties */
  474|  9.70k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  9.70k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (474:6): [True: 9.70k, False: 0]
  ------------------
  475|       |
  476|  9.70k|		m = file_ascmagic(ms, &b, looks_text);
  477|  9.70k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  9.70k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (477:7): [True: 0, False: 9.70k]
  ------------------
  478|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  479|  9.70k|		if (m) {
  ------------------
  |  Branch (479:7): [True: 1.55k, False: 8.15k]
  ------------------
  480|  1.55k|			goto done;
  481|  1.55k|		}
  482|  9.70k|	}
  483|       |
  484|  8.17k|simple:
  485|       |	/* give up */
  486|  8.17k|	if (m == 0) {
  ------------------
  |  Branch (486:6): [True: 8.17k, False: 0]
  ------------------
  487|  8.17k|		m = 1;
  488|  8.17k|		rv = file_default(ms, nb);
  489|  8.17k|		if (rv == 0)
  ------------------
  |  Branch (489:7): [True: 8.17k, False: 0]
  ------------------
  490|  8.17k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (490:8): [True: 0, False: 8.17k]
  ------------------
  491|      0|				rv = -1;
  492|  8.17k|	}
  493|  9.78k| done:
  494|  9.78k|	trim_separator(ms);
  495|  9.78k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  9.78k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (495:6): [True: 0, False: 9.78k]
  ------------------
  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|  9.78k|#if HAVE_FORK
  503|  10.4k| done_encoding:
  504|  10.4k|#endif
  505|  10.4k|	free(rbuf);
  506|  10.4k|	buffer_fini(&b);
  507|  10.4k|	if (rv)
  ------------------
  |  Branch (507:6): [True: 53, False: 10.4k]
  ------------------
  508|     53|		return rv;
  509|       |
  510|  10.4k|	return m;
  511|  10.4k|}
file_reset:
  516|  8.80k|{
  517|  8.80k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (517:6): [True: 8.80k, False: 2]
  |  Branch (517:21): [True: 0, False: 8.80k]
  ------------------
  518|      0|		file_error(ms, 0, "no magic files loaded");
  519|      0|		return -1;
  520|      0|	}
  521|  8.80k|	file_clearbuf(ms);
  522|  8.80k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (522:6): [True: 8.45k, False: 352]
  ------------------
  523|  8.45k|		free(ms->o.pbuf);
  524|  8.45k|		ms->o.pbuf = NULL;
  525|  8.45k|	}
  526|  8.80k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  479|  8.80k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  527|  8.80k|	ms->error = -1;
  528|  8.80k|	return 0;
  529|  8.80k|}
file_getbuffer:
  541|  8.79k|{
  542|  8.79k|	char *pbuf, *op, *np;
  543|  8.79k|	size_t psize, len;
  544|       |
  545|  8.79k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  8.79k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (545:6): [True: 345, False: 8.45k]
  ------------------
  546|    345|		return NULL;
  547|       |
  548|  8.45k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  8.45k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (548:6): [True: 0, False: 8.45k]
  ------------------
  549|      0|		return ms->o.buf;
  550|       |
  551|  8.45k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (551:6): [True: 0, False: 8.45k]
  ------------------
  552|      0|		return NULL;
  553|       |
  554|       |	/* * 4 is for octal representation, + 1 is for NUL */
  555|  8.45k|	len = strlen(ms->o.buf);
  556|  8.45k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (556:6): [True: 0, False: 8.45k]
  ------------------
  557|      0|		file_oomem(ms, len);
  558|      0|		return NULL;
  559|      0|	}
  560|  8.45k|	psize = len * 4 + 1;
  561|  8.45k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  444|  8.45k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (561:6): [True: 0, False: 8.45k]
  ------------------
  562|      0|		file_oomem(ms, psize);
  563|      0|		return NULL;
  564|      0|	}
  565|  8.45k|	ms->o.pbuf = pbuf;
  566|       |
  567|  8.45k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  568|  8.45k|	{
  569|  8.45k|		mbstate_t state;
  570|  8.45k|		wchar_t nextchar;
  571|  8.45k|		int mb_conv = 1;
  572|  8.45k|		size_t bytesconsumed;
  573|  8.45k|		char *eop;
  574|  8.45k|		(void)memset(&state, 0, sizeof(mbstate_t));
  575|       |
  576|  8.45k|		np = ms->o.pbuf;
  577|  8.45k|		op = ms->o.buf;
  578|  8.45k|		eop = op + len;
  579|       |
  580|  1.60M|		while (op < eop) {
  ------------------
  |  Branch (580:10): [True: 1.59M, False: 8.39k]
  ------------------
  581|  1.59M|			bytesconsumed = mbrtowc(&nextchar, op,
  582|  1.59M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  444|  1.59M|#define CAST(T, b)	((T)(b))
  ------------------
  583|  1.59M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  444|  3.19M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (583:8): [True: 53, False: 1.59M]
  ------------------
  584|  1.59M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  444|  1.59M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (584:8): [True: 0, False: 1.59M]
  ------------------
  585|     53|				mb_conv = 0;
  586|     53|				break;
  587|     53|			}
  588|       |
  589|  1.59M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (589:8): [True: 1.57M, False: 27.9k]
  ------------------
  590|  1.57M|				(void)memcpy(np, op, bytesconsumed);
  591|  1.57M|				op += bytesconsumed;
  592|  1.57M|				np += bytesconsumed;
  593|  1.57M|			} else {
  594|  55.9k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (594:12): [True: 27.9k, False: 27.9k]
  ------------------
  595|  27.9k|					OCTALIFY(np, op);
  ------------------
  |  |  533|  27.9k|	(void)(*(n)++ = '\\', \
  |  |  534|  27.9k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  444|  27.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  535|  27.9k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|  27.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  536|  27.9k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|  27.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  537|  27.9k|	(o)++)
  ------------------
  596|  27.9k|			}
  597|  1.59M|		}
  598|  8.45k|		*np = '\0';
  599|       |
  600|       |		/* Parsing succeeded as a multi-byte sequence */
  601|  8.45k|		if (mb_conv != 0)
  ------------------
  |  Branch (601:7): [True: 8.39k, False: 53]
  ------------------
  602|  8.39k|			return ms->o.pbuf;
  603|  8.45k|	}
  604|     53|#endif
  605|       |
  606|  15.2k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (606:40): [True: 15.2k, False: 53]
  ------------------
  607|  15.2k|		if (isprint(CAST(unsigned char, *op))) {
  608|  14.3k|			*np++ = *op++;
  609|  14.3k|		} else {
  610|    833|			OCTALIFY(np, op);
  ------------------
  |  |  533|    833|	(void)(*(n)++ = '\\', \
  |  |  534|    833|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  444|    833|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  535|    833|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|    833|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  536|    833|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|    833|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  537|    833|	(o)++)
  ------------------
  611|    833|		}
  612|  15.2k|	}
  613|     53|	*np = '\0';
  614|     53|	return ms->o.pbuf;
  615|  8.45k|}
file_check_mem:
  619|   589k|{
  620|   589k|	size_t len;
  621|       |
  622|   589k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (622:6): [True: 1, False: 589k]
  ------------------
  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|   589k|	ms->c.li[level].got_match = 0;
  633|   589k|#ifdef ENABLE_CONDITIONALS
  634|   589k|	ms->c.li[level].last_match = 0;
  635|   589k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  353|   589k|#define				COND_NONE	0
  ------------------
  636|   589k|#endif /* ENABLE_CONDITIONALS */
  637|   589k|	return 0;
  638|   589k|}
file_printedlen:
  642|  1.55k|{
  643|  1.55k|	return ms->o.blen;
  644|  1.55k|}
file_replace:
  648|    835|{
  649|    835|	file_regex_t rx;
  650|    835|	int rc, rv = -1;
  651|       |
  652|    835|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  653|    835|	if (rc == 0) {
  ------------------
  |  Branch (653:6): [True: 835, False: 0]
  ------------------
  654|    835|		regmatch_t rm;
  655|    835|		int nm = 0;
  656|    904|		while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (656:10): [True: 69, False: 835]
  ------------------
  657|     69|			ms->o.buf[rm.rm_so] = '\0';
  658|     69|			if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (658:8): [True: 0, False: 69]
  ------------------
  659|     69|			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (659:8): [True: 69, False: 0]
  ------------------
  660|      0|				goto out;
  661|     69|			nm++;
  662|     69|		}
  663|    835|		rv = nm;
  664|    835|	}
  665|    835|out:
  666|    835|	file_regfree(&rx);
  667|    835|	return rv;
  668|    835|}
file_regcomp:
  721|  22.7k|{
  722|  22.7k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (722:6): [True: 0, False: 22.7k]
  ------------------
  723|      0|		return -1;
  724|       |
  725|  22.7k|#ifdef USE_C_LOCALE
  726|  22.7k|	locale_t old = uselocale(ms->c_lc_ctype);
  727|  22.7k|	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|  22.7k|	int rc;
  734|  22.7k|	rc = regcomp(rx, pat, flags);
  735|       |
  736|  22.7k|#ifdef USE_C_LOCALE
  737|  22.7k|	uselocale(old);
  738|       |#else
  739|       |	(void)setlocale(LC_CTYPE, old);
  740|       |#endif
  741|  22.7k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (741:6): [True: 0, False: 22.7k]
  |  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|  22.7k|	return rc;
  750|  22.7k|}
file_regexec:
  756|   182k|{
  757|   182k|#ifdef USE_C_LOCALE
  758|   182k|	locale_t old = uselocale(ms->c_lc_ctype);
  759|   182k|	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|   182k|	int rc;
  766|       |	/* XXX: force initialization because glibc does not always do this */
  767|   182k|	if (nmatch != 0)
  ------------------
  |  Branch (767:6): [True: 161k, False: 21.7k]
  ------------------
  768|   161k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  769|   182k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  770|   182k|#ifdef USE_C_LOCALE
  771|   182k|	uselocale(old);
  772|       |#else
  773|       |	(void)setlocale(LC_CTYPE, old);
  774|       |#endif
  775|   182k|	return rc;
  776|   182k|}
file_regfree:
  780|  22.6k|{
  781|  22.6k|	regfree(rx);
  782|  22.6k|}
file_push_buffer:
  786|  22.3k|{
  787|  22.3k|	file_pushbuf_t *pb;
  788|       |
  789|  22.3k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  22.3k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (789:6): [True: 303, False: 22.0k]
  ------------------
  790|    303|		return NULL;
  791|       |
  792|  22.0k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  444|  22.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (792:6): [True: 0, False: 22.0k]
  ------------------
  793|      0|		return NULL;
  794|       |
  795|  22.0k|	pb->buf = ms->o.buf;
  796|  22.0k|	pb->blen = ms->o.blen;
  797|  22.0k|	pb->offset = ms->offset;
  798|       |
  799|  22.0k|	ms->o.buf = NULL;
  800|  22.0k|	ms->o.blen = 0;
  801|  22.0k|	ms->offset = 0;
  802|       |
  803|  22.0k|	return pb;
  804|  22.0k|}
file_pop_buffer:
  808|  22.0k|{
  809|  22.0k|	char *rbuf;
  810|       |
  811|  22.0k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  479|  22.0k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (811:6): [True: 1.15k, False: 20.9k]
  ------------------
  812|  1.15k|		free(pb->buf);
  813|  1.15k|		free(pb);
  814|  1.15k|		return NULL;
  815|  1.15k|	}
  816|       |
  817|  20.9k|	rbuf = ms->o.buf;
  818|       |
  819|  20.9k|	ms->o.buf = pb->buf;
  820|  20.9k|	ms->o.blen = pb->blen;
  821|  20.9k|	ms->offset = pb->offset;
  822|       |
  823|  20.9k|	free(pb);
  824|  20.9k|	return rbuf;
  825|  22.0k|}
file_printable:
  833|  41.6k|{
  834|  41.6k|	char *ptr, *eptr = buf + bufsiz - 1;
  835|  41.6k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  445|  41.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  836|  41.6k|	const unsigned char *es = s + slen;
  837|       |
  838|   270k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (838:19): [True: 270k, False: 72]
  |  Branch (838:33): [True: 269k, False: 145]
  |  Branch (838:43): [True: 228k, False: 41.4k]
  ------------------
  839|   228k|		if ((ms->flags & MAGIC_RAW) != 0 || isprint(*s)) {
  ------------------
  |  |   41|   228k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (839:7): [True: 0, False: 228k]
  ------------------
  840|   125k|			*ptr++ = *s;
  841|   125k|			continue;
  842|   125k|		}
  843|   103k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (843:7): [True: 73, False: 103k]
  ------------------
  844|     73|			break;
  845|   103k|		*ptr++ = '\\';
  846|   103k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  444|   103k|#define CAST(T, b)	((T)(b))
  ------------------
  847|   103k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  444|   103k|#define CAST(T, b)	((T)(b))
  ------------------
  848|   103k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  444|   103k|#define CAST(T, b)	((T)(b))
  ------------------
  849|   103k|	}
  850|  41.6k|	*ptr = '\0';
  851|  41.6k|	return buf;
  852|  41.6k|}
file_print_guid:
  888|    410|{
  889|    410|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  444|    410|#define CAST(T, b)	((T)(b))
  ------------------
  890|    410|	    CAST(const void *, guid));
  891|       |
  892|    410|#ifndef WIN32
  893|    410|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  894|    410|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  895|    410|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  896|    410|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  897|    410|	    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|    410|}
file_pipe_closexec:
  909|  1.76k|{
  910|       |#ifdef __MINGW32__
  911|       |	return 0;
  912|       |#elif defined(HAVE_PIPE2)
  913|  1.76k|	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|  1.76k|}
file_clear_closexec:
  926|  2.64k|file_clear_closexec(int fd) {
  927|  2.64k|#ifdef F_SETFD
  928|  2.64k|	return fcntl(fd, F_SETFD, 0);
  929|       |#else
  930|       |	return 0;
  931|       |#endif
  932|  2.64k|}
file_strtrim:
  936|    428|{
  937|    428|	char *last;
  938|       |
  939|    428|	while (isspace(CAST(unsigned char, *str)))
  940|    281|		str++;
  941|    428|	last = str;
  942|  7.12k|	while (*last)
  ------------------
  |  Branch (942:9): [True: 6.69k, False: 428]
  ------------------
  943|  6.69k|		last++;
  944|    428|	--last;
  945|    428|	while (isspace(CAST(unsigned char, *last)))
  946|    324|		last--;
  947|    428|	*++last = '\0';
  948|    428|	return str;
  949|    428|}
funcs.c:file_checkfield:
   76|   226k|{
   77|   226k|	const char *p = *pp;
   78|   226k|	int fw = 0;
   79|       |
   80|   234k|	while (*p && isdigit((unsigned char)*p))
  ------------------
  |  Branch (80:9): [True: 234k, False: 0]
  ------------------
   81|  7.89k|		fw = fw * 10 + (*p++ - '0');
   82|       |
   83|   226k|	*pp = p;
   84|       |
   85|   226k|	if (fw < 1024)
  ------------------
  |  Branch (85:6): [True: 226k, False: 0]
  ------------------
   86|   226k|		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|   226k|}
funcs.c:file_clearbuf:
   68|  8.95k|{
   69|  8.95k|	free(ms->o.buf);
   70|  8.95k|	ms->o.buf = NULL;
   71|  8.95k|	ms->o.blen = 0;
   72|  8.95k|}
funcs.c:file_error_core:
  195|    718|{
  196|       |	/* Only the first error is ok */
  197|    718|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|    718|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (197:6): [True: 369, False: 349]
  ------------------
  198|    369|		return;
  199|    349|	if (lineno != 0) {
  ------------------
  |  Branch (199:6): [True: 0, False: 349]
  ------------------
  200|      0|		file_clearbuf(ms);
  201|      0|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  202|      0|	}
  203|    349|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (203:6): [True: 158, False: 191]
  |  Branch (203:19): [True: 158, False: 0]
  ------------------
  204|    158|		(void)file_printf(ms, " ");
  205|    349|	(void)file_vprintf(ms, f, va);
  206|    349|	if (error > 0)
  ------------------
  |  Branch (206:6): [True: 94, False: 255]
  ------------------
  207|     94|		(void)file_printf(ms, " (%s)", strerror(error));
  208|    349|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  479|    349|#define 		EVENT_HAD_ERR		0x01
  ------------------
  209|    349|	ms->error = error;
  210|    349|}
funcs.c:checkdone:
  284|  8.45k|{
  285|  8.45k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  8.45k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (285:6): [True: 0, False: 8.45k]
  ------------------
  286|      0|		return 1;
  287|  8.45k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (287:6): [True: 0, False: 8.45k]
  ------------------
  288|      0|		*rv = -1;
  289|  8.45k|	return 0;
  290|  8.45k|}
funcs.c:trim_separator:
  265|  9.78k|{
  266|  9.78k|	size_t l;
  267|       |
  268|  9.78k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (268:6): [True: 0, False: 9.78k]
  ------------------
  269|      0|		return;
  270|       |
  271|  9.78k|	l = strlen(ms->o.buf);
  272|  9.78k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  255|  9.78k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (272:6): [True: 0, False: 9.78k]
  ------------------
  273|      0|		return;
  274|       |
  275|  9.78k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  255|  9.78k|#define FILE_SEPARATOR "\n- "
  ------------------
  276|  9.78k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  255|  9.78k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (276:6): [True: 9.78k, False: 0]
  ------------------
  277|  9.78k|		return;
  278|       |
  279|      0|	ms->o.buf[l] = '\0';
  280|      0|}
funcs.c:check_regex:
  672|  22.7k|{
  673|  22.7k|	char sbuf[512];
  674|  22.7k|	unsigned char oc = '\0';
  675|  22.7k|	const char *p;
  676|  22.7k|	unsigned long l;
  677|       |
  678|   275k|	for (p = pat; *p; p++) {
  ------------------
  |  Branch (678:16): [True: 252k, False: 22.7k]
  ------------------
  679|   252k|		unsigned char c = *p;
  680|       |		// Avoid repetition
  681|   252k|		if (c == oc && strchr("?*+{", c) != NULL) {
  ------------------
  |  Branch (681:7): [True: 133, False: 252k]
  |  Branch (681:18): [True: 0, False: 133]
  ------------------
  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|   252k|		if (c == '{') {
  ------------------
  |  Branch (689:7): [True: 63, False: 252k]
  ------------------
  690|     63|			char *ep, *eep;
  691|     63|			errno = 0;
  692|     63|			l = strtoul(p + 1, &ep, 10);
  693|     63|			if (ep != p + 1 && l > 1000)
  ------------------
  |  Branch (693:8): [True: 41, False: 22]
  |  Branch (693:23): [True: 0, False: 41]
  ------------------
  694|      0|				goto bounds;
  695|       |
  696|     63|			if (*ep == ',') {
  ------------------
  |  Branch (696:8): [True: 26, False: 37]
  ------------------
  697|     26|				l = strtoul(ep + 1, &eep, 10);
  698|     26|				if (eep != ep + 1 && l > 1000)
  ------------------
  |  Branch (698:9): [True: 26, False: 0]
  |  Branch (698:26): [True: 0, False: 26]
  ------------------
  699|      0|					goto bounds;
  700|     26|			}
  701|     63|		}
  702|   252k|		oc = c;
  703|   252k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (703:35): [True: 4, False: 1]
  ------------------
  704|   252k|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (704:10): [True: 1, False: 0]
  ------------------
  705|   252k|			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|   252k|	}
  712|  22.7k|	return 0;
  713|      0|bounds:
  714|      0|	file_magwarn(ms, "bounds too large %ld in regex `%s'", l, pat);
  715|      0|	return -1;
  716|  22.7k|}

file_is_csv:
  135|  9.75k|{
  136|  9.75k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  9.75k|#define CAST(T, b)	((T)(b))
  ------------------
  137|  9.75k|	const unsigned char *ue = uc + b->flen;
  138|  9.75k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  9.75k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  9.75k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  9.75k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  139|       |
  140|  9.75k|	if (!looks_text)
  ------------------
  |  Branch (140:6): [True: 8.25k, False: 1.50k]
  ------------------
  141|  8.25k|		return 0;
  142|       |
  143|  1.50k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  1.50k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  1.50k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (143:6): [True: 0, False: 1.50k]
  ------------------
  144|      0|		return 0;
  145|       |
  146|  1.50k|	if (!csv_parse(uc, ue))
  ------------------
  |  Branch (146:6): [True: 1.50k, False: 7]
  ------------------
  147|  1.50k|		return 0;
  148|       |
  149|      7|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|      7|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (149:6): [True: 0, False: 7]
  ------------------
  150|      0|		return 1;
  151|       |
  152|      7|	if (mime) {
  ------------------
  |  Branch (152:6): [True: 0, False: 7]
  ------------------
  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|      7|	if (file_printf(ms, "CSV %s%stext", code ? code : "",
  ------------------
  |  Branch (158:6): [True: 0, False: 7]
  |  Branch (158:38): [True: 7, False: 0]
  ------------------
  159|      7|	    code ? " " : "") == -1)
  ------------------
  |  Branch (159:6): [True: 7, False: 0]
  ------------------
  160|      0|		return -1;
  161|       |
  162|      7|	return 1;
  163|      7|}
is_csv.c:csv_parse:
   93|  1.50k|{
   94|  1.50k|	size_t nf = 0, tf = 0, nl = 0;
   95|       |
   96|  53.9M|	while (uc < ue) {
  ------------------
  |  Branch (96:9): [True: 53.9M, False: 1.34k]
  ------------------
   97|  53.9M|		switch (*uc++) {
   98|  6.30k|		case '"':
  ------------------
  |  Branch (98:3): [True: 6.30k, False: 53.9M]
  ------------------
   99|       |			// Eat until the matching quote
  100|  6.30k|			uc = eatquote(uc, ue);
  101|  6.30k|			break;
  102|  2.93M|		case ',':
  ------------------
  |  Branch (102:3): [True: 2.93M, False: 51.0M]
  ------------------
  103|  2.93M|			nf++;
  104|  2.93M|			break;
  105|    238|		case '\n':
  ------------------
  |  Branch (105:3): [True: 238, False: 53.9M]
  ------------------
  106|    238|			DPRINTF("%zu %zu %zu\n", nl, nf, tf);
  107|    238|			nl++;
  108|    238|#if CSV_LINES
  109|    238|			if (nl == CSV_LINES)
  ------------------
  |  |   61|    238|#define CSV_LINES 10
  ------------------
  |  Branch (109:8): [True: 1, False: 237]
  ------------------
  110|      1|				return tf != 0 && tf == nf;
  ------------------
  |  Branch (110:12): [True: 1, False: 0]
  |  Branch (110:23): [True: 1, False: 0]
  ------------------
  111|    237|#endif
  112|    237|			if (tf == 0) {
  ------------------
  |  Branch (112:8): [True: 184, False: 53]
  ------------------
  113|       |				// First time and no fields, give up
  114|    184|				if (nf == 0) 
  ------------------
  |  Branch (114:9): [True: 134, False: 50]
  ------------------
  115|    134|					return 0;
  116|       |				// First time, set the number of fields
  117|     50|				tf = nf;
  118|     53|			} else if (tf != nf) {
  ------------------
  |  Branch (118:15): [True: 31, False: 22]
  ------------------
  119|       |				// Field number mismatch, we are done.
  120|     31|				return 0;
  121|     31|			}
  122|     72|			nf = 0;
  123|     72|			break;
  124|  51.0M|		default:
  ------------------
  |  Branch (124:3): [True: 51.0M, False: 2.94M]
  ------------------
  125|  51.0M|			break;
  126|  53.9M|		}
  127|  53.9M|	}
  128|  1.34k|	return tf && nl >= 2;
  ------------------
  |  Branch (128:9): [True: 18, False: 1.32k]
  |  Branch (128:15): [True: 6, False: 12]
  ------------------
  129|  1.50k|}
is_csv.c:eatquote:
   68|  6.30k|{
   69|  6.30k|	int quote = 0;
   70|       |
   71|  7.63M|	while (uc < ue) {
  ------------------
  |  Branch (71:9): [True: 7.63M, False: 167]
  ------------------
   72|  7.63M|		unsigned char c = *uc++;
   73|  7.63M|		if (c != '"') {
  ------------------
  |  Branch (73:7): [True: 242k, False: 7.38M]
  ------------------
   74|       |			// We already got one, done.
   75|   242k|			if (quote) {
  ------------------
  |  Branch (75:8): [True: 6.13k, False: 236k]
  ------------------
   76|  6.13k|				return --uc;
   77|  6.13k|			}
   78|   236k|			continue;
   79|   242k|		}
   80|  7.38M|		if (quote) {
  ------------------
  |  Branch (80:7): [True: 3.69M, False: 3.69M]
  ------------------
   81|       |			// quote-quote escapes
   82|  3.69M|			quote = 0;
   83|  3.69M|			continue;
   84|  3.69M|		}
   85|       |		// first quote
   86|  3.69M|		quote = 1;
   87|  3.69M|	}
   88|    167|	return ue;
   89|  6.30k|}

file_is_json:
  423|  9.75k|{
  424|  9.75k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  9.75k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  9.75k|	const unsigned char *ue = uc + b->flen;
  426|  9.75k|	size_t st[JSON_MAX];
  427|  9.75k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  9.75k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  9.75k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  9.75k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  9.75k|	int jt;
  429|       |
  430|       |
  431|  9.75k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  9.75k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  9.75k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 9.75k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  9.75k|	memset(st, 0, sizeof(st));
  435|       |
  436|  9.75k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 9.74k, False: 15]
  ------------------
  437|  9.74k|		return 0;
  438|       |
  439|     15|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     15|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 15]
  ------------------
  440|      0|		return 1;
  441|     15|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 15]
  ------------------
  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|     15|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 15]
  ------------------
  448|     15|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 10, False: 5]
  ------------------
  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|     15|	return 1;
  462|     15|}
is_json.c:json_parse:
  348|  16.0k|{
  349|  16.0k|	const unsigned char *uc, *ouc;
  350|  16.0k|	int rv = 0;
  351|  16.0k|	int t;
  352|       |
  353|  16.0k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  16.0k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 65, False: 15.9k]
  ------------------
  355|     65|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  15.9k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 1, False: 15.9k]
  ------------------
  359|      1|		DPRINTF("Too many levels", uc, *ucp);
  ------------------
  |  |   52|      1|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|      1|		return 0;
  361|      1|	}
  362|       |#if JSON_COUNT
  363|       |	/* bail quickly if not counting */
  364|       |	if (lvl > 1 && (st[JSON_OBJECT] || st[JSON_ARRAYN]))
  365|       |		return 1;
  366|       |#endif
  367|       |
  368|  15.9k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  15.9k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|  15.9k|	switch (*uc++) {
  370|    384|	case '"':
  ------------------
  |  Branch (370:2): [True: 384, False: 15.5k]
  ------------------
  371|    384|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    384|		t = JSON_STRING;
  ------------------
  |  |   60|    384|#define JSON_STRING	4
  ------------------
  373|    384|		break;
  374|  3.85k|	case '[':
  ------------------
  |  Branch (374:2): [True: 3.85k, False: 12.1k]
  ------------------
  375|  3.85k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  3.85k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  3.85k|#define JSON_ARRAY	0
  ------------------
  377|  3.85k|		break;
  378|    716|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 716, False: 15.2k]
  ------------------
  379|    716|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    716|		t = JSON_OBJECT;
  ------------------
  |  |   59|    716|#define JSON_OBJECT	3
  ------------------
  381|    716|		break;
  382|    278|	case 't':
  ------------------
  |  Branch (382:2): [True: 278, False: 15.6k]
  ------------------
  383|    278|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    278|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    278|#define JSON_CONSTANT	1
  ------------------
  385|    278|		break;
  386|    225|	case 'f':
  ------------------
  |  Branch (386:2): [True: 225, False: 15.7k]
  ------------------
  387|    225|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    225|		    lvl + 1);
  389|    225|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    225|#define JSON_CONSTANT	1
  ------------------
  390|    225|		break;
  391|    124|	case 'n':
  ------------------
  |  Branch (391:2): [True: 124, False: 15.8k]
  ------------------
  392|    124|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    124|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    124|#define JSON_CONSTANT	1
  ------------------
  394|    124|		break;
  395|  10.3k|	default:
  ------------------
  |  Branch (395:2): [True: 10.3k, False: 5.58k]
  ------------------
  396|  10.3k|		--uc;
  397|  10.3k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  10.3k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  10.3k|#define JSON_NUMBER	2
  ------------------
  399|  10.3k|		break;
  400|  15.9k|	}
  401|  15.9k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 2.74k, False: 13.2k]
  ------------------
  402|  2.74k|		st[t]++;
  403|  15.9k|	uc = json_skip_space(uc, ue);
  404|  16.0k|out:
  405|  16.0k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  16.0k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  406|  16.0k|	*ucp = uc;
  407|  16.0k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 9.75k, False: 6.26k]
  ------------------
  408|  9.75k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 9.43k, False: 323]
  ------------------
  409|  9.43k|			return 0;
  410|    323|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 68, False: 255]
  ------------------
  411|     68|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|     68|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     59|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 9, False: 59]
  |  Branch (411:31): [True: 1, False: 58]
  ------------------
  412|    255|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 32, False: 223]
  |  Branch (412:22): [True: 24, False: 8]
  ------------------
  413|     24|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     24|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     19|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 5, False: 19]
  |  Branch (413:31): [True: 0, False: 19]
  ------------------
  414|    231|		else
  415|    231|			return 0;
  416|    255|	}
  417|  6.26k|	return rv;
  418|  16.0k|}
is_json.c:json_skip_space:
  119|  39.1k|{
  120|  7.77M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 7.77M, False: 1.79k]
  |  Branch (120:20): [True: 7.73M, False: 37.3k]
  ------------------
  121|  7.73M|		uc++;
  122|  39.1k|	return uc;
  123|  39.1k|}
is_json.c:json_isspace:
   79|  7.77M|{
   80|  7.77M|	switch (uc) {
   81|  6.31M|	case ' ':
  ------------------
  |  Branch (81:2): [True: 6.31M, False: 1.45M]
  ------------------
   82|  7.47M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 1.15M, False: 6.61M]
  ------------------
   83|  7.73M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 262k, False: 7.50M]
  ------------------
   84|  7.73M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 253, False: 7.77M]
  ------------------
   85|  7.73M|		return 1;
   86|  37.3k|	default:
  ------------------
  |  Branch (86:2): [True: 37.3k, False: 7.73M]
  ------------------
   87|  37.3k|		return 0;
   88|  7.77M|	}
   89|  7.77M|}
is_json.c:json_parse_string:
  129|  1.06k|{
  130|  1.06k|	const unsigned char *uc = *ucp;
  131|  1.06k|	size_t i;
  132|       |
  133|  1.06k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  1.06k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|  26.9k|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 26.8k, False: 85]
  ------------------
  135|  26.8k|		switch (*uc++) {
  136|     11|		case '\0':
  ------------------
  |  Branch (136:3): [True: 11, False: 26.8k]
  ------------------
  137|     11|			goto out;
  138|  4.74k|		case '\\':
  ------------------
  |  Branch (138:3): [True: 4.74k, False: 22.1k]
  ------------------
  139|  4.74k|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 17, False: 4.72k]
  ------------------
  140|     17|				goto out;
  141|  4.72k|			switch (*uc++) {
  142|      1|			case '\0':
  ------------------
  |  Branch (142:4): [True: 1, False: 4.72k]
  ------------------
  143|      1|				goto out;
  144|    427|			case '"':
  ------------------
  |  Branch (144:4): [True: 427, False: 4.29k]
  ------------------
  145|    759|			case '\\':
  ------------------
  |  Branch (145:4): [True: 332, False: 4.39k]
  ------------------
  146|    837|			case '/':
  ------------------
  |  Branch (146:4): [True: 78, False: 4.64k]
  ------------------
  147|  1.13k|			case 'b':
  ------------------
  |  Branch (147:4): [True: 294, False: 4.42k]
  ------------------
  148|  1.51k|			case 'f':
  ------------------
  |  Branch (148:4): [True: 385, False: 4.33k]
  ------------------
  149|  1.71k|			case 'n':
  ------------------
  |  Branch (149:4): [True: 198, False: 4.52k]
  ------------------
  150|  2.26k|			case 'r':
  ------------------
  |  Branch (150:4): [True: 553, False: 4.17k]
  ------------------
  151|  2.54k|			case 't':
  ------------------
  |  Branch (151:4): [True: 276, False: 4.44k]
  ------------------
  152|  2.54k|				continue;
  153|  2.16k|			case 'u':
  ------------------
  |  Branch (153:4): [True: 2.16k, False: 2.56k]
  ------------------
  154|  2.16k|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 6, False: 2.15k]
  ------------------
  155|      6|					uc = ue;
  156|      6|					goto out;
  157|      6|				}
  158|  10.7k|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 8.59k, False: 2.13k]
  ------------------
  159|  8.59k|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 27, False: 8.56k]
  ------------------
  160|     27|						goto out;
  161|  2.13k|				continue;
  162|  2.13k|			default:
  ------------------
  |  Branch (162:4): [True: 16, False: 4.70k]
  ------------------
  163|     16|				goto out;
  164|  4.72k|			}
  165|    906|		case '"':
  ------------------
  |  Branch (165:3): [True: 906, False: 25.9k]
  ------------------
  166|    906|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|    906|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|    906|			*ucp = uc;
  168|    906|			return 1;
  169|  21.2k|		default:
  ------------------
  |  Branch (169:3): [True: 21.2k, False: 5.65k]
  ------------------
  170|  21.2k|			continue;
  171|  26.8k|		}
  172|  26.8k|	}
  173|    163|out:
  174|    163|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    163|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|    163|	*ucp = uc;
  176|    163|	return 0;
  177|  1.06k|}
is_json.c:json_isxdigit:
  105|  8.59k|{
  106|  8.59k|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 208, False: 8.38k]
  ------------------
  107|    208|		return 1;
  108|  8.38k|	switch (uc) {
  109|  5.06k|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 39, False: 8.34k]
  |  Branch (109:12): [True: 1.00k, False: 7.37k]
  |  Branch (109:22): [True: 836, False: 7.54k]
  |  Branch (109:32): [True: 122, False: 8.26k]
  |  Branch (109:42): [True: 488, False: 7.89k]
  |  Branch (109:52): [True: 2.57k, False: 5.80k]
  ------------------
  110|  8.35k|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 341, False: 8.04k]
  |  Branch (110:12): [True: 2.35k, False: 6.02k]
  |  Branch (110:22): [True: 9, False: 8.37k]
  |  Branch (110:32): [True: 245, False: 8.13k]
  |  Branch (110:42): [True: 167, False: 8.21k]
  |  Branch (110:52): [True: 171, False: 8.21k]
  ------------------
  111|  8.35k|		return 1;
  112|     27|	default:
  ------------------
  |  Branch (112:2): [True: 27, False: 8.35k]
  ------------------
  113|     27|		return 0;
  114|  8.38k|	}
  115|  8.38k|}
is_json.c:json_isdigit:
   93|  20.6M|{
   94|  20.6M|	switch (uc) {
   95|  20.5M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 20.4M, False: 200k]
  |  Branch (95:12): [True: 254, False: 20.6M]
  |  Branch (95:22): [True: 10.7k, False: 20.6M]
  |  Branch (95:32): [True: 13.0k, False: 20.6M]
  |  Branch (95:42): [True: 63.9k, False: 20.6M]
  ------------------
   96|  20.6M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 239, False: 20.6M]
  |  Branch (96:12): [True: 65.6k, False: 20.6M]
  |  Branch (96:22): [True: 16.5k, False: 20.6M]
  |  Branch (96:32): [True: 660, False: 20.6M]
  |  Branch (96:42): [True: 10, False: 20.6M]
  ------------------
   97|  20.6M|		return 1;
   98|  29.3k|	default:
  ------------------
  |  Branch (98:2): [True: 29.3k, False: 20.6M]
  ------------------
   99|  29.3k|		return 0;
  100|  20.6M|	}
  101|  20.6M|}
is_json.c:json_parse_array:
  182|  3.85k|{
  183|  3.85k|	const unsigned char *uc = *ucp;
  184|       |
  185|  3.85k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  3.85k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  5.73k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 5.70k, False: 24]
  ------------------
  187|  5.70k|		uc = json_skip_space(uc, ue);
  188|  5.70k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 12, False: 5.69k]
  ------------------
  189|     12|			goto out;
  190|  5.69k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 114, False: 5.58k]
  ------------------
  191|    114|			goto done;
  192|  5.58k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 3.34k, False: 2.23k]
  ------------------
  193|  3.34k|			goto out;
  194|  2.23k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 37, False: 2.19k]
  ------------------
  195|     37|			goto out;
  196|  2.19k|		switch (*uc) {
  197|  1.87k|		case ',':
  ------------------
  |  Branch (197:3): [True: 1.87k, False: 322]
  ------------------
  198|  1.87k|			uc++;
  199|  1.87k|			continue;
  200|    306|		case ']':
  ------------------
  |  Branch (200:3): [True: 306, False: 1.89k]
  ------------------
  201|    420|		done:
  202|    420|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    420|#define JSON_ARRAYN	5
  ------------------
  203|    420|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    420|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  204|    420|			*ucp = uc + 1;
  205|    420|			return 1;
  206|     16|		default:
  ------------------
  |  Branch (206:3): [True: 16, False: 2.18k]
  ------------------
  207|     16|			goto out;
  208|  2.19k|		}
  209|  2.19k|	}
  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|  3.85k|}
is_json.c:json_parse_object:
  219|    716|{
  220|    716|	const unsigned char *uc = *ucp;
  221|    716|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    716|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  222|    767|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 762, False: 5]
  ------------------
  223|    762|		uc = json_skip_space(uc, ue);
  224|    762|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 10, False: 752]
  ------------------
  225|     10|			goto out;
  226|    752|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 41, False: 711]
  ------------------
  227|     41|			uc++;
  228|     41|			goto done;
  229|     41|		}
  230|    711|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 26, False: 685]
  ------------------
  231|     26|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     26|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|     26|			goto out;
  233|     26|		}
  234|    685|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    685|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  235|    685|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 16, False: 669]
  ------------------
  236|     16|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     16|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  237|     16|			goto out;
  238|     16|		}
  239|    669|		uc = json_skip_space(uc, ue);
  240|    669|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 11, False: 658]
  ------------------
  241|     11|			goto out;
  242|    658|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 7, False: 651]
  ------------------
  243|      7|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|      7|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  244|      7|			goto out;
  245|      7|		}
  246|    651|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 485, False: 166]
  ------------------
  247|    485|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    485|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|    485|			goto out;
  249|    485|		}
  250|    166|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 3, False: 163]
  ------------------
  251|      3|			goto out;
  252|    163|		switch (*uc++) {
  253|     51|		case ',':
  ------------------
  |  Branch (253:3): [True: 51, False: 112]
  ------------------
  254|     51|			continue;
  255|    106|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 106, False: 57]
  ------------------
  256|    147|		done:
  257|    147|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    147|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|    147|			*ucp = uc;
  259|    147|			return 1;
  260|      6|		default:
  ------------------
  |  Branch (260:3): [True: 6, False: 157]
  ------------------
  261|      6|			DPRINTF("not more", uc, *ucp);
  ------------------
  |  |   52|      6|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  262|      6|			*ucp = uc - 1;
  263|      6|			goto out;
  264|    163|		}
  265|    163|	}
  266|    569|out:
  267|    569|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    569|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  268|    569|	*ucp = uc;
  269|    569|	return 0;
  270|    716|}
is_json.c:json_parse_const:
  328|    627|{
  329|    627|	const unsigned char *uc = *ucp;
  330|       |
  331|    627|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|    627|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  332|    627|	*ucp += --len - 1;
  333|    627|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 32, False: 595]
  ------------------
  334|     32|		*ucp = ue;
  335|  2.50k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 2.48k, False: 21]
  |  Branch (335:20): [True: 1.93k, False: 542]
  ------------------
  336|  1.93k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 64, False: 1.87k]
  ------------------
  337|     64|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     64|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  338|     64|			return 0;
  339|     64|		}
  340|  1.93k|	}
  341|    563|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|    563|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  342|    563|	return 1;
  343|    627|}
is_json.c:json_parse_number:
  276|  10.3k|{
  277|  10.3k|	const unsigned char *uc = *ucp;
  278|  10.3k|	int got = 0;
  279|       |
  280|  10.3k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  10.3k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|  10.3k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 10.3k]
  ------------------
  282|      0|		return 0;
  283|  10.3k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 270, False: 10.1k]
  ------------------
  284|    270|		uc++;
  285|       |
  286|  20.6M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 20.6M, False: 44]
  ------------------
  287|  20.6M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 10.3k, False: 20.6M]
  ------------------
  288|  10.3k|			break;
  289|  20.6M|		got = 1;
  290|  20.6M|	}
  291|  10.3k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 44, False: 10.3k]
  ------------------
  292|     44|		goto out;
  293|  10.3k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 207, False: 10.1k]
  ------------------
  294|    207|		uc++;
  295|  10.7k|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 10.7k, False: 14]
  ------------------
  296|  10.7k|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 10.3k, False: 396]
  ------------------
  297|  10.3k|			break;
  298|    396|		got = 1;
  299|    396|	}
  300|  10.3k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 14, False: 10.3k]
  ------------------
  301|     14|		goto out;
  302|  10.3k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 1.36k, False: 8.94k]
  |  Branch (302:14): [True: 80, False: 1.28k]
  |  Branch (302:28): [True: 294, False: 995]
  ------------------
  303|    374|		uc++;
  304|    374|		got = 0;
  305|    374|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 4, False: 370]
  ------------------
  306|      4|			goto out;
  307|    370|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 46, False: 324]
  |  Branch (307:21): [True: 208, False: 116]
  ------------------
  308|    254|			uc++;
  309|  1.01k|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 997, False: 18]
  ------------------
  310|    997|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 352, False: 645]
  ------------------
  311|    352|				break;
  312|    645|			got = 1;
  313|    645|		}
  314|    370|	}
  315|  10.3k|out:
  316|  10.3k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 8.99k, False: 1.38k]
  ------------------
  317|  8.99k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  8.99k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  1.38k|	else
  319|  1.38k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  1.38k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|  10.3k|	*ucp = uc;
  321|  10.3k|	return got;
  322|  10.3k|}

file_is_simh:
  150|  9.75k|{
  151|  9.75k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  9.75k|#define CAST(T, b)	((T)(b))
  ------------------
  152|  9.75k|	const unsigned char *ue = uc + b->flen;
  153|  9.75k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  9.75k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  9.75k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  9.75k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  154|       |
  155|  9.75k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  9.75k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  9.75k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (155:6): [True: 0, False: 9.75k]
  ------------------
  156|      0|		return 0;
  157|       |
  158|  9.75k|	if (!simh_parse(uc, ue))
  ------------------
  |  Branch (158:6): [True: 9.72k, False: 30]
  ------------------
  159|  9.72k|		return 0;
  160|       |
  161|     30|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     30|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (161:6): [True: 0, False: 30]
  ------------------
  162|      0|		return 1;
  163|       |
  164|     30|	if (mime) {
  ------------------
  |  Branch (164:6): [True: 0, False: 30]
  ------------------
  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|     30|	if (file_printf(ms, "SIMH tape data") == -1)
  ------------------
  |  Branch (170:6): [True: 0, False: 30]
  ------------------
  171|      0|		return -1;
  172|       |
  173|     30|	return 1;
  174|     30|}
is_simh.c:simh_parse:
  111|  9.75k|{
  112|  9.75k|	uint32_t nbytes, cbytes;
  113|  9.75k|	const unsigned char *orig_uc = uc;
  114|  9.75k|	size_t nt = 0, nr = 0;
  115|       |
  116|  9.75k|	(void)memcpy(simh_bo.s, "\01\02\03\04", 4);
  117|       |
  118|  14.9k|	while (ue - uc >= CAST(ptrdiff_t, sizeof(nbytes))) {
  ------------------
  |  |  444|  14.9k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (118:9): [True: 14.4k, False: 509]
  ------------------
  119|  14.4k|		nbytes = getlen(&uc);
  120|  14.4k|		if ((nt > 0 || nr > 0) && nbytes == 0xFFFFFFFF)
  ------------------
  |  Branch (120:8): [True: 1.18k, False: 13.2k]
  |  Branch (120:18): [True: 3.98k, False: 9.27k]
  |  Branch (120:29): [True: 1, False: 5.17k]
  ------------------
  121|       |			/* EOM after at least one record or tapemark */
  122|      1|			break;
  123|  14.4k|		if (nbytes == 0) {
  ------------------
  |  Branch (123:7): [True: 1.06k, False: 13.3k]
  ------------------
  124|  1.06k|			nt++;	/* count tapemarks */
  125|  1.06k|#if SIMH_TAPEMARKS
  126|  1.06k|			if (nt == SIMH_TAPEMARKS)
  ------------------
  |  |   65|  1.06k|#define SIMH_TAPEMARKS 10
  ------------------
  |  Branch (126:8): [True: 92, False: 976]
  ------------------
  127|     92|				break;
  128|    976|#endif
  129|    976|			continue;
  130|  1.06k|		}
  131|       |		/* handle a data record */
  132|  13.3k|		uc += nbytes;
  133|  13.3k|		if (ue - uc < CAST(ptrdiff_t, sizeof(nbytes)))
  ------------------
  |  |  444|  13.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (133:7): [True: 9.04k, False: 4.34k]
  ------------------
  134|  9.04k|			break;
  135|  4.34k|		cbytes = getlen(&uc);
  136|  4.34k|		if (nbytes != cbytes)
  ------------------
  |  Branch (136:7): [True: 116, False: 4.22k]
  ------------------
  137|    116|			return 0;
  138|  4.22k|		nr++;
  139|  4.22k|	}
  140|  9.64k|	if (nt * sizeof(uint32_t) == CAST(size_t, uc - orig_uc))
  ------------------
  |  |  444|  9.64k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (140:6): [True: 590, False: 9.05k]
  ------------------
  141|    590|		return 0;	/* All examined data was tapemarks (0) */
  142|  9.05k|	if (nr == 0)		/* No records */
  ------------------
  |  Branch (142:6): [True: 9.02k, False: 30]
  ------------------
  143|  9.02k|		return 0;
  144|     30|	return 1;
  145|  9.05k|}
is_simh.c:getlen:
   95|  18.7k|{
   96|  18.7k|	uint32_t n;
   97|  18.7k|	memcpy(&n, *uc, sizeof(n));
   98|  18.7k|	*uc += sizeof(n);
   99|  18.7k|	if (NEED_SWAP)
  ------------------
  |  |   75|  18.7k|#define NEED_SWAP	(simh_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  444|  18.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (75:19): [True: 0, False: 18.7k]
  |  |  ------------------
  ------------------
  100|      0|		n = swap4(n);
  101|  18.7k|	if (n == 0xffffffff)	/* check for End of Medium */
  ------------------
  |  Branch (101:6): [True: 36, False: 18.7k]
  ------------------
  102|     36|		return n;
  103|  18.7k|	n &= 0x00ffffff;	/* keep only the record len */
  104|  18.7k|	if (n & 1)
  ------------------
  |  Branch (104:6): [True: 14.5k, False: 4.16k]
  ------------------
  105|  14.5k|		n++;
  106|  18.7k|	return n;
  107|  18.7k|}

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

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

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

file_trycdf:
  542|  9.75k|{
  543|  9.75k|	int fd = b->fd;
  544|  9.75k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  9.75k|#define CAST(T, b)	((T)(b))
  ------------------
  545|  9.75k|	size_t nbytes = b->flen;
  546|  9.75k|	cdf_info_t info;
  547|  9.75k|	cdf_header_t h;
  548|  9.75k|	cdf_sat_t sat, ssat;
  549|  9.75k|	cdf_stream_t sst, scn;
  550|  9.75k|	cdf_dir_t dir;
  551|  9.75k|	int i;
  552|  9.75k|	const char *expn = "";
  553|  9.75k|	const cdf_directory_t *root_storage;
  554|       |
  555|  9.75k|	scn.sst_tab = NULL;
  556|  9.75k|	info.i_fd = fd;
  557|  9.75k|	info.i_buf = buf;
  558|  9.75k|	info.i_len = nbytes;
  559|  9.75k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  9.75k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  9.75k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (559:6): [True: 0, False: 9.75k]
  ------------------
  560|      0|		return 0;
  561|  9.75k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (561:6): [True: 8.76k, False: 996]
  ------------------
  562|  8.76k|		return 0;
  563|       |#ifdef CDF_DEBUG
  564|       |	cdf_dump_header(&h);
  565|       |#endif
  566|       |
  567|    996|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (567:6): [True: 109, False: 887]
  ------------------
  568|    109|		expn = "Can't read SAT";
  569|    109|		goto out0;
  570|    109|	}
  571|       |#ifdef CDF_DEBUG
  572|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  573|       |#endif
  574|       |
  575|    887|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (575:6): [True: 122, False: 765]
  ------------------
  576|    122|		expn = "Can't read SSAT";
  577|    122|		goto out1;
  578|    122|	}
  579|       |#ifdef CDF_DEBUG
  580|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  581|       |#endif
  582|       |
  583|    765|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (583:6): [True: 87, False: 678]
  ------------------
  584|     87|		expn = "Can't read directory";
  585|     87|		goto out2;
  586|     87|	}
  587|       |
  588|    678|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (588:6): [True: 38, False: 640]
  ------------------
  589|    678|	    &root_storage)) == -1) {
  590|     38|		expn = "Cannot read short stream";
  591|     38|		goto out3;
  592|     38|	}
  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|    640|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (608:6): [True: 0, False: 640]
  ------------------
  609|    640|	    "FileHeader", &scn) != -1) {
  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  611|      0|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (611:7): [True: 0, False: 0]
  ------------------
  612|      0|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (612:10): [True: 0, False: 0]
  ------------------
  613|      0|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  610|      0|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  614|      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]
  |  |  ------------------
  ------------------
  615|      0|			if (file_printf(ms,
  ------------------
  |  Branch (615:8): [True: 0, False: 0]
  ------------------
  616|      0|			    "Hancom HWP (Hangul Word Processor) file, version 5.0") == -1)
  617|      0|			    return -1;
  618|      0|		    } 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|      0|		    i = 1;
  623|      0|		    goto out5;
  624|      0|		} else {
  625|      0|		    cdf_zero_stream(&scn);
  626|      0|		}
  627|      0|	}
  628|       |
  629|    640|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (629:6): [True: 415, False: 225]
  ------------------
  630|    640|	    &scn)) == -1) {
  631|    415|		if (errno != ESRCH) {
  ------------------
  |  Branch (631:7): [True: 78, False: 337]
  ------------------
  632|     78|			expn = "Cannot read summary info";
  633|     78|		}
  634|    415|	} else {
  635|    225|		i = cdf_check_summary_info(ms, &info, &h,
  636|    225|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  637|    225|		cdf_zero_stream(&scn);
  638|    225|	}
  639|    640|	if (i <= 0) {
  ------------------
  |  Branch (639:6): [True: 634, False: 6]
  ------------------
  640|    634|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (640:7): [True: 376, False: 258]
  ------------------
  641|    634|		    &sst, &dir, &scn)) == -1) {
  642|    376|			if (errno != ESRCH) {
  ------------------
  |  Branch (642:8): [True: 78, False: 298]
  ------------------
  643|     78|				expn = "Cannot read summary info";
  644|     78|			}
  645|    376|		} else {
  646|    258|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  647|    258|			    &sst, &dir, &scn, root_storage, &expn);
  648|    258|		}
  649|    634|	}
  650|    640|	if (i <= 0) {
  ------------------
  |  Branch (650:6): [True: 583, False: 57]
  ------------------
  651|    583|		i = cdf_file_dir_info(ms, &dir);
  652|    583|		if (i < 0)
  ------------------
  |  Branch (652:7): [True: 583, False: 0]
  ------------------
  653|    583|			expn = "Cannot read section info";
  654|    583|	}
  655|    640|out5:
  656|    640|	cdf_zero_stream(&scn);
  657|    640|	cdf_zero_stream(&sst);
  658|    678|out3:
  659|    678|	free(dir.dir_tab);
  660|    765|out2:
  661|    765|	free(ssat.sat_tab);
  662|    887|out1:
  663|    887|	free(sat.sat_tab);
  664|    996|out0:
  665|       |	/* If we handled it already, return */
  666|    996|	if (i != -1)
  ------------------
  |  Branch (666:6): [True: 57, False: 939]
  ------------------
  667|     57|		return i;
  668|       |	/* Provide a default handler */
  669|    939|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|    939|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    939|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    939|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    939|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 939, False: 0]
  |  |  ------------------
  ------------------
  670|    939|		if (file_printf(ms,
  ------------------
  |  Branch (670:7): [True: 0, False: 939]
  ------------------
  671|    939|		    "Composite Document File V2 Document") == -1)
  672|      0|			return -1;
  673|    939|		if (*expn)
  ------------------
  |  Branch (673:7): [True: 939, False: 0]
  ------------------
  674|    939|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (674:8): [True: 0, False: 939]
  ------------------
  675|      0|				return -1;
  676|    939|	} 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|    939|	return 1;
  682|    939|}
readcdf.c:cdf_check_summary_info:
  391|    483|{
  392|    483|	int i;
  393|    483|	const char *str = NULL;
  394|    483|	cdf_directory_t *d;
  395|    483|	char name[__arraycount(d->d_name)];
  396|    483|	size_t j, k;
  397|       |
  398|       |#ifdef CDF_DEBUG
  399|       |	cdf_dump_summary_info(h, scn);
  400|       |#endif
  401|    483|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (401:6): [True: 426, False: 57]
  ------------------
  402|    426|	    *expn = "Can't expand summary_info";
  403|    426|	    return i;
  404|    426|	}
  405|     57|	if (i == 1)
  ------------------
  |  Branch (405:6): [True: 57, False: 0]
  ------------------
  406|     57|		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|    483|{
  300|    483|	cdf_summary_info_header_t si;
  301|    483|	cdf_property_info_t *info;
  302|    483|	size_t count;
  303|    483|	int m;
  304|       |
  305|    483|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (305:6): [True: 354, False: 129]
  ------------------
  306|    354|		return -1;
  307|       |
  308|    129|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|    129|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    129|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    129|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    129|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 129, False: 0]
  |  |  ------------------
  ------------------
  309|    129|		const char *str;
  310|       |
  311|    129|		if (file_printf(ms, "Composite Document File V2 Document")
  ------------------
  |  Branch (311:7): [True: 0, False: 129]
  ------------------
  312|    129|		    == -1)
  313|      0|			return -1;
  314|       |
  315|    129|		if (file_printf(ms, ", %s Endian",
  ------------------
  |  Branch (315:7): [True: 0, False: 129]
  ------------------
  316|    129|		    si.si_byte_order == 0xfffe ?  "Little" : "Big") == -1)
  ------------------
  |  Branch (316:7): [True: 6, False: 123]
  ------------------
  317|      0|			return -2;
  318|    129|		switch (si.si_os) {
  319|      6|		case 2:
  ------------------
  |  Branch (319:3): [True: 6, False: 123]
  ------------------
  320|      6|			if (file_printf(ms, ", Os: Windows, Version %d.%d",
  ------------------
  |  Branch (320:8): [True: 0, False: 6]
  ------------------
  321|      6|			    si.si_os_version & 0xff,
  322|      6|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  444|      6|#define CAST(T, b)	((T)(b))
  ------------------
  323|      0|				return -2;
  324|      6|			break;
  325|      9|		case 1:
  ------------------
  |  Branch (325:3): [True: 9, False: 120]
  ------------------
  326|      9|			if (file_printf(ms, ", Os: MacOS, Version %d.%d",
  ------------------
  |  Branch (326:8): [True: 0, False: 9]
  ------------------
  327|      9|			    CAST(uint32_t, si.si_os_version) >> 8,
  ------------------
  |  |  444|      9|#define CAST(T, b)	((T)(b))
  ------------------
  328|      9|			    si.si_os_version & 0xff) == -1)
  329|      0|				return -2;
  330|      9|			break;
  331|    114|		default:
  ------------------
  |  Branch (331:3): [True: 114, False: 15]
  ------------------
  332|    114|			if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
  ------------------
  |  Branch (332:8): [True: 0, False: 114]
  ------------------
  333|    114|			    si.si_os_version & 0xff,
  334|    114|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  444|    114|#define CAST(T, b)	((T)(b))
  ------------------
  335|      0|				return -2;
  336|    114|			break;
  337|    129|		}
  338|    129|		if (root_storage) {
  ------------------
  |  Branch (338:7): [True: 52, False: 77]
  ------------------
  339|     52|			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  340|     52|			    clsid2desc);
  341|     52|			if (str) {
  ------------------
  |  Branch (341:8): [True: 0, False: 52]
  ------------------
  342|      0|				if (file_printf(ms, ", %s", str) == -1)
  ------------------
  |  Branch (342:9): [True: 0, False: 0]
  ------------------
  343|      0|					return -2;
  344|      0|			}
  345|     52|		}
  346|    129|	}
  347|       |
  348|    129|	m = cdf_file_property_info(ms, info, count, root_storage);
  349|    129|	free(info);
  350|       |
  351|    129|	return m == -1 ? -2 : m;
  ------------------
  |  Branch (351:9): [True: 72, False: 57]
  ------------------
  352|    129|}
readcdf.c:cdf_clsid_to_mime:
   97|     52|{
   98|     52|	size_t i;
   99|    104|	for (i = 0; cv[i].mime != NULL; i++) {
  ------------------
  |  Branch (99:14): [True: 52, False: 52]
  ------------------
  100|     52|		if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
  ------------------
  |  Branch (100:7): [True: 0, False: 52]
  |  Branch (100:37): [True: 0, False: 0]
  ------------------
  101|      0|			return cv[i].mime;
  102|     52|	}
  103|       |#ifdef CDF_DEBUG
  104|       |	fprintf(stderr, "unknown mime %" PRIx64 ", %" PRIx64 "\n", clsid[0],
  105|       |	    clsid[1]);
  106|       |#endif
  107|     52|	return NULL;
  108|     52|}
readcdf.c:cdf_file_property_info:
  150|    129|{
  151|    129|	size_t i;
  152|    129|	cdf_timestamp_t tp;
  153|    129|	struct timespec ts;
  154|    129|	char buf[64];
  155|    129|	const char *str = NULL;
  156|    129|	const char *s, *e;
  157|    129|	int len;
  158|       |
  159|    129|	if (!NOTMIME(ms) && root_storage)
  ------------------
  |  |   42|    258|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    129|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    129|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    129|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (159:6): [True: 0, False: 129]
  |  Branch (159:22): [True: 0, False: 0]
  ------------------
  160|      0|		str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  161|      0|		    clsid2mime);
  162|       |
  163|    345|	for (i = 0; i < count; i++) {
  ------------------
  |  Branch (163:14): [True: 288, False: 57]
  ------------------
  164|    288|		cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
  165|    288|		switch (info[i].pi_type) {
  166|      3|		case CDF_NULL:
  ------------------
  |  |  198|      3|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (166:3): [True: 3, False: 285]
  ------------------
  167|      3|			break;
  168|      6|		case CDF_SIGNED16:
  ------------------
  |  |  199|      6|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (168:3): [True: 6, False: 282]
  ------------------
  169|      6|			if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
  ------------------
  |  |   42|     12|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      6|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      6|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      6|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 6, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (169:23): [True: 0, False: 6]
  ------------------
  170|      6|			    info[i].pi_s16) == -1)
  ------------------
  |  |  187|      6|#define pi_s16	pi_val._pi_s16
  ------------------
  171|      0|				return -1;
  172|      6|			break;
  173|     18|		case CDF_SIGNED32:
  ------------------
  |  |  200|     18|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (173:3): [True: 18, False: 270]
  ------------------
  174|     18|			if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
  ------------------
  |  |   42|     36|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     18|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     18|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     18|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 18, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (174:23): [True: 0, False: 18]
  ------------------
  175|     18|			    info[i].pi_s32) == -1)
  ------------------
  |  |  185|     18|#define pi_s32	pi_val._pi_s32
  ------------------
  176|      0|				return -1;
  177|     18|			break;
  178|     18|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|      7|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (178:3): [True: 7, False: 281]
  ------------------
  179|      7|			if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
  ------------------
  |  |   42|     14|#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]
  |  |  ------------------
  ------------------
  |  Branch (179:23): [True: 0, False: 7]
  ------------------
  180|      7|			    info[i].pi_u32) == -1)
  ------------------
  |  |  184|      7|#define pi_u32	pi_val._pi_u32
  ------------------
  181|      0|				return -1;
  182|      7|			break;
  183|     10|		case CDF_FLOAT:
  ------------------
  |  |  201|     10|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (183:3): [True: 10, False: 278]
  ------------------
  184|     10|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|     20|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     10|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     10|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     10|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 10, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (184:23): [True: 0, False: 10]
  ------------------
  185|     10|			    info[i].pi_f) == -1)
  ------------------
  |  |  188|     10|#define pi_f	pi_val._pi_f
  ------------------
  186|      0|				return -1;
  187|     10|			break;
  188|     14|		case CDF_DOUBLE:
  ------------------
  |  |  202|     14|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (188:3): [True: 14, False: 274]
  ------------------
  189|     14|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|     28|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     14|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     14|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     14|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 14, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (189:23): [True: 0, False: 14]
  ------------------
  190|     14|			    info[i].pi_d) == -1)
  ------------------
  |  |  189|     14|#define pi_d	pi_val._pi_d
  ------------------
  191|      0|				return -1;
  192|     14|			break;
  193|     29|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|     29|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (193:3): [True: 29, False: 259]
  ------------------
  194|     47|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|     47|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (194:3): [True: 18, False: 270]
  ------------------
  195|     47|			len = info[i].pi_str.s_len;
  ------------------
  |  |  191|     47|#define pi_str	pi_val._pi_str
  ------------------
  196|     47|			if (len > 1) {
  ------------------
  |  Branch (196:8): [True: 32, False: 15]
  ------------------
  197|     32|				char vbuf[1024];
  198|     32|				size_t j, k = 1;
  199|       |
  200|     32|				if (info[i].pi_type == CDF_LENGTH32_WSTRING)
  ------------------
  |  |  227|     32|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (200:9): [True: 18, False: 14]
  ------------------
  201|     18|				    k++;
  202|     32|				s = info[i].pi_str.s_buf;
  ------------------
  |  |  191|     32|#define pi_str	pi_val._pi_str
  ------------------
  203|     32|				e = info[i].pi_str.s_buf + len;
  ------------------
  |  |  191|     32|#define pi_str	pi_val._pi_str
  ------------------
  204|    189|				for (j = 0; s < e && j < sizeof(vbuf)
  ------------------
  |  Branch (204:17): [True: 186, False: 3]
  |  Branch (204:26): [True: 186, False: 0]
  ------------------
  205|    189|				    && len--; s += k) {
  ------------------
  |  Branch (205:12): [True: 186, False: 0]
  ------------------
  206|    186|					if (*s == '\0')
  ------------------
  |  Branch (206:10): [True: 29, False: 157]
  ------------------
  207|     29|						break;
  208|    157|					if (isprint(CAST(unsigned char, *s)))
  209|     58|						vbuf[j++] = *s;
  210|    157|				}
  211|     32|				if (j == sizeof(vbuf))
  ------------------
  |  Branch (211:9): [True: 0, False: 32]
  ------------------
  212|      0|					--j;
  213|     32|				vbuf[j] = '\0';
  214|     32|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|     32|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     32|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     32|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     32|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 32, False: 0]
  |  |  ------------------
  ------------------
  215|     32|					if (vbuf[0]) {
  ------------------
  |  Branch (215:10): [True: 15, False: 17]
  ------------------
  216|     15|						if (file_printf(ms, ", %s: %s",
  ------------------
  |  Branch (216:11): [True: 0, False: 15]
  ------------------
  217|     15|						    buf, vbuf) == -1)
  218|      0|							return -1;
  219|     15|					}
  220|     32|				} 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|     32|			}
  225|     47|			break;
  226|    107|		case CDF_FILETIME:
  ------------------
  |  |  228|    107|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (226:3): [True: 107, False: 181]
  ------------------
  227|    107|			tp = info[i].pi_tp;
  ------------------
  |  |  190|    107|#define pi_tp	pi_val._pi_tp
  ------------------
  228|    107|			if (tp != 0) {
  ------------------
  |  Branch (228:8): [True: 98, False: 9]
  ------------------
  229|     98|				char tbuf[64];
  230|     98|				if (tp < 1000000000000000LL) {
  ------------------
  |  Branch (230:9): [True: 52, False: 46]
  ------------------
  231|     52|					cdf_print_elapsed_time(tbuf,
  232|     52|					    sizeof(tbuf), tp);
  233|     52|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    104|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     52|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     52|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     52|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 52, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (233:25): [True: 0, False: 52]
  ------------------
  234|     52|					    ", %s: %s", buf, tbuf) == -1)
  235|      0|						return -1;
  236|     52|				} else {
  237|     46|					char *c, *ec;
  238|     46|					cdf_timestamp_to_timespec(&ts, tp);
  239|     46|					c = cdf_ctime(&ts.tv_sec, tbuf);
  240|     46|					if (c != NULL &&
  ------------------
  |  Branch (240:10): [True: 46, False: 0]
  ------------------
  241|     46|					    (ec = strchr(c, '\n')) != NULL)
  ------------------
  |  Branch (241:10): [True: 46, False: 0]
  ------------------
  242|     46|						*ec = '\0';
  243|       |
  244|     46|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|     92|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     46|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     46|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     46|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 46, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (244:25): [True: 0, False: 46]
  ------------------
  245|     46|					    ", %s: %s", buf, c) == -1)
  246|      0|						return -1;
  247|     46|				}
  248|     98|			}
  249|    107|			break;
  250|    107|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|      4|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (250:3): [True: 4, False: 284]
  ------------------
  251|      4|			break;
  252|     72|		default:
  ------------------
  |  Branch (252:3): [True: 72, False: 216]
  ------------------
  253|     72|			return -1;
  254|    288|		}
  255|    288|	}
  256|     57|	if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|     57|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (256:6): [True: 0, False: 57]
  ------------------
  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|     57|	return 1;
  263|     57|}
readcdf.c:cdf_file_dir_info:
  513|    583|{
  514|    583|	size_t sd, j;
  515|       |
  516|  4.08k|	for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  130|  4.08k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (516:15): [True: 3.49k, False: 583]
  ------------------
  517|  3.49k|		const struct sinfo *si = &sectioninfo[sd];
  518|  8.74k|		for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (518:15): [True: 5.24k, False: 3.49k]
  ------------------
  519|  5.24k|			if (cdf_find_stream(dir, si->sections[j], si->types[j])
  ------------------
  |  Branch (519:8): [True: 0, False: 5.24k]
  ------------------
  520|  5.24k|			    > 0)
  521|      0|				break;
  522|       |#ifdef CDF_DEBUG
  523|       |			fprintf(stderr, "Can't read %s\n", si->sections[j]);
  524|       |#endif
  525|  5.24k|		}
  526|  3.49k|		if (si->sections[j] == NULL)
  ------------------
  |  Branch (526:7): [True: 3.49k, False: 0]
  ------------------
  527|  3.49k|			continue;
  528|      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]
  |  |  ------------------
  ------------------
  529|      0|			if (file_printf(ms, "CDFV2 %s", si->name) == -1)
  ------------------
  |  Branch (529:8): [True: 0, False: 0]
  ------------------
  530|      0|				return -1;
  531|      0|		} 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|      0|		return 1;
  536|      0|	}
  537|    583|	return -1;
  538|    583|}

file_tryelf:
 1815|  7.39k|{
 1816|  7.39k|	int fd = b->fd;
 1817|  7.39k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  7.39k|#define CAST(T, b)	((T)(b))
  ------------------
 1818|  7.39k|	size_t nbytes = b->flen;
 1819|  7.39k|	union {
 1820|  7.39k|		int32_t l;
 1821|  7.39k|		char c[sizeof(int32_t)];
 1822|  7.39k|	} u;
 1823|  7.39k|	int clazz;
 1824|  7.39k|	int swap;
 1825|  7.39k|	struct stat st;
 1826|  7.39k|	const struct stat *stp;
 1827|  7.39k|	off_t fsize;
 1828|  7.39k|	int flags = 0;
 1829|  7.39k|	Elf32_Ehdr elf32hdr;
 1830|  7.39k|	Elf64_Ehdr elf64hdr;
 1831|  7.39k|	uint16_t type, phnum, shnum, notecount;
 1832|       |
 1833|  7.39k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  7.39k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  7.39k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (1833:6): [True: 0, False: 7.39k]
  ------------------
 1834|      0|		return 0;
 1835|       |	/*
 1836|       |	 * ELF executables have multiple section headers in arbitrary
 1837|       |	 * file locations and thus file(1) cannot determine it from easily.
 1838|       |	 * Instead we traverse thru all section headers until a symbol table
 1839|       |	 * one is found or else the binary is stripped.
 1840|       |	 * Return immediately if it's not ELF (so we avoid pipe2file unless
 1841|       |	 * needed).
 1842|       |	 */
 1843|  7.39k|	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  157|  7.39k|#define	EI_MAG0		0		/* e_ident[] indexes */
  ------------------
              	if (buf[EI_MAG0] != ELFMAG0
  ------------------
  |  |  166|  14.7k|#define	ELFMAG0		0x7f		/* EI_MAG */
  ------------------
  |  Branch (1843:6): [True: 3.91k, False: 3.48k]
  ------------------
 1844|  7.39k|	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  3.48k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  167|  6.96k|#define	ELFMAG1		'E'
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  158|  2.73k|#define	EI_MAG1		1
  ------------------
              	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  ------------------
  |  |  172|  2.73k|#define	OLFMAG1		'O'
  ------------------
  |  Branch (1844:10): [True: 2.73k, False: 747]
  |  Branch (1844:37): [True: 15, False: 2.72k]
  ------------------
 1845|  7.39k|	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  159|  3.46k|#define	EI_MAG2		2
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  168|  10.8k|#define	ELFMAG2		'L'
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  160|  3.46k|#define	EI_MAG3		3
  ------------------
              	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  ------------------
  |  |  169|  3.46k|#define	ELFMAG3		'F'
  ------------------
  |  Branch (1845:9): [True: 9, False: 3.46k]
  |  Branch (1845:36): [True: 8, False: 3.45k]
  ------------------
 1846|  3.94k|		return 0;
 1847|       |
 1848|       |	/*
 1849|       |	 * If we cannot seek, it must be a pipe, socket or fifo.
 1850|       |	 */
 1851|  3.45k|	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  444|  3.45k|#define CAST(T, b)	((T)(b))
  ------------------
              	if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
  ------------------
  |  |  444|  3.45k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1851:5): [True: 0, False: 3.45k]
  ------------------
 1852|  3.45k|	    && (errno == ESPIPE))
  ------------------
  |  Branch (1852:9): [True: 0, False: 0]
  ------------------
 1853|      0|		fd = file_pipe2file(ms, fd, buf, nbytes);
 1854|       |
 1855|  3.45k|	if (fd == -1) {
  ------------------
  |  Branch (1855:6): [True: 0, False: 3.45k]
  ------------------
 1856|      0|		file_badread(ms);
 1857|      0|		return -1;
 1858|      0|	}
 1859|       |
 1860|  3.45k|	stp = &b->st;
 1861|       |	/*
 1862|       |	 * b->st.st_size != 0 if previous fstat() succeeded,
 1863|       |	 * which is likely, we can avoid extra stat() call.
 1864|       |	 */
 1865|  3.45k|	if (b->st.st_size == 0) {
  ------------------
  |  Branch (1865:6): [True: 0, False: 3.45k]
  ------------------
 1866|      0|		stp = &st;
 1867|      0|		if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (1867:7): [True: 0, False: 0]
  ------------------
 1868|      0|			file_badread(ms);
 1869|      0|			return -1;
 1870|      0|		}
 1871|      0|	}
 1872|  3.45k|	if (S_ISREG(stp->st_mode) || stp->st_size != 0)
  ------------------
  |  Branch (1872:31): [True: 0, False: 0]
  ------------------
 1873|  3.45k|		fsize = stp->st_size;
 1874|      0|	else
 1875|      0|		fsize = SIZE_UNKNOWN;
  ------------------
  |  |   63|      0|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1876|       |
 1877|  3.45k|	clazz = buf[EI_CLASS];
  ------------------
  |  |  161|  3.45k|#define	EI_CLASS	4
  ------------------
 1878|       |
 1879|  3.45k|	switch (clazz) {
 1880|  2.18k|	case ELFCLASS32:
  ------------------
  |  |  153|  2.18k|#define	ELFCLASS32	1
  ------------------
  |  Branch (1880:2): [True: 2.18k, False: 1.26k]
  ------------------
 1881|  2.18k|#undef elf_getu
 1882|  2.18k|#define elf_getu(a, b)	elf_getu32(a, b)
 1883|  2.18k|#undef elfhdr
 1884|  2.18k|#define elfhdr elf32hdr
 1885|  2.18k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  2.18k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1884|  2.18k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 14, False: 2.17k]
  |  |  ------------------
  |  |   28|     14|		return 0;
  |  |   29|       |
  |  |   30|  2.17k|	u.l = 1;
  |  |   31|  2.17k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1884|  2.17k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1884|  2.17k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |   32|  2.17k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1884|  2.17k|#define elfhdr elf32hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  2.17k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  2.17k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  140|  2.17k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  2.17k|	notecount = ms->elf_notes_max;
  |  |   36|  2.17k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|  1.30k|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|  1.30k|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 1.30k, False: 865]
  |  |  ------------------
  |  |   39|  1.30k|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  140|  1.30k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|  1.30k|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 18, False: 1.28k]
  |  |  ------------------
  |  |   41|     18|			return toomany(ms, "program headers", phnum);
  |  |   42|  1.28k|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  343|  1.28k|#define FLAGS_IS_CORE			0x0800
  |  |  ------------------
  |  |   43|  1.28k|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 1.28k]
  |  |  ------------------
  |  |   44|  1.28k|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  444|  1.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|  1.28k|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  444|  1.28k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|  1.28k|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|  1.28k|		break;
  |  |   49|  1.28k|#endif
  |  |   50|  1.28k|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    795|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 795, False: 1.37k]
  |  |  ------------------
  |  |   51|    851|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    851|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 56, False: 2.11k]
  |  |  ------------------
  |  |   52|    851|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  140|    851|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    851|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 15, False: 836]
  |  |  ------------------
  |  |   54|     15|			return toomany(ms, "program", phnum);
  |  |   55|    836|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  140|    836|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    836|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 10, False: 826]
  |  |  ------------------
  |  |   57|     10|			return toomany(ms, "section", shnum);
  |  |   58|    826|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 1, False: 825]
  |  |  ------------------
  |  |   59|    826|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  444|    826|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    826|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  444|    826|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    826|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      1|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|    836|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|    836|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 11, False: 2.16k]
  |  |  ------------------
  |  |   65|    836|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  140|    836|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|    836|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 7, False: 829]
  |  |  ------------------
  |  |   67|      7|			return toomany(ms, "section headers", shnum);
  |  |   68|    829|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 36, False: 793]
  |  |  ------------------
  |  |   69|    829|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  444|    829|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|    829|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  444|    829|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|    829|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  140|    829|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|    829|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  444|    829|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    829|		    &flags, &notecount) == -1)
  |  |   74|     36|			return -1;
  |  |   75|    793|		break;
  |  |   76|       |
  |  |   77|    793|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 3, False: 2.16k]
  |  |  ------------------
  |  |   78|      3|		break;
  |  |   79|  2.17k|	}
  |  |   80|  2.08k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 18, False: 2.06k]
  |  |  ------------------
  |  |   81|     18|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  2.06k|	return 1;
  ------------------
 1886|  1.25k|	case ELFCLASS64:
  ------------------
  |  |  154|  1.25k|#define	ELFCLASS64	2
  ------------------
  |  Branch (1886:2): [True: 1.25k, False: 2.19k]
  ------------------
 1887|  1.25k|#undef elf_getu
 1888|  1.25k|#define elf_getu(a, b)	elf_getu64(a, b)
 1889|  1.25k|#undef elfhdr
 1890|  1.25k|#define elfhdr elf64hdr
 1891|  1.25k|#include "elfclass.h"
  ------------------
  |  |    1|       |/*
  |  |    2|       | * Copyright (c) Christos Zoulas 2008.
  |  |    3|       | * All Rights Reserved.
  |  |    4|       | *
  |  |    5|       | * Redistribution and use in source and binary forms, with or without
  |  |    6|       | * modification, are permitted provided that the following conditions
  |  |    7|       | * are met:
  |  |    8|       | * 1. Redistributions of source code must retain the above copyright
  |  |    9|       | *    notice immediately at the beginning of the file, without modification,
  |  |   10|       | *    this list of conditions, and the following disclaimer.
  |  |   11|       | * 2. Redistributions in binary form must reproduce the above copyright
  |  |   12|       | *    notice, this list of conditions and the following disclaimer in the
  |  |   13|       | *    documentation and/or other materials provided with the distribution.
  |  |   14|       | *
  |  |   15|       | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  |  |   16|       | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  |  |   17|       | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  |  |   18|       | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  |  |   19|       | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  |  |   20|       | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  |  |   21|       | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  |  |   22|       | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  |  |   23|       | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  |  |   24|       | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  |  |   25|       | * SUCH DAMAGE.
  |  |   26|       | */
  |  |   27|  1.25k|	if (nbytes <= sizeof(elfhdr))
  |  |  ------------------
  |  |  |  | 1890|  1.25k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |  |  Branch (27:6): [True: 16, False: 1.24k]
  |  |  ------------------
  |  |   28|     16|		return 0;
  |  |   29|       |
  |  |   30|  1.24k|	u.l = 1;
  |  |   31|  1.24k|	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1890|  1.24k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	(void)memcpy(&elfhdr, buf, sizeof elfhdr);
  |  |  ------------------
  |  |  |  | 1890|  1.24k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |   32|  1.24k|	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  | 1890|  1.24k|#define elfhdr elf64hdr
  |  |  ------------------
  |  |               	swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
  |  |  ------------------
  |  |  |  |  162|  1.24k|#define	EI_DATA		5
  |  |  ------------------
  |  |   33|       |
  |  |   34|  1.24k|	type = elf_getu16(swap, elfhdr.e_type);
  |  |  ------------------
  |  |  |  |  140|  1.24k|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   35|  1.24k|	notecount = ms->elf_notes_max;
  |  |   36|  1.24k|	switch (type) {
  |  |   37|      0|#ifdef ELFCORE
  |  |   38|    429|	case ET_CORE:
  |  |  ------------------
  |  |  |  |  130|    429|#define	ET_CORE		4
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 429, False: 814]
  |  |  ------------------
  |  |   39|    429|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  140|    429|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   40|    429|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (40:7): [True: 18, False: 411]
  |  |  ------------------
  |  |   41|     18|			return toomany(ms, "program headers", phnum);
  |  |   42|    411|		flags |= FLAGS_IS_CORE;
  |  |  ------------------
  |  |  |  |  343|    411|#define FLAGS_IS_CORE			0x0800
  |  |  ------------------
  |  |   43|    411|		if (dophn_core(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 411]
  |  |  ------------------
  |  |   44|    411|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  444|    411|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   45|    411|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  444|    411|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   46|    411|		    fsize, &flags, &notecount) == -1)
  |  |   47|      0|			return -1;
  |  |   48|    411|		break;
  |  |   49|    411|#endif
  |  |   50|    432|	case ET_EXEC:
  |  |  ------------------
  |  |  |  |  128|    432|#define	ET_EXEC		2
  |  |  ------------------
  |  |  |  Branch (50:2): [True: 432, False: 811]
  |  |  ------------------
  |  |   51|    798|	case ET_DYN:
  |  |  ------------------
  |  |  |  |  129|    798|#define	ET_DYN		3
  |  |  ------------------
  |  |  |  Branch (51:2): [True: 366, False: 877]
  |  |  ------------------
  |  |   52|    798|		phnum = elf_getu16(swap, elfhdr.e_phnum);
  |  |  ------------------
  |  |  |  |  140|    798|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   53|    798|		if (phnum > ms->elf_phnum_max)
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 13, False: 785]
  |  |  ------------------
  |  |   54|     13|			return toomany(ms, "program", phnum);
  |  |   55|    785|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  140|    785|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   56|    785|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (56:7): [True: 12, False: 773]
  |  |  ------------------
  |  |   57|     12|			return toomany(ms, "section", shnum);
  |  |   58|    773|		if (dophn_exec(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (58:7): [True: 0, False: 773]
  |  |  ------------------
  |  |   59|    773|		    CAST(off_t, elf_getu(swap, elfhdr.e_phoff)), phnum,
  |  |  ------------------
  |  |  |  |  444|    773|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   60|    773|		    CAST(size_t, elf_getu16(swap, elfhdr.e_phentsize)),
  |  |  ------------------
  |  |  |  |  444|    773|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   61|    773|		    fsize, shnum, &flags, &notecount) == -1)
  |  |   62|      0|			return -1;
  |  |   63|       |		/*FALLTHROUGH*/
  |  |   64|    786|	case ET_REL:
  |  |  ------------------
  |  |  |  |  127|    786|#define	ET_REL		1
  |  |  ------------------
  |  |  |  Branch (64:2): [True: 13, False: 1.23k]
  |  |  ------------------
  |  |   65|    786|		shnum = elf_getu16(swap, elfhdr.e_shnum);
  |  |  ------------------
  |  |  |  |  140|    786|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   66|    786|		if (shnum > ms->elf_shnum_max)
  |  |  ------------------
  |  |  |  Branch (66:7): [True: 11, False: 775]
  |  |  ------------------
  |  |   67|     11|			return toomany(ms, "section headers", shnum);
  |  |   68|    775|		if (doshn(ms, clazz, swap, fd,
  |  |  ------------------
  |  |  |  Branch (68:7): [True: 58, False: 717]
  |  |  ------------------
  |  |   69|    775|		    CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
  |  |  ------------------
  |  |  |  |  444|    775|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   70|    775|		    CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
  |  |  ------------------
  |  |  |  |  444|    775|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   71|    775|		    fsize, elf_getu16(swap, elfhdr.e_machine),
  |  |  ------------------
  |  |  |  |  140|    775|#define elf_getu16(swap, value) getu16(swap, value)
  |  |  ------------------
  |  |   72|    775|		    CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  |  |  ------------------
  |  |  |  |  444|    775|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   73|    775|		    &flags, &notecount) == -1)
  |  |   74|     58|			return -1;
  |  |   75|    717|		break;
  |  |   76|       |
  |  |   77|    717|	default:
  |  |  ------------------
  |  |  |  Branch (77:2): [True: 3, False: 1.24k]
  |  |  ------------------
  |  |   78|      3|		break;
  |  |   79|  1.24k|	}
  |  |   80|  1.13k|	if (notecount == 0)
  |  |  ------------------
  |  |  |  Branch (80:6): [True: 1, False: 1.13k]
  |  |  ------------------
  |  |   81|      1|		return toomany(ms, "notes", ms->elf_notes_max);
  |  |   82|  1.13k|	return 1;
  ------------------
 1892|      7|	default:
  ------------------
  |  Branch (1892:2): [True: 7, False: 3.44k]
  ------------------
 1893|      7|	    if (file_printf(ms, ", unknown class %d", clazz) == -1)
  ------------------
  |  Branch (1893:10): [True: 0, False: 7]
  ------------------
 1894|      0|		    return -1;
 1895|      7|	    break;
 1896|  3.45k|	}
 1897|      7|	return 0;
 1898|  3.45k|}
readelf.c:getu16:
   77|  18.1k|{
   78|  18.1k|	union {
   79|  18.1k|		uint16_t ui;
   80|  18.1k|		char c[2];
   81|  18.1k|	} retval, tmpval;
   82|       |
   83|  18.1k|	if (swap) {
  ------------------
  |  Branch (83:6): [True: 8.07k, False: 10.0k]
  ------------------
   84|  8.07k|		tmpval.ui = value;
   85|       |
   86|  8.07k|		retval.c[0] = tmpval.c[1];
   87|  8.07k|		retval.c[1] = tmpval.c[0];
   88|       |
   89|  8.07k|		return retval.ui;
   90|  8.07k|	} else
   91|  10.0k|		return value;
   92|  18.1k|}
readelf.c:toomany:
   67|    123|{
   68|    123|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    123|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    123|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    123|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (68:6): [True: 0, False: 123]
  ------------------
   69|      0|		return 1;
   70|    123|	if (file_printf(ms, ", too many %s (%u)", name, num) == -1)
  ------------------
  |  Branch (70:6): [True: 0, False: 123]
  ------------------
   71|      0|		return -1;
   72|    123|	return 1;
   73|    123|}
readelf.c:dophn_core:
  349|  1.70k|{
  350|  1.70k|	Elf32_Phdr ph32;
  351|  1.70k|	Elf64_Phdr ph64;
  352|  1.70k|	size_t offset, len;
  353|  1.70k|	unsigned char nbuf[BUFSIZ];
  354|  1.70k|	ssize_t bufsize;
  355|  1.70k|	off_t ph_off = off, offs;
  356|  1.70k|	int ph_num = num;
  357|       |
  358|  1.70k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.70k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.70k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.70k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (358:6): [True: 0, False: 1.70k]
  ------------------
  359|      0|		return 0;
  360|       |
  361|  1.70k|	if (num == 0) {
  ------------------
  |  Branch (361:6): [True: 2, False: 1.69k]
  ------------------
  362|      2|		if (file_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (362:7): [True: 0, False: 2]
  ------------------
  363|      0|			return -1;
  364|      2|		return 0;
  365|      2|	}
  366|  1.69k|	if (size != xph_sizeof) {
  ------------------
  |  |  166|  1.69k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.69k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:21): [True: 1.28k, False: 411]
  |  |  ------------------
  |  |  167|  1.69k|			 ? sizeof(ph32)				\
  |  |  168|  1.69k|			 : sizeof(ph64))
  ------------------
  |  Branch (366:6): [True: 24, False: 1.67k]
  ------------------
  367|     24|		if (file_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (367:7): [True: 0, False: 24]
  ------------------
  368|      0|			return -1;
  369|     24|		return 0;
  370|     24|	}
  371|       |
  372|       |	/*
  373|       |	 * Loop through all the program headers.
  374|       |	 */
  375|  23.0k|	for ( ; num; num--) {
  ------------------
  |  Branch (375:10): [True: 23.0k, False: 81]
  ------------------
  376|  23.0k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  163|  23.0k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (163:19): [True: 14.8k, False: 8.18k]
  |  |  ------------------
  |  |  164|  23.0k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  444|  14.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  165|  23.0k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  444|  8.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  166|  23.0k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  23.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:21): [True: 14.8k, False: 8.18k]
  |  |  ------------------
  |  |  167|  23.0k|			 ? sizeof(ph32)				\
  |  |  168|  23.0k|			 : sizeof(ph64))
  ------------------
  |  Branch (376:7): [True: 1.57k, False: 21.4k]
  ------------------
  377|  23.0k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  444|  46.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 14.8k, False: 8.18k]
  |  |  ------------------
  ------------------
  378|  1.57k|			if (file_printf(ms, 
  ------------------
  |  Branch (378:8): [True: 0, False: 1.57k]
  ------------------
  379|  1.57k|			    ", can't read elf program headers at %jd",
  380|  1.57k|			    (intmax_t)off) == -1)
  381|      0|				return -1;
  382|  1.57k|			return 0;
  383|  1.57k|		}
  384|  21.4k|		off += size;
  385|       |
  386|  21.4k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   63|  21.4k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  444|  42.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  172|  21.4k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  42.8k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 13.5k, False: 7.85k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  173|  21.4k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  174|  21.4k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (386:7): [True: 21.4k, False: 0]
  |  Branch (386:32): [True: 10.7k, False: 10.6k]
  ------------------
  387|       |			/* Perhaps warn here */
  388|  10.7k|			continue;
  389|  10.7k|		}
  390|       |
  391|  10.6k|		if (xph_type != PT_NOTE)
  ------------------
  |  |  169|  10.6k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  10.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:19): [True: 7.53k, False: 3.15k]
  |  |  ------------------
  |  |  170|  10.6k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  141|  7.53k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  171|  10.6k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  141|  3.15k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
              		if (xph_type != PT_NOTE)
  ------------------
  |  |  201|  10.6k|#define	PT_NOTE		4
  ------------------
  |  Branch (391:7): [True: 5.96k, False: 4.73k]
  ------------------
  392|  5.96k|			continue;
  393|       |
  394|       |		/*
  395|       |		 * This is a PT_NOTE section; loop through all the notes
  396|       |		 * in the section.
  397|       |		 */
  398|  4.73k|		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  185|  4.73k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  9.46k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 3.93k, False: 792]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  186|  4.73k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  187|  4.73k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              		len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
  ------------------
  |  |  185|    836|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  1.67k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 763, False: 73]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  186|  4.73k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  187|  4.73k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (398:9): [True: 836, False: 3.89k]
  ------------------
  399|  4.73k|		offs = xph_offset;
  ------------------
  |  |  172|  4.73k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  9.46k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 3.93k, False: 792]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  173|  4.73k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  174|  4.73k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  400|  4.73k|		if ((bufsize = pread(fd, nbuf, len, offs)) == -1) {
  ------------------
  |  Branch (400:7): [True: 23, False: 4.70k]
  ------------------
  401|     23|			if (file_printf(ms, " can't read note section at %jd",
  ------------------
  |  Branch (401:8): [True: 0, False: 23]
  ------------------
  402|     23|			    (intmax_t)offs) == -1)
  403|      0|				return -1;
  404|     23|			return 0;
  405|     23|		}
  406|  4.70k|		offset = 0;
  407|  22.3k|		for (;;) {
  408|  22.3k|			if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  444|  22.3k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (408:8): [True: 3.16k, False: 19.2k]
  ------------------
  409|  3.16k|				break;
  410|  19.2k|			offset = donote(ms, nbuf, offset, CAST(size_t, bufsize),
  ------------------
  |  |  444|  19.2k|#define CAST(T, b)	((T)(b))
  ------------------
  411|  19.2k|			    clazz, swap, 4, flags, notecount, fd, ph_off,
  412|  19.2k|			    ph_num, fsize);
  413|  19.2k|			if (offset == 0)
  ------------------
  |  Branch (413:8): [True: 1.53k, False: 17.6k]
  ------------------
  414|  1.53k|				break;
  415|       |
  416|  19.2k|		}
  417|  4.70k|	}
  418|     81|	return 0;
  419|  1.67k|}
readelf.c:donote:
 1159|  25.4k|{
 1160|  25.4k|	Elf32_Nhdr nh32;
 1161|  25.4k|	Elf64_Nhdr nh64;
 1162|  25.4k|	size_t noff, doff;
 1163|  25.4k|	uint32_t namesz, descsz;
 1164|  25.4k|	char buf[256];
 1165|  25.4k|	unsigned char *nbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  444|  25.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1166|       |
 1167|  25.4k|	if (*notecount == 0)
  ------------------
  |  Branch (1167:6): [True: 821, False: 24.6k]
  ------------------
 1168|    821|		return 0;
 1169|  24.6k|	--*notecount;
 1170|       |
 1171|  24.6k|	if (xnh_sizeof + offset > size) {
  ------------------
  |  |  194|  24.6k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  24.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (194:21): [True: 21.8k, False: 2.76k]
  |  |  ------------------
  |  |  195|  24.6k|			 ? sizeof(nh32)				\
  |  |  196|  24.6k|			 : sizeof(nh64))
  ------------------
  |  Branch (1171:6): [True: 2.05k, False: 22.5k]
  ------------------
 1172|       |		/*
 1173|       |		 * We're out of note headers.
 1174|       |		 */
 1175|  2.05k|		return xnh_sizeof + offset;
  ------------------
  |  |  194|  2.05k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.05k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (194:21): [True: 1.96k, False: 86]
  |  |  ------------------
  |  |  195|  2.05k|			 ? sizeof(nh32)				\
  |  |  196|  2.05k|			 : sizeof(nh64))
  ------------------
 1176|  2.05k|	}
 1177|       |	/*XXX: GCC */
 1178|  22.5k|	memset(&nh32, 0, sizeof(nh32));
 1179|  22.5k|	memset(&nh64, 0, sizeof(nh64));
 1180|       |
 1181|  22.5k|	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  191|  22.5k|#define xnh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (191:19): [True: 19.8k, False: 2.68k]
  |  |  ------------------
  |  |  192|  22.5k|			 ? CAST(void *, &nh32)			\
  |  |  ------------------
  |  |  |  |  444|  19.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  193|  22.5k|			 : CAST(void *, &nh64))
  |  |  ------------------
  |  |  |  |  444|  2.68k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
  ------------------
  |  |  194|  22.5k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (194:21): [True: 19.8k, False: 2.68k]
  |  |  ------------------
  |  |  195|  22.5k|			 ? sizeof(nh32)				\
  |  |  196|  22.5k|			 : sizeof(nh64))
  ------------------
 1182|  22.5k|	offset += xnh_sizeof;
  ------------------
  |  |  194|  22.5k|#define xnh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (194:21): [True: 19.8k, False: 2.68k]
  |  |  ------------------
  |  |  195|  22.5k|			 ? sizeof(nh32)				\
  |  |  196|  22.5k|			 : sizeof(nh64))
  ------------------
 1183|       |
 1184|  22.5k|	namesz = xnh_namesz;
  ------------------
  |  |  200|  22.5k|#define xnh_namesz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (200:21): [True: 19.8k, False: 2.68k]
  |  |  ------------------
  |  |  201|  22.5k|			 ? elf_getu32(swap, nh32.n_namesz)	\
  |  |  ------------------
  |  |  |  |  141|  19.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  202|  22.5k|			 : elf_getu32(swap, nh64.n_namesz))
  |  |  ------------------
  |  |  |  |  141|  2.68k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1185|  22.5k|	descsz = xnh_descsz;
  ------------------
  |  |  203|  22.5k|#define xnh_descsz	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.5k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (203:21): [True: 19.8k, False: 2.68k]
  |  |  ------------------
  |  |  204|  22.5k|			 ? elf_getu32(swap, nh32.n_descsz)	\
  |  |  ------------------
  |  |  |  |  141|  19.8k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  205|  22.5k|			 : elf_getu32(swap, nh64.n_descsz))
  |  |  ------------------
  |  |  |  |  141|  2.68k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1186|       |
 1187|  22.5k|	if ((namesz == 0) && (descsz == 0)) {
  ------------------
  |  Branch (1187:6): [True: 2.93k, False: 19.6k]
  |  Branch (1187:23): [True: 159, False: 2.77k]
  ------------------
 1188|       |		/*
 1189|       |		 * We're out of note headers.
 1190|       |		 */
 1191|    159|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1191:10): [True: 36, False: 123]
  ------------------
 1192|    159|	}
 1193|       |
 1194|  22.3k|	if (namesz & 0x80000000) {
  ------------------
  |  Branch (1194:6): [True: 709, False: 21.6k]
  ------------------
 1195|    709|	    (void)file_printf(ms, ", bad note name size %#lx",
 1196|    709|		CAST(unsigned long, namesz));
  ------------------
  |  |  444|    709|#define CAST(T, b)	((T)(b))
  ------------------
 1197|    709|	    return 0;
 1198|    709|	}
 1199|       |
 1200|  21.6k|	if (descsz & 0x80000000) {
  ------------------
  |  Branch (1200:6): [True: 743, False: 20.9k]
  ------------------
 1201|    743|		(void)file_printf(ms, ", bad note description size %#lx",
 1202|    743|		    CAST(unsigned long, descsz));
  ------------------
  |  |  444|    743|#define CAST(T, b)	((T)(b))
  ------------------
 1203|    743|		return 0;
 1204|    743|	}
 1205|       |
 1206|  20.9k|	noff = offset;
 1207|  20.9k|	doff = ELF_ALIGN(offset + namesz);
  ------------------
  |  |   55|  20.9k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1208|       |
 1209|  20.9k|	if (offset + namesz > size) {
  ------------------
  |  Branch (1209:6): [True: 1.99k, False: 18.9k]
  ------------------
 1210|       |		/*
 1211|       |		 * We're past the end of the buffer.
 1212|       |		 */
 1213|  1.99k|		return doff;
 1214|  1.99k|	}
 1215|       |
 1216|  18.9k|	offset = ELF_ALIGN(doff + descsz);
  ------------------
  |  |   55|  18.9k|#define	ELF_ALIGN(a)	((((a) + align - 1) / align) * align)
  ------------------
 1217|  18.9k|	if (doff + descsz > size) {
  ------------------
  |  Branch (1217:6): [True: 1.04k, False: 17.8k]
  ------------------
 1218|       |		/*
 1219|       |		 * We're past the end of the buffer.
 1220|       |		 */
 1221|  1.04k|		return (offset >= size) ? offset : size;
  ------------------
  |  Branch (1221:10): [True: 940, False: 107]
  ------------------
 1222|  1.04k|	}
 1223|       |
 1224|       |
 1225|  17.8k|	if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
  ------------------
  |  |  335|  17.8k|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  |  Branch (1225:6): [True: 17.6k, False: 221]
  ------------------
 1226|  17.6k|		if (do_os_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  197|  17.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  17.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 16.2k, False: 1.38k]
  |  |  ------------------
  |  |  198|  17.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|  16.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|  17.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|  1.38k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1226:7): [True: 96, False: 17.5k]
  ------------------
 1227|  17.6k|		    namesz, descsz, noff, doff, flags))
 1228|     96|			return offset;
 1229|  17.6k|	}
 1230|       |
 1231|  17.7k|	if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
  ------------------
  |  |  336|  17.7k|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  |  Branch (1231:6): [True: 16.8k, False: 935]
  ------------------
 1232|  16.8k|		if (do_bid_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  197|  16.8k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  16.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 15.4k, False: 1.38k]
  |  |  ------------------
  |  |  198|  16.8k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|  15.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|  16.8k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|  1.38k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1232:7): [True: 470, False: 16.3k]
  ------------------
 1233|  16.8k|		    namesz, descsz, noff, doff, flags))
 1234|    470|			return offset;
 1235|  16.8k|	}
 1236|       |
 1237|  17.3k|	if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
  ------------------
  |  |  338|  17.3k|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  |  Branch (1237:6): [True: 17.3k, False: 19]
  ------------------
 1238|  17.3k|		if (do_pax_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  197|  17.3k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  17.3k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 15.9k, False: 1.38k]
  |  |  ------------------
  |  |  198|  17.3k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|  15.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|  17.3k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|  1.38k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1238:7): [True: 32, False: 17.2k]
  ------------------
 1239|  17.3k|		    namesz, descsz, noff, doff, flags))
 1240|     32|			return offset;
 1241|  17.3k|	}
 1242|       |
 1243|  17.2k|	if ((*flags & FLAGS_DID_CORE) == 0) {
  ------------------
  |  |  334|  17.2k|#define FLAGS_DID_CORE			0x0004
  ------------------
  |  Branch (1243:6): [True: 15.8k, False: 1.41k]
  ------------------
 1244|  15.8k|		if (do_core_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  197|  15.8k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  15.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 14.5k, False: 1.37k]
  |  |  ------------------
  |  |  198|  15.8k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|  14.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|  15.8k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|  1.37k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1244:7): [True: 85, False: 15.7k]
  ------------------
 1245|  15.8k|		    namesz, descsz, noff, doff, flags, size, clazz))
 1246|     85|			return offset;
 1247|  15.8k|	}
 1248|       |
 1249|  17.2k|	if ((*flags & FLAGS_DID_AUXV) == 0) {
  ------------------
  |  |  344|  17.2k|#define FLAGS_DID_AUXV			0x1000
  ------------------
  |  Branch (1249:6): [True: 16.6k, False: 566]
  ------------------
 1250|  16.6k|		if (do_auxv_note(ms, nbuf, xnh_type, swap,
  ------------------
  |  |  197|  16.6k|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  16.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 15.3k, False: 1.28k]
  |  |  ------------------
  |  |  198|  16.6k|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|  15.3k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|  16.6k|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|  1.28k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1250:7): [True: 478, False: 16.1k]
  ------------------
 1251|  16.6k|			namesz, descsz, noff, doff, flags, size, clazz,
 1252|  16.6k|			fd, ph_off, ph_num, fsize))
 1253|    478|			return offset;
 1254|  16.6k|	}
 1255|       |
 1256|  16.7k|	if (namesz == 7 && strcmp(RCAST(char *, &nbuf[noff]), "NetBSD") == 0) {
  ------------------
  |  |  445|    698|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (1256:6): [True: 698, False: 16.0k]
  |  Branch (1256:21): [True: 566, False: 132]
  ------------------
 1257|    566|		int descw, flag;
 1258|    566|		const char *str, *tag;
 1259|    566|		if (descsz > 100)
  ------------------
  |  Branch (1259:7): [True: 90, False: 476]
  ------------------
 1260|     90|			descsz = 100;
 1261|    566|		switch (xnh_type) {
  ------------------
  |  |  197|    566|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    566|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 501, False: 65]
  |  |  ------------------
  |  |  198|    566|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|    501|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|    566|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|     65|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1262|     42|	    	case NT_NETBSD_VERSION:
  ------------------
  |  |  285|     42|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (1262:7): [True: 42, False: 524]
  ------------------
 1263|     42|			return offset;
 1264|     49|		case NT_NETBSD_MARCH:
  ------------------
  |  |  346|     49|#define NT_NETBSD_MARCH		5
  ------------------
  |  Branch (1264:3): [True: 49, False: 517]
  ------------------
 1265|     49|			flag = FLAGS_DID_NETBSD_MARCH;
  ------------------
  |  |  339|     49|#define FLAGS_DID_NETBSD_MARCH		0x0080
  ------------------
 1266|     49|			tag = "compiled for";
 1267|     49|			break;
 1268|     37|		case NT_NETBSD_CMODEL:
  ------------------
  |  |  356|     37|#define NT_NETBSD_CMODEL	6
  ------------------
  |  Branch (1268:3): [True: 37, False: 529]
  ------------------
 1269|     37|			flag = FLAGS_DID_NETBSD_CMODEL;
  ------------------
  |  |  340|     37|#define FLAGS_DID_NETBSD_CMODEL		0x0100
  ------------------
 1270|     37|			tag = "compiler model";
 1271|     37|			break;
 1272|    218|		case NT_NETBSD_EMULATION:
  ------------------
  |  |  286|    218|#define	NT_NETBSD_EMULATION	2
  ------------------
  |  Branch (1272:3): [True: 218, False: 348]
  ------------------
 1273|    218|			flag = FLAGS_DID_NETBSD_EMULATION;
  ------------------
  |  |  341|    218|#define FLAGS_DID_NETBSD_EMULATION	0x0200
  ------------------
 1274|    218|			tag = "emulation:";
 1275|    218|			break;
 1276|    220|		default:
  ------------------
  |  Branch (1276:3): [True: 220, False: 346]
  ------------------
 1277|    220|			if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  ------------------
  |  |  342|    220|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
  |  Branch (1277:8): [True: 176, False: 44]
  ------------------
 1278|    176|				return offset;
 1279|     44|			*flags |= FLAGS_DID_NETBSD_UNKNOWN;
  ------------------
  |  |  342|     44|#define FLAGS_DID_NETBSD_UNKNOWN	0x0400
  ------------------
 1280|     44|			if (file_printf(ms, ", note=%u", xnh_type) == -1)
  ------------------
  |  |  197|     44|#define xnh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|     44|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (197:19): [True: 39, False: 5]
  |  |  ------------------
  |  |  198|     44|			 ? elf_getu32(swap, nh32.n_type)	\
  |  |  ------------------
  |  |  |  |  141|     39|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  199|     44|			 : elf_getu32(swap, nh64.n_type))
  |  |  ------------------
  |  |  |  |  141|      5|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
  |  Branch (1280:8): [True: 0, False: 44]
  ------------------
 1281|      0|				return offset;
 1282|     44|			return offset;
 1283|    566|		}
 1284|       |
 1285|    304|		if (*flags & flag)
  ------------------
  |  Branch (1285:7): [True: 277, False: 27]
  ------------------
 1286|    277|			return offset;
 1287|     27|		str = RCAST(const char *, &nbuf[doff]);
  ------------------
  |  |  445|     27|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1288|     27|		descw = CAST(int, descsz);
  ------------------
  |  |  444|     27|#define CAST(T, b)	((T)(b))
  ------------------
 1289|     27|		*flags |= flag;
 1290|     27|		file_printf(ms, ", %s: %s", tag,
 1291|     27|		    file_copystr(buf, sizeof(buf), descw, str));
 1292|     27|		return offset;
 1293|    304|	}
 1294|       |
 1295|  16.1k|	return offset;
 1296|  16.7k|}
readelf.c:do_os_note:
  597|  17.6k|{
  598|  17.6k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  445|  17.6k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  599|       |
  600|  17.6k|	if (namesz == 5 && strcmp(name, "SuSE") == 0 &&
  ------------------
  |  Branch (600:6): [True: 593, False: 17.0k]
  |  Branch (600:21): [True: 159, False: 434]
  ------------------
  601|  17.6k|		type == NT_GNU_VERSION && descsz == 2) {
  ------------------
  |  |  297|  17.8k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (601:3): [True: 79, False: 80]
  |  Branch (601:29): [True: 2, False: 77]
  ------------------
  602|      2|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  335|      2|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  603|      2|		if (file_printf(ms, ", for SuSE %d.%d", nbuf[doff],
  ------------------
  |  Branch (603:7): [True: 0, False: 2]
  ------------------
  604|      2|		    nbuf[doff + 1]) == -1)
  605|      0|		    return -1;
  606|      2|	    return 1;
  607|      2|	}
  608|       |
  609|  17.6k|	if (namesz == 4 && strcmp(name, "GNU") == 0 &&
  ------------------
  |  Branch (609:6): [True: 11.6k, False: 5.98k]
  |  Branch (609:21): [True: 1.26k, False: 10.4k]
  ------------------
  610|  17.6k|	    type == NT_GNU_VERSION && descsz == 16) {
  ------------------
  |  |  297|  18.9k|#define	NT_GNU_VERSION		1
  ------------------
  |  Branch (610:6): [True: 323, False: 942]
  |  Branch (610:32): [True: 8, False: 315]
  ------------------
  611|      8|		uint32_t desc[4];
  612|      8|		memcpy(desc, &nbuf[doff], sizeof(desc));
  613|       |
  614|      8|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  335|      8|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  615|      8|		if (file_printf(ms, ", for GNU/") == -1)
  ------------------
  |  Branch (615:7): [True: 0, False: 8]
  ------------------
  616|      0|			return -1;
  617|      8|		switch (elf_getu32(swap, desc[0])) {
  ------------------
  |  |  141|      8|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  618|      1|		case GNU_OS_LINUX:
  ------------------
  |  |  300|      1|#define	GNU_OS_LINUX	0
  ------------------
  |  Branch (618:3): [True: 1, False: 7]
  ------------------
  619|      1|			if (file_printf(ms, "Linux") == -1)
  ------------------
  |  Branch (619:8): [True: 0, False: 1]
  ------------------
  620|      0|				return -1;
  621|      1|			break;
  622|      1|		case GNU_OS_HURD:
  ------------------
  |  |  301|      1|#define	GNU_OS_HURD	1
  ------------------
  |  Branch (622:3): [True: 1, False: 7]
  ------------------
  623|      1|			if (file_printf(ms, "Hurd") == -1)
  ------------------
  |  Branch (623:8): [True: 0, False: 1]
  ------------------
  624|      0|				return -1;
  625|      1|			break;
  626|      1|		case GNU_OS_SOLARIS:
  ------------------
  |  |  302|      1|#define	GNU_OS_SOLARIS	2
  ------------------
  |  Branch (626:3): [True: 1, False: 7]
  ------------------
  627|      1|			if (file_printf(ms, "Solaris") == -1)
  ------------------
  |  Branch (627:8): [True: 0, False: 1]
  ------------------
  628|      0|				return -1;
  629|      1|			break;
  630|      1|		case GNU_OS_KFREEBSD:
  ------------------
  |  |  303|      0|#define	GNU_OS_KFREEBSD	3
  ------------------
  |  Branch (630:3): [True: 0, False: 8]
  ------------------
  631|      0|			if (file_printf(ms, "kFreeBSD") == -1)
  ------------------
  |  Branch (631:8): [True: 0, False: 0]
  ------------------
  632|      0|				return -1;
  633|      0|			break;
  634|      0|		case GNU_OS_KNETBSD:
  ------------------
  |  |  304|      0|#define	GNU_OS_KNETBSD	4
  ------------------
  |  Branch (634:3): [True: 0, False: 8]
  ------------------
  635|      0|			if (file_printf(ms, "kNetBSD") == -1)
  ------------------
  |  Branch (635:8): [True: 0, False: 0]
  ------------------
  636|      0|				return -1;
  637|      0|			break;
  638|      5|		default:
  ------------------
  |  Branch (638:3): [True: 5, False: 3]
  ------------------
  639|      5|			if (file_printf(ms, "<unknown>") == -1)
  ------------------
  |  Branch (639:8): [True: 0, False: 5]
  ------------------
  640|      0|				return -1;
  641|      8|		}
  642|      8|		if (file_printf(ms, " %d.%d.%d", elf_getu32(swap, desc[1]),
  ------------------
  |  |  141|      8|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  |  Branch (642:7): [True: 0, False: 8]
  ------------------
  643|      8|		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  141|      8|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
              		    elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1)
  ------------------
  |  |  141|      8|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  644|      0|			return -1;
  645|      8|		return 1;
  646|      8|	}
  647|       |
  648|  17.6k|	if (namesz == 7 && strcmp(name, "NetBSD") == 0) {
  ------------------
  |  Branch (648:6): [True: 738, False: 16.9k]
  |  Branch (648:21): [True: 606, False: 132]
  ------------------
  649|    606|	    	if (type == NT_NETBSD_VERSION && descsz == 4) {
  ------------------
  |  |  285|  1.21k|#define	NT_NETBSD_VERSION	1
  ------------------
  |  Branch (649:11): [True: 78, False: 528]
  |  Branch (649:40): [True: 36, False: 42]
  ------------------
  650|     36|			*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  335|     36|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  651|     36|			if (do_note_netbsd_version(ms, swap, &nbuf[doff]) == -1)
  ------------------
  |  Branch (651:8): [True: 0, False: 36]
  ------------------
  652|      0|				return -1;
  653|     36|			return 1;
  654|     36|		}
  655|    606|	}
  656|       |
  657|  17.6k|	if (namesz == 8 && strcmp(name, "FreeBSD") == 0) {
  ------------------
  |  Branch (657:6): [True: 746, False: 16.8k]
  |  Branch (657:21): [True: 363, False: 383]
  ------------------
  658|    363|	    	if (type == NT_FREEBSD_VERSION && descsz == 4) {
  ------------------
  |  |  287|    726|#define	NT_FREEBSD_VERSION	1
  ------------------
  |  Branch (658:11): [True: 160, False: 203]
  |  Branch (658:41): [True: 49, False: 111]
  ------------------
  659|     49|			*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  335|     49|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  660|     49|			if (do_note_freebsd_version(ms, swap, &nbuf[doff])
  ------------------
  |  Branch (660:8): [True: 0, False: 49]
  ------------------
  661|     49|			    == -1)
  662|      0|				return -1;
  663|     49|			return 1;
  664|     49|		}
  665|    363|	}
  666|       |
  667|  17.5k|	if (namesz == 8 && strcmp(name, "OpenBSD") == 0 &&
  ------------------
  |  Branch (667:6): [True: 697, False: 16.8k]
  |  Branch (667:21): [True: 235, False: 462]
  ------------------
  668|  17.5k|	    type == NT_OPENBSD_VERSION && descsz == 4) {
  ------------------
  |  |  288|  17.8k|#define	NT_OPENBSD_VERSION	1
  ------------------
  |  Branch (668:6): [True: 107, False: 128]
  |  Branch (668:36): [True: 1, False: 106]
  ------------------
  669|      1|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  335|      1|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  670|      1|		if (file_printf(ms, ", for OpenBSD") == -1)
  ------------------
  |  Branch (670:7): [True: 0, False: 1]
  ------------------
  671|      0|			return -1;
  672|       |		/* Content of note is always 0 */
  673|      1|		return 1;
  674|      1|	}
  675|       |
  676|  17.5k|	if (namesz == 10 && strcmp(name, "DragonFly") == 0 &&
  ------------------
  |  Branch (676:6): [True: 248, False: 17.3k]
  |  Branch (676:22): [True: 115, False: 133]
  ------------------
  677|  17.5k|	    type == NT_DRAGONFLY_VERSION && descsz == 4) {
  ------------------
  |  |  289|  17.6k|#define	NT_DRAGONFLY_VERSION	1
  ------------------
  |  Branch (677:6): [True: 65, False: 50]
  |  Branch (677:38): [True: 0, False: 65]
  ------------------
  678|      0|		uint32_t desc;
  679|      0|		*flags |= FLAGS_DID_OS_NOTE;
  ------------------
  |  |  335|      0|#define FLAGS_DID_OS_NOTE		0x0008
  ------------------
  680|      0|		if (file_printf(ms, ", for DragonFly") == -1)
  ------------------
  |  Branch (680:7): [True: 0, False: 0]
  ------------------
  681|      0|			return -1;
  682|      0|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  683|      0|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  141|      0|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  684|      0|		if (file_printf(ms, " %d.%d.%d", desc / 100000,
  ------------------
  |  Branch (684:7): [True: 0, False: 0]
  ------------------
  685|      0|		    desc / 10000 % 10, desc % 10000) == -1)
  686|      0|			return -1;
  687|      0|		return 1;
  688|      0|	}
  689|  17.5k|	return 0;
  690|  17.5k|}
readelf.c:do_note_netbsd_version:
  424|     36|{
  425|     36|	uint32_t desc;
  426|     36|	memcpy(&desc, v, sizeof(desc));
  427|     36|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  141|     36|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  428|       |
  429|     36|	if (file_printf(ms, ", for NetBSD") == -1)
  ------------------
  |  Branch (429:6): [True: 0, False: 36]
  ------------------
  430|      0|		return -1;
  431|       |	/*
  432|       |	 * The version number used to be stuck as 199905, and was thus
  433|       |	 * basically content-free.  Newer versions of NetBSD have fixed
  434|       |	 * this and now use the encoding of __NetBSD_Version__:
  435|       |	 *
  436|       |	 *	MMmmrrpp00
  437|       |	 *
  438|       |	 * M = major version
  439|       |	 * m = minor version
  440|       |	 * r = release ["",A-Z,Z[A-Z] but numeric]
  441|       |	 * p = patchlevel
  442|       |	 */
  443|     36|	if (desc > 100000000U) {
  ------------------
  |  Branch (443:6): [True: 30, False: 6]
  ------------------
  444|     30|		uint32_t ver_patch = (desc / 100) % 100;
  445|     30|		uint32_t ver_rel = (desc / 10000) % 100;
  446|     30|		uint32_t ver_min = (desc / 1000000) % 100;
  447|     30|		uint32_t ver_maj = desc / 100000000;
  448|       |
  449|     30|		if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
  ------------------
  |  Branch (449:7): [True: 0, False: 30]
  ------------------
  450|      0|			return -1;
  451|     30|		if (ver_maj >= 9) {
  ------------------
  |  Branch (451:7): [True: 13, False: 17]
  ------------------
  452|     13|			ver_patch += 100 * ver_rel;
  453|     13|			ver_rel = 0;
  454|     13|		}
  455|     30|		if (ver_rel == 0 && ver_patch != 0) {
  ------------------
  |  Branch (455:7): [True: 13, False: 17]
  |  Branch (455:23): [True: 12, False: 1]
  ------------------
  456|     12|			if (file_printf(ms, ".%u", ver_patch) == -1)
  ------------------
  |  Branch (456:8): [True: 0, False: 12]
  ------------------
  457|      0|				return -1;
  458|     18|		} else if (ver_rel != 0) {
  ------------------
  |  Branch (458:14): [True: 17, False: 1]
  ------------------
  459|     46|			while (ver_rel > 26) {
  ------------------
  |  Branch (459:11): [True: 29, False: 17]
  ------------------
  460|     29|				if (file_printf(ms, "Z") == -1)
  ------------------
  |  Branch (460:9): [True: 0, False: 29]
  ------------------
  461|      0|					return -1;
  462|     29|				ver_rel -= 26;
  463|     29|			}
  464|     17|			if (file_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
  ------------------
  |  Branch (464:8): [True: 0, False: 17]
  ------------------
  465|      0|				return -1;
  466|     17|		}
  467|     30|	}
  468|     36|	return 0;
  469|     36|}
readelf.c:do_note_freebsd_version:
  473|     49|{
  474|     49|	uint32_t desc;
  475|       |
  476|     49|	memcpy(&desc, v, sizeof(desc));
  477|     49|	desc = elf_getu32(swap, desc);
  ------------------
  |  |  141|     49|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  478|     49|	if (file_printf(ms, ", for FreeBSD") == -1)
  ------------------
  |  Branch (478:6): [True: 0, False: 49]
  ------------------
  479|      0|		return -1;
  480|       |
  481|       |	/*
  482|       |	 * Contents is __FreeBSD_version, whose relation to OS
  483|       |	 * versions is defined by a huge table in the Porter's
  484|       |	 * Handbook.  This is the general scheme:
  485|       |	 *
  486|       |	 * Releases:
  487|       |	 * 	Mmp000 (before 4.10)
  488|       |	 * 	Mmi0p0 (before 5.0)
  489|       |	 * 	Mmm0p0
  490|       |	 *
  491|       |	 * Development branches:
  492|       |	 * 	Mmpxxx (before 4.6)
  493|       |	 * 	Mmp1xx (before 4.10)
  494|       |	 * 	Mmi1xx (before 5.0)
  495|       |	 * 	M000xx (pre-M.0)
  496|       |	 * 	Mmm1xx
  497|       |	 *
  498|       |	 * M = major version
  499|       |	 * m = minor version
  500|       |	 * i = minor version increment (491000 -> 4.10)
  501|       |	 * p = patchlevel
  502|       |	 * x = revision
  503|       |	 *
  504|       |	 * The first release of FreeBSD to use ELF by default
  505|       |	 * was version 3.0.
  506|       |	 */
  507|     49|	if (desc == 460002) {
  ------------------
  |  Branch (507:6): [True: 0, False: 49]
  ------------------
  508|      0|		if (file_printf(ms, " 4.6.2") == -1)
  ------------------
  |  Branch (508:7): [True: 0, False: 0]
  ------------------
  509|      0|			return -1;
  510|     49|	} else if (desc < 460100) {
  ------------------
  |  Branch (510:13): [True: 10, False: 39]
  ------------------
  511|     10|		if (file_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (511:7): [True: 0, False: 10]
  ------------------
  512|     10|		    desc / 10000 % 10) == -1)
  513|      0|			return -1;
  514|     10|		if (desc / 1000 % 10 > 0)
  ------------------
  |  Branch (514:7): [True: 6, False: 4]
  ------------------
  515|      6|			if (file_printf(ms, ".%d", desc / 1000 % 10) == -1)
  ------------------
  |  Branch (515:8): [True: 0, False: 6]
  ------------------
  516|      0|				return -1;
  517|     10|		if ((desc % 1000 > 0) || (desc % 100000 == 0))
  ------------------
  |  Branch (517:7): [True: 8, False: 2]
  |  Branch (517:28): [True: 1, False: 1]
  ------------------
  518|      9|			if (file_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (518:8): [True: 0, False: 9]
  ------------------
  519|      0|				return -1;
  520|     39|	} else if (desc < 500000) {
  ------------------
  |  Branch (520:13): [True: 16, False: 23]
  ------------------
  521|     16|		if (file_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (521:7): [True: 0, False: 16]
  ------------------
  522|     16|		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
  523|      0|			return -1;
  524|     16|		if (desc / 100 % 10 > 0) {
  ------------------
  |  Branch (524:7): [True: 9, False: 7]
  ------------------
  525|      9|			if (file_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (525:8): [True: 0, False: 9]
  ------------------
  526|      0|				return -1;
  527|      9|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (527:14): [True: 6, False: 1]
  ------------------
  528|      6|			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (528:8): [True: 0, False: 6]
  ------------------
  529|      0|				return -1;
  530|      6|		}
  531|     23|	} else {
  532|     23|		if (file_printf(ms, " %d.%d", desc / 100000,
  ------------------
  |  Branch (532:7): [True: 0, False: 23]
  ------------------
  533|     23|		    desc / 1000 % 100) == -1)
  534|      0|			return -1;
  535|     23|		if ((desc / 100 % 10 > 0) ||
  ------------------
  |  Branch (535:7): [True: 16, False: 7]
  ------------------
  536|     23|		    (desc % 100000 / 100 == 0)) {
  ------------------
  |  Branch (536:7): [True: 1, False: 6]
  ------------------
  537|     17|			if (file_printf(ms, " (%d)", desc) == -1)
  ------------------
  |  Branch (537:8): [True: 0, False: 17]
  ------------------
  538|      0|				return -1;
  539|     17|		} else if (desc / 10 % 10 > 0) {
  ------------------
  |  Branch (539:14): [True: 4, False: 2]
  ------------------
  540|      4|			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
  ------------------
  |  Branch (540:8): [True: 0, False: 4]
  ------------------
  541|      0|				return -1;
  542|      4|		}
  543|     23|	}
  544|     49|	return 0;
  545|     49|}
readelf.c:do_bid_note:
  552|  16.8k|{
  553|  16.8k|	if (namesz == 4 && strcmp(RCAST(char *, &nbuf[noff]), "GNU") == 0 &&
  ------------------
  |  |  445|  10.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (553:6): [True: 10.9k, False: 5.91k]
  |  Branch (553:21): [True: 863, False: 10.0k]
  ------------------
  554|  16.8k|	    type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) {
  ------------------
  |  |  319|  17.7k|#define	NT_GNU_BUILD_ID		3
  ------------------
  |  Branch (554:6): [True: 239, False: 624]
  |  Branch (554:34): [True: 211, False: 28]
  |  Branch (554:49): [True: 18, False: 193]
  ------------------
  555|     18|		uint8_t desc[20];
  556|     18|		const char *btype;
  557|     18|		uint32_t i;
  558|     18|		*flags |= FLAGS_DID_BUILD_ID;
  ------------------
  |  |  336|     18|#define FLAGS_DID_BUILD_ID		0x0010
  ------------------
  559|     18|		switch (descsz) {
  560|      1|		case 8:
  ------------------
  |  Branch (560:3): [True: 1, False: 17]
  ------------------
  561|      1|		    btype = "xxHash";
  562|      1|		    break;
  563|     13|		case 16:
  ------------------
  |  Branch (563:3): [True: 13, False: 5]
  ------------------
  564|     13|		    btype = "md5/uuid";
  565|     13|		    break;
  566|      2|		case 20:
  ------------------
  |  Branch (566:3): [True: 2, False: 16]
  ------------------
  567|      2|		    btype = "sha1";
  568|      2|		    break;
  569|      2|		default:
  ------------------
  |  Branch (569:3): [True: 2, False: 16]
  ------------------
  570|      2|		    btype = "unknown";
  571|      2|		    break;
  572|     18|		}
  573|     18|		if (file_printf(ms, ", BuildID[%s]=", btype) == -1)
  ------------------
  |  Branch (573:7): [True: 0, False: 18]
  ------------------
  574|      0|			return -1;
  575|     18|		memcpy(desc, &nbuf[doff], descsz);
  576|    295|		for (i = 0; i < descsz; i++)
  ------------------
  |  Branch (576:15): [True: 277, False: 18]
  ------------------
  577|    277|		    if (file_printf(ms, "%02x", desc[i]) == -1)
  ------------------
  |  Branch (577:11): [True: 0, False: 277]
  ------------------
  578|      0|			return -1;
  579|     18|		return 1;
  580|     18|	}
  581|  16.8k|	if (namesz == 4 && strcmp(RCAST(char *, &nbuf[noff]), "Go") == 0 &&
  ------------------
  |  |  445|  10.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  |  Branch (581:6): [True: 10.9k, False: 5.91k]
  |  Branch (581:21): [True: 616, False: 10.3k]
  ------------------
  582|  16.8k|	    type == NT_GO_BUILD_ID && descsz < 128) {
  ------------------
  |  |  365|  17.4k|#define NT_GO_BUILD_ID	4
  ------------------
  |  Branch (582:6): [True: 524, False: 92]
  |  Branch (582:32): [True: 452, False: 72]
  ------------------
  583|    452|		char buf[256];
  584|    452|		if (file_printf(ms, ", Go BuildID=%s",
  ------------------
  |  Branch (584:7): [True: 0, False: 452]
  ------------------
  585|    452|		    file_copystr(buf, sizeof(buf), descsz,
  586|    452|		    RCAST(const char *, &nbuf[doff]))) == -1)
  ------------------
  |  |  445|    452|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  587|      0|			return -1;
  588|    452|		return 1;
  589|    452|	}
  590|  16.3k|	return 0;
  591|  16.8k|}
readelf.c:do_pax_note:
  696|  17.3k|{
  697|  17.3k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  445|  17.3k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  698|       |
  699|  17.3k|	if (namesz == 4 && strcmp(name, "PaX") == 0 &&
  ------------------
  |  Branch (699:6): [True: 11.4k, False: 5.90k]
  |  Branch (699:21): [True: 378, False: 11.0k]
  ------------------
  700|  17.3k|	    type == NT_NETBSD_PAX && descsz == 4) {
  ------------------
  |  |  330|  17.6k|#define NT_NETBSD_PAX		3
  ------------------
  |  Branch (700:6): [True: 261, False: 117]
  |  Branch (700:31): [True: 32, False: 229]
  ------------------
  701|     32|		static const char *pax[] = {
  702|     32|		    "+mprotect",
  703|     32|		    "-mprotect",
  704|     32|		    "+segvguard",
  705|     32|		    "-segvguard",
  706|     32|		    "+ASLR",
  707|     32|		    "-ASLR",
  708|     32|		};
  709|     32|		uint32_t desc;
  710|     32|		size_t i;
  711|     32|		int did = 0;
  712|       |
  713|     32|		*flags |= FLAGS_DID_NETBSD_PAX;
  ------------------
  |  |  338|     32|#define FLAGS_DID_NETBSD_PAX		0x0040
  ------------------
  714|     32|		memcpy(&desc, &nbuf[doff], sizeof(desc));
  715|     32|		desc = elf_getu32(swap, desc);
  ------------------
  |  |  141|     32|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  716|       |
  717|     32|		if (desc && file_printf(ms, ", PaX: ") == -1)
  ------------------
  |  Branch (717:7): [True: 31, False: 1]
  |  Branch (717:15): [True: 0, False: 31]
  ------------------
  718|      0|			return -1;
  719|       |
  720|    224|		for (i = 0; i < __arraycount(pax); i++) {
  ------------------
  |  |  130|    224|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (720:15): [True: 192, False: 32]
  ------------------
  721|    192|			if (((1 << CAST(int, i)) & desc) == 0)
  ------------------
  |  |  444|    192|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (721:8): [True: 84, False: 108]
  ------------------
  722|     84|				continue;
  723|    108|			if (file_printf(ms, "%s%s", did++ ? "," : "",
  ------------------
  |  Branch (723:8): [True: 0, False: 108]
  |  Branch (723:32): [True: 78, False: 30]
  ------------------
  724|    108|			    pax[i]) == -1)
  725|      0|				return -1;
  726|    108|		}
  727|     32|		return 1;
  728|     32|	}
  729|  17.2k|	return 0;
  730|  17.3k|}
readelf.c:do_core_note:
  736|  15.8k|{
  737|  15.8k|#ifdef ELFCORE
  738|  15.8k|	char buf[256];
  739|  15.8k|	const char *name = RCAST(const char *, &nbuf[noff]);
  ------------------
  |  |  445|  15.8k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  740|       |
  741|  15.8k|	int os_style = -1;
  742|       |	/*
  743|       |	 * Sigh.  The 2.0.36 kernel in Debian 2.1, at
  744|       |	 * least, doesn't correctly implement name
  745|       |	 * sections, in core dumps, as specified by
  746|       |	 * the "Program Linking" section of "UNIX(R) System
  747|       |	 * V Release 4 Programmer's Guide: ANSI C and
  748|       |	 * Programming Support Tools", because my copy
  749|       |	 * clearly says "The first 'namesz' bytes in 'name'
  750|       |	 * contain a *null-terminated* [emphasis mine]
  751|       |	 * character representation of the entry's owner
  752|       |	 * or originator", but the 2.0.36 kernel code
  753|       |	 * doesn't include the terminating null in the
  754|       |	 * name....
  755|       |	 */
  756|  15.8k|	if ((namesz == 4 && strncmp(name, "CORE", 4) == 0) ||
  ------------------
  |  Branch (756:7): [True: 10.0k, False: 5.86k]
  |  Branch (756:22): [True: 802, False: 9.22k]
  ------------------
  757|  15.8k|	    (namesz == 5 && strcmp(name, "CORE") == 0)) {
  ------------------
  |  Branch (757:7): [True: 587, False: 14.4k]
  |  Branch (757:22): [True: 94, False: 493]
  ------------------
  758|    896|		os_style = OS_STYLE_SVR4;
  ------------------
  |  |  322|    896|#define	OS_STYLE_SVR4		0
  ------------------
  759|    896|	}
  760|       |
  761|  15.8k|	if ((namesz == 8 && strcmp(name, "FreeBSD") == 0)) {
  ------------------
  |  Branch (761:7): [True: 699, False: 15.1k]
  |  Branch (761:22): [True: 316, False: 383]
  ------------------
  762|    316|		os_style = OS_STYLE_FREEBSD;
  ------------------
  |  |  323|    316|#define	OS_STYLE_FREEBSD	1
  ------------------
  763|    316|	}
  764|       |
  765|  15.8k|	if ((namesz >= 11 && strncmp(name, "NetBSD-CORE", 11)
  ------------------
  |  Branch (765:7): [True: 1.51k, False: 14.3k]
  |  Branch (765:23): [True: 300, False: 1.21k]
  ------------------
  766|  1.51k|	    == 0)) {
  767|    300|		os_style = OS_STYLE_NETBSD;
  ------------------
  |  |  324|    300|#define	OS_STYLE_NETBSD		2
  ------------------
  768|    300|	}
  769|       |
  770|  15.8k|	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
  ------------------
  |  |  337|  1.51k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (770:6): [True: 1.51k, False: 14.3k]
  |  Branch (770:24): [True: 622, False: 890]
  ------------------
  771|    622|		if (file_printf(ms, ", %s-style", os_style_names[os_style])
  ------------------
  |  Branch (771:7): [True: 0, False: 622]
  ------------------
  772|    622|		    == -1)
  773|      0|			return -1;
  774|    622|		*flags |= FLAGS_DID_CORE_STYLE;
  ------------------
  |  |  337|    622|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  775|    622|		*flags |= os_style;
  776|    622|	}
  777|       |
  778|  15.8k|	switch (os_style) {
  779|    300|	case OS_STYLE_NETBSD:
  ------------------
  |  |  324|    300|#define	OS_STYLE_NETBSD		2
  ------------------
  |  Branch (779:2): [True: 300, False: 15.5k]
  ------------------
  780|    300|		if (type == NT_NETBSD_CORE_PROCINFO) {
  ------------------
  |  |  232|    300|#define	NT_NETBSD_CORE_PROCINFO		1
  ------------------
  |  Branch (780:7): [True: 2, False: 298]
  ------------------
  781|      2|			char sbuf[512];
  782|      2|			struct NetBSD_elfcore_procinfo pi;
  783|      2|			memset(&pi, 0, sizeof(pi));
  784|      2|			memcpy(&pi, nbuf + doff, MIN(descsz, sizeof(pi)));
  785|       |
  786|      2|			if (file_printf(ms, ", from '%.31s', pid=%u, uid=%u, "
  ------------------
  |  Branch (786:8): [True: 0, False: 2]
  ------------------
  787|      2|			    "gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",
  788|      2|			    file_printable(ms, sbuf, sizeof(sbuf),
  789|      2|			    RCAST(char *, pi.cpi_name), sizeof(pi.cpi_name)),
  ------------------
  |  |  445|      2|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  790|      2|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_pid)),
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  791|      2|			    elf_getu32(swap, pi.cpi_euid),
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  792|      2|			    elf_getu32(swap, pi.cpi_egid),
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  793|      2|			    elf_getu32(swap, pi.cpi_nlwps),
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  794|      2|			    elf_getu32(swap, CAST(uint32_t, pi.cpi_siglwp)),
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  795|      2|			    elf_getu32(swap, pi.cpi_signo),
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  796|      2|			    elf_getu32(swap, pi.cpi_sigcode)) == -1)
  ------------------
  |  |  141|      2|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  797|      0|				return -1;
  798|       |
  799|      2|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  334|      2|#define FLAGS_DID_CORE			0x0004
  ------------------
  800|      2|			return 1;
  801|      2|		}
  802|    298|		break;
  803|       |
  804|    316|	case OS_STYLE_FREEBSD:
  ------------------
  |  |  323|    316|#define	OS_STYLE_FREEBSD	1
  ------------------
  |  Branch (804:2): [True: 316, False: 15.5k]
  ------------------
  805|    316|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|    632|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  343|     15|#define FLAGS_IS_CORE			0x0800
  ------------------
  |  Branch (805:7): [True: 15, False: 301]
  |  Branch (805:30): [True: 4, False: 11]
  ------------------
  806|      4|			size_t argoff, pidoff;
  807|       |
  808|      4|			if (clazz == ELFCLASS32)
  ------------------
  |  |  153|      4|#define	ELFCLASS32	1
  ------------------
  |  Branch (808:8): [True: 3, False: 1]
  ------------------
  809|      3|				argoff = 4 + 4 + 17;
  810|      1|			else
  811|      1|				argoff = 4 + 4 + 8 + 17;
  812|      4|			if (file_printf(ms, ", from '%.80s'", nbuf + doff +
  ------------------
  |  Branch (812:8): [True: 0, False: 4]
  ------------------
  813|      4|			    argoff) == -1)
  814|      0|				return -1;
  815|      4|			pidoff = argoff + 81 + 2;
  816|      4|			if (doff + pidoff + 4 <= size) {
  ------------------
  |  Branch (816:8): [True: 3, False: 1]
  ------------------
  817|      3|				if (file_printf(ms, ", pid=%u",
  ------------------
  |  Branch (817:9): [True: 0, False: 3]
  ------------------
  818|      3|				    elf_getu32(swap, *RCAST(uint32_t *, (nbuf +
  ------------------
  |  |  141|      3|#define elf_getu32(swap, value) getu32(swap, value)
  ------------------
  819|      3|				    doff + pidoff)))) == -1)
  820|      0|					return -1;
  821|      3|			}
  822|      4|			*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  334|      4|#define FLAGS_DID_CORE			0x0004
  ------------------
  823|      4|		}			    
  824|    316|		break;
  825|       |
  826|  15.2k|	default:
  ------------------
  |  Branch (826:2): [True: 15.2k, False: 616]
  ------------------
  827|  15.2k|		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  277|  30.5k|#define	NT_PRPSINFO	3
  ------------------
              		if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
  ------------------
  |  |  343|  2.40k|#define FLAGS_IS_CORE			0x0800
  ------------------
  |  Branch (827:7): [True: 2.40k, False: 12.8k]
  |  Branch (827:30): [True: 2.31k, False: 91]
  ------------------
  828|  2.31k|			size_t i, j;
  829|  2.31k|			unsigned char c;
  830|       |			/*
  831|       |			 * Extract the program name.  We assume
  832|       |			 * it to be 16 characters (that's what it
  833|       |			 * is in SunOS 5.x and Linux).
  834|       |			 *
  835|       |			 * Unfortunately, it's at a different offset
  836|       |			 * in various OSes, so try multiple offsets.
  837|       |			 * If the characters aren't all printable,
  838|       |			 * reject it.
  839|       |			 */
  840|  18.0k|			for (i = 0; i < NOFFSETS; i++) {
  ------------------
  |  |  291|  18.0k|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|  18.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  288|  17.4k|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  17.4k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  289|    580|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    580|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (291:19): [True: 17.4k, False: 580]
  |  |  ------------------
  ------------------
  |  Branch (840:16): [True: 15.8k, False: 2.23k]
  ------------------
  841|  15.8k|				unsigned char *cname, *cp;
  842|  15.8k|				size_t reloffset = prpsoffsets(i);
  ------------------
  |  |  246|  15.8k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  15.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 15.3k, False: 485]
  |  |  ------------------
  |  |  247|  15.8k|			 ? prpsoffsets32[i]			\
  |  |  248|  15.8k|			 : prpsoffsets64[i])
  ------------------
  843|  15.8k|				size_t noffset = doff + reloffset;
  844|  15.8k|				size_t k;
  845|  18.0k|				for (j = 0; j < 16; j++, noffset++,
  ------------------
  |  Branch (845:17): [True: 18.0k, False: 26]
  ------------------
  846|  18.0k|				    reloffset++) {
  847|       |					/*
  848|       |					 * Make sure we're not past
  849|       |					 * the end of the buffer; if
  850|       |					 * we are, just give up.
  851|       |					 */
  852|  18.0k|					if (noffset >= size)
  ------------------
  |  Branch (852:10): [True: 1.80k, False: 16.2k]
  ------------------
  853|  1.80k|						goto tryanother;
  854|       |
  855|       |					/*
  856|       |					 * Make sure we're not past
  857|       |					 * the end of the contents;
  858|       |					 * if we are, this obviously
  859|       |					 * isn't the right offset.
  860|       |					 */
  861|  16.2k|					if (reloffset >= descsz)
  ------------------
  |  Branch (861:10): [True: 10.0k, False: 6.22k]
  ------------------
  862|  10.0k|						goto tryanother;
  863|       |
  864|  6.22k|					c = nbuf[noffset];
  865|  6.22k|					if (c == '\0') {
  ------------------
  |  Branch (865:10): [True: 2.08k, False: 4.14k]
  ------------------
  866|       |						/*
  867|       |						 * A '\0' at the
  868|       |						 * beginning is
  869|       |						 * obviously wrong.
  870|       |						 * Any other '\0'
  871|       |						 * means we're done.
  872|       |						 */
  873|  2.08k|						if (j == 0)
  ------------------
  |  Branch (873:11): [True: 2.02k, False: 57]
  ------------------
  874|  2.02k|							goto tryanother;
  875|     57|						else
  876|     57|							break;
  877|  4.14k|					} else {
  878|       |						/*
  879|       |						 * A nonprintable
  880|       |						 * character is also
  881|       |						 * wrong.
  882|       |						 */
  883|  4.14k|						if (!isprint(c) || isquote(c))
  ------------------
  |  |   57|  2.64k|#define isquote(c) (strchr("'\"`", (c)) != NULL)
  |  |  ------------------
  |  |  |  Branch (57:20): [True: 394, False: 2.25k]
  |  |  ------------------
  ------------------
  |  Branch (883:11): [True: 1.49k, False: 2.64k]
  ------------------
  884|  1.89k|							goto tryanother;
  885|  4.14k|					}
  886|  6.22k|				}
  887|       |				/*
  888|       |				 * Well, that worked.
  889|       |				 */
  890|       |
  891|       |				/*
  892|       |				 * Try next offsets, in case this match is
  893|       |				 * in the middle of a string.
  894|       |				 */
  895|    271|				for (k = i + 1 ; k < NOFFSETS; k++) {
  ------------------
  |  |  291|    271|#define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  153|    271|#define	ELFCLASS32	1
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  288|    257|#define	NOFFSETS32	__arraycount(prpsoffsets32)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    257|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NOFFSETS	(clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
  |  |  ------------------
  |  |  |  |  289|     14|#define NOFFSETS64	__arraycount(prpsoffsets64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     14|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (291:19): [True: 257, False: 14]
  |  |  ------------------
  ------------------
  |  Branch (895:22): [True: 188, False: 83]
  ------------------
  896|    188|					size_t no;
  897|    188|					int adjust = 1;
  898|    188|					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  246|    188|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    188|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 178, False: 10]
  |  |  ------------------
  |  |  247|    188|			 ? prpsoffsets32[i]			\
  |  |  248|    188|			 : prpsoffsets64[i])
  ------------------
              					if (prpsoffsets(k) >= prpsoffsets(i))
  ------------------
  |  |  246|    188|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    188|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 178, False: 10]
  |  |  ------------------
  |  |  247|    188|			 ? prpsoffsets32[i]			\
  |  |  248|    188|			 : prpsoffsets64[i])
  ------------------
  |  Branch (898:10): [True: 40, False: 148]
  ------------------
  899|     40|						continue;
  900|       |					/*
  901|       |					 * pr_fname == pr_psargs - 16 &&
  902|       |					 * non-nul-terminated fname (qemu)
  903|       |					 */
  904|    148|					if (prpsoffsets(k) ==
  ------------------
  |  |  246|    148|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    148|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 138, False: 10]
  |  |  ------------------
  |  |  247|    148|			 ? prpsoffsets32[i]			\
  |  |  248|    148|			 : prpsoffsets64[i])
  ------------------
  |  Branch (904:10): [True: 36, False: 112]
  ------------------
  905|    148|					    prpsoffsets(i) - 16 && j == 16)
  ------------------
  |  |  246|    148|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    148|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 138, False: 10]
  |  |  ------------------
  |  |  247|    148|			 ? prpsoffsets32[i]			\
  |  |  248|    148|			 : prpsoffsets64[i])
  ------------------
  |  Branch (905:33): [True: 20, False: 16]
  ------------------
  906|     20|						continue;
  907|    128|					for (no = doff + prpsoffsets(k);
  ------------------
  |  |  246|    128|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    128|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 119, False: 9]
  |  |  ------------------
  |  |  247|    128|			 ? prpsoffsets32[i]			\
  |  |  248|    128|			 : prpsoffsets64[i])
  ------------------
  908|  4.45k|					     no < doff + prpsoffsets(i); no++)
  ------------------
  |  |  246|  4.45k|#define prpsoffsets(i)	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  4.45k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (246:25): [True: 3.82k, False: 633]
  |  |  ------------------
  |  |  247|  4.45k|			 ? prpsoffsets32[i]			\
  |  |  248|  4.45k|			 : prpsoffsets64[i])
  ------------------
  |  Branch (908:11): [True: 4.32k, False: 128]
  ------------------
  909|  4.32k|						adjust = adjust
  ------------------
  |  Branch (909:16): [True: 1.70k, False: 2.61k]
  ------------------
  910|  4.32k|						         && isprint(nbuf[no]);
  911|    128|					if (adjust)
  ------------------
  |  Branch (911:10): [True: 42, False: 86]
  ------------------
  912|     42|						i = k;
  913|    128|				}
  914|       |
  915|     83|				cname = CAST(unsigned char *,
  ------------------
  |  |  444|    166|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 79, False: 4]
  |  |  ------------------
  ------------------
  916|     83|				    &nbuf[doff + prpsoffsets(i)]);
  917|  7.09k|				for (cp = cname; cp < nbuf + size && *cp
  ------------------
  |  Branch (917:22): [True: 7.08k, False: 6]
  |  Branch (917:42): [True: 7.02k, False: 58]
  ------------------
  918|  7.09k|				    && isprint(*cp); cp++)
  919|  7.01k|					continue;
  920|       |				/*
  921|       |				 * Linux apparently appends a space at the end
  922|       |				 * of the command line: remove it.
  923|       |				 */
  924|    304|				while (cp > cname && isspace(cp[-1]))
  ------------------
  |  Branch (924:12): [True: 295, False: 9]
  ------------------
  925|    221|					cp--;
  926|     83|				if (file_printf(ms, ", from '%s'",
  ------------------
  |  Branch (926:9): [True: 0, False: 83]
  ------------------
  927|     83|				    file_copystr(buf, sizeof(buf),
  928|     83|				    CAST(size_t, cp - cname),
  ------------------
  |  |  444|     83|#define CAST(T, b)	((T)(b))
  ------------------
  929|     83|				    RCAST(char *, cname))) == -1)
  ------------------
  |  |  445|     83|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  930|      0|					return -1;
  931|     83|				*flags |= FLAGS_DID_CORE;
  ------------------
  |  |  334|     83|#define FLAGS_DID_CORE			0x0004
  ------------------
  932|     83|				return 1;
  933|       |
  934|  15.7k|			tryanother:
  935|  15.7k|				;
  936|  15.7k|			}
  937|  2.31k|		}
  938|  15.1k|		break;
  939|  15.8k|	}
  940|  15.7k|#endif
  941|  15.7k|	return 0;
  942|  15.8k|}
readelf.c:do_auxv_note:
 1019|  16.6k|{
 1020|  16.6k|#ifdef ELFCORE
 1021|  16.6k|	Aux32Info auxv32;
 1022|  16.6k|	Aux64Info auxv64;
 1023|  16.6k|	size_t elsize = xauxv_sizeof;
  ------------------
  |  |  236|  16.6k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  16.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (236:23): [True: 15.3k, False: 1.28k]
  |  |  ------------------
  |  |  237|  16.6k|			 ? sizeof(auxv32)			\
  |  |  238|  16.6k|			 : sizeof(auxv64))
  ------------------
 1024|  16.6k|	const char *tag;
 1025|  16.6k|	int is_string;
 1026|  16.6k|	size_t nval, off;
 1027|       |
 1028|  16.6k|	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  343|  16.6k|#define FLAGS_IS_CORE			0x0800
  ------------------
              	if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) !=
  ------------------
  |  |  337|  16.6k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
  |  Branch (1028:6): [True: 14.3k, False: 2.32k]
  ------------------
 1029|  16.6k|	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  343|  16.6k|#define FLAGS_IS_CORE			0x0800
  ------------------
              	    (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE))
  ------------------
  |  |  337|  16.6k|#define FLAGS_DID_CORE_STYLE		0x0020
  ------------------
 1030|  14.3k|		return 0;
 1031|       |
 1032|  2.32k|	switch (*flags & FLAGS_CORE_STYLE) {
  ------------------
  |  |  332|  2.32k|#define FLAGS_CORE_STYLE		0x0003
  ------------------
 1033|  1.04k|	case OS_STYLE_SVR4:
  ------------------
  |  |  322|  1.04k|#define	OS_STYLE_SVR4		0
  ------------------
  |  Branch (1033:2): [True: 1.04k, False: 1.27k]
  ------------------
 1034|  1.04k|		if (type != NT_AUXV)
  ------------------
  |  |  281|  1.04k|#define	NT_AUXV		6
  ------------------
  |  Branch (1034:7): [True: 569, False: 478]
  ------------------
 1035|    569|			return 0;
 1036|    478|		break;
 1037|       |#ifdef notyet
 1038|       |	case OS_STYLE_NETBSD:
 1039|       |		if (type != NT_NETBSD_CORE_AUXV)
 1040|       |			return 0;
 1041|       |		break;
 1042|       |	case OS_STYLE_FREEBSD:
 1043|       |		if (type != NT_FREEBSD_PROCSTAT_AUXV)
 1044|       |			return 0;
 1045|       |		break;
 1046|       |#endif
 1047|  1.27k|	default:
  ------------------
  |  Branch (1047:2): [True: 1.27k, False: 1.04k]
  ------------------
 1048|  1.27k|		return 0;
 1049|  2.32k|	}
 1050|       |
 1051|    478|	*flags |= FLAGS_DID_AUXV;
  ------------------
  |  |  344|    478|#define FLAGS_DID_AUXV			0x1000
  ------------------
 1052|       |
 1053|    478|	nval = 0;
 1054|  6.76k|	for (off = 0; off + elsize <= descsz; off += elsize) {
  ------------------
  |  Branch (1054:16): [True: 6.34k, False: 418]
  ------------------
 1055|  6.34k|		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  233|  6.34k|#define xauxv_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.34k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 2.71k, False: 3.63k]
  |  |  ------------------
  |  |  234|  6.34k|			 ? CAST(void *, &auxv32)		\
  |  |  ------------------
  |  |  |  |  444|  2.71k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  235|  6.34k|			 : CAST(void *, &auxv64))
  |  |  ------------------
  |  |  |  |  444|  3.63k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
  ------------------
  |  |  236|  6.34k|#define xauxv_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.34k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (236:23): [True: 2.71k, False: 3.63k]
  |  |  ------------------
  |  |  237|  6.34k|			 ? sizeof(auxv32)			\
  |  |  238|  6.34k|			 : sizeof(auxv64))
  ------------------
 1056|       |		/* Limit processing to 50 vector entries to prevent DoS */
 1057|  6.34k|		if (nval++ >= 50) {
  ------------------
  |  Branch (1057:7): [True: 60, False: 6.28k]
  ------------------
 1058|     60|			file_error(ms, 0, "Too many ELF Auxv elements");
 1059|     60|			return 1;
 1060|     60|		}
 1061|       |
 1062|  6.28k|		switch(xauxv_type) {
  ------------------
  |  |  239|  6.28k|#define xauxv_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  6.28k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (239:21): [True: 2.69k, False: 3.59k]
  |  |  ------------------
  |  |  240|  6.28k|			 ? elf_getu32(swap, auxv32.a_type)	\
  |  |  ------------------
  |  |  |  |  141|  2.69k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  241|  6.28k|			 : elf_getu64(swap, auxv64.a_type))
  |  |  ------------------
  |  |  |  |  142|  3.59k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1063|  1.16k|		case AT_LINUX_EXECFN:
  ------------------
  |  |   90|  1.16k|#define AT_LINUX_EXECFN 31   /* filename of program */
  ------------------
  |  Branch (1063:3): [True: 1.16k, False: 5.12k]
  ------------------
 1064|  1.16k|			is_string = 1;
 1065|  1.16k|			tag = "execfn";
 1066|  1.16k|			break;
 1067|    457|		case AT_LINUX_PLATFORM:
  ------------------
  |  |   81|    457|#define AT_LINUX_PLATFORM 15  /* string identifying CPU for optimizations */
  ------------------
  |  Branch (1067:3): [True: 457, False: 5.83k]
  ------------------
 1068|    457|			is_string = 1;
 1069|    457|			tag = "platform";
 1070|    457|			break;
 1071|     19|		case AT_LINUX_UID:
  ------------------
  |  |   77|     19|#define AT_LINUX_UID    11    /* real uid */
  ------------------
  |  Branch (1071:3): [True: 19, False: 6.26k]
  ------------------
 1072|     19|			is_string = 0;
 1073|     19|			tag = "real uid";
 1074|     19|			break;
 1075|     25|		case AT_LINUX_GID:
  ------------------
  |  |   79|     25|#define AT_LINUX_GID    13    /* real gid */
  ------------------
  |  Branch (1075:3): [True: 25, False: 6.26k]
  ------------------
 1076|     25|			is_string = 0;
 1077|     25|			tag = "real gid";
 1078|     25|			break;
 1079|     23|		case AT_LINUX_EUID:
  ------------------
  |  |   78|     23|#define AT_LINUX_EUID   12    /* effective uid */
  ------------------
  |  Branch (1079:3): [True: 23, False: 6.26k]
  ------------------
 1080|     23|			is_string = 0;
 1081|     23|			tag = "effective uid";
 1082|     23|			break;
 1083|     22|		case AT_LINUX_EGID:
  ------------------
  |  |   80|     22|#define AT_LINUX_EGID   14    /* effective gid */
  ------------------
  |  Branch (1083:3): [True: 22, False: 6.26k]
  ------------------
 1084|     22|			is_string = 0;
 1085|     22|			tag = "effective gid";
 1086|     22|			break;
 1087|  4.57k|		default:
  ------------------
  |  Branch (1087:3): [True: 4.57k, False: 1.71k]
  ------------------
 1088|  4.57k|			is_string = 0;
 1089|  4.57k|			tag = NULL;
 1090|  4.57k|			break;
 1091|  6.28k|		}
 1092|       |
 1093|  6.28k|		if (tag == NULL)
  ------------------
  |  Branch (1093:7): [True: 4.57k, False: 1.71k]
  ------------------
 1094|  4.57k|			continue;
 1095|       |
 1096|  1.71k|		if (is_string) {
  ------------------
  |  Branch (1096:7): [True: 1.62k, False: 89]
  ------------------
 1097|  1.62k|			char buf[256];
 1098|  1.62k|			ssize_t buflen;
 1099|  1.62k|			buflen = get_string_on_virtaddr(ms, swap, clazz, fd,
 1100|  1.62k|			    ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf));
  ------------------
  |  |  242|  1.62k|#define xauxv_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.62k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (242:20): [True: 897, False: 728]
  |  |  ------------------
  |  |  243|  1.62k|			 ? elf_getu32(swap, auxv32.a_v)		\
  |  |  ------------------
  |  |  |  |  141|    897|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  244|  1.62k|			 : elf_getu64(swap, auxv64.a_v))
  |  |  ------------------
  |  |  |  |  142|    728|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1101|       |
 1102|  1.62k|			if (buflen == 0)
  ------------------
  |  Branch (1102:8): [True: 1.53k, False: 90]
  ------------------
 1103|  1.53k|				continue;
 1104|       |
 1105|     90|			if (file_printf(ms, ", %s: '%s'", tag, buf) == -1)
  ------------------
  |  Branch (1105:8): [True: 0, False: 90]
  ------------------
 1106|      0|				return -1;
 1107|     90|		} else {
 1108|     89|			if (file_printf(ms, ", %s: %d", tag,
  ------------------
  |  Branch (1108:8): [True: 0, False: 89]
  ------------------
 1109|     89|			    CAST(int, xauxv_val)) == -1)
  ------------------
  |  |  444|    178|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 74, False: 15]
  |  |  ------------------
  ------------------
 1110|      0|				return -1;
 1111|     89|		}
 1112|  1.71k|	}
 1113|    418|	return 1;
 1114|       |#else
 1115|       |	return 0;
 1116|       |#endif
 1117|    478|}
readelf.c:get_string_on_virtaddr:
  982|  1.62k|{
  983|  1.62k|	char *bptr;
  984|  1.62k|	off_t offset;
  985|       |
  986|  1.62k|	if (buflen == 0)
  ------------------
  |  Branch (986:6): [True: 0, False: 1.62k]
  ------------------
  987|      0|		return 0;
  988|       |
  989|  1.62k|	offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
  990|  1.62k|	    fsize, virtaddr);
  991|  1.62k|	if (offset < 0 ||
  ------------------
  |  Branch (991:6): [True: 178, False: 1.44k]
  ------------------
  992|  1.62k|	    (buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
  ------------------
  |  |  444|  1.44k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (992:6): [True: 530, False: 917]
  ------------------
  993|    708|		(void)file_printf(ms, ", can't read elf string at %jd",
  994|    708|		    (intmax_t)offset);
  995|    708|		return 0;
  996|    708|	}
  997|       |
  998|    917|	buf[buflen - 1] = '\0';
  999|       |
 1000|       |	/* We expect only printable characters, so return if buffer contains
 1001|       |	 * non-printable character before the '\0' or just '\0'. */
 1002|  8.08k|	for (bptr = buf; *bptr && isprint(CAST(unsigned char, *bptr)); bptr++)
  ------------------
  |  Branch (1002:19): [True: 7.94k, False: 138]
  ------------------
 1003|  7.16k|		continue;
 1004|    917|	if (*bptr != '\0')
  ------------------
  |  Branch (1004:6): [True: 779, False: 138]
  ------------------
 1005|    779|		return 0;
 1006|       |
 1007|    138|	return bptr - buf;
 1008|    917|}
readelf.c:get_offset_from_virtaddr:
  947|  1.62k|{
  948|  1.62k|	Elf32_Phdr ph32;
  949|  1.62k|	Elf64_Phdr ph64;
  950|       |
  951|       |	/*
  952|       |	 * Loop through all the program headers and find the header with
  953|       |	 * virtual address in which the "virtaddr" belongs to.
  954|       |	 */
  955|  29.0k|	for ( ; num; num--) {
  ------------------
  |  Branch (955:10): [True: 28.8k, False: 144]
  ------------------
  956|  28.8k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  163|  28.8k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  28.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (163:19): [True: 15.5k, False: 13.3k]
  |  |  ------------------
  |  |  164|  28.8k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  444|  15.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  165|  28.8k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  444|  13.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  166|  28.8k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  28.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:21): [True: 15.5k, False: 13.3k]
  |  |  ------------------
  |  |  167|  28.8k|			 ? sizeof(ph32)				\
  |  |  168|  28.8k|			 : sizeof(ph64))
  ------------------
  |  Branch (956:7): [True: 617, False: 28.2k]
  ------------------
  957|  28.8k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  444|  57.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 15.5k, False: 13.3k]
  |  |  ------------------
  ------------------
  958|    617|			if (file_printf(ms,
  ------------------
  |  Branch (958:8): [True: 0, False: 617]
  ------------------
  959|    617|			    ", can't read elf program header at %jd",
  960|    617|			    (intmax_t)off) == -1)
  961|      0|				return -1;
  962|    617|			return 0;
  963|       |
  964|    617|		}
  965|  28.2k|		off += xph_sizeof;
  ------------------
  |  |  166|  28.2k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  28.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:21): [True: 15.2k, False: 13.0k]
  |  |  ------------------
  |  |  167|  28.2k|			 ? sizeof(ph32)				\
  |  |  168|  28.2k|			 : sizeof(ph64))
  ------------------
  966|       |
  967|  28.2k|		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   63|  28.2k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  444|  56.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  172|  28.2k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  56.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 15.2k, False: 13.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  173|  28.2k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  174|  28.2k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (967:7): [True: 28.2k, False: 0]
  |  Branch (967:32): [True: 17.8k, False: 10.3k]
  ------------------
  968|       |			/* Perhaps warn here */
  969|  17.8k|			continue;
  970|  17.8k|		}
  971|       |
  972|  10.3k|		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  180|  10.3k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  41.4k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 3.14k, False: 1.12k]
  |  |  |  |  |  Branch (444:25): [True: 5.40k, False: 696]
  |  |  |  |  |  Branch (444:25): [True: 4.26k, False: 6.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  181|  10.3k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  182|  10.3k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  183|  10.3k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  184|  10.3k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  180|  6.13k|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  24.5k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 2.06k, False: 994]
  |  |  |  |  |  Branch (444:25): [True: 2.37k, False: 696]
  |  |  |  |  |  Branch (444:25): [True: 3.05k, False: 3.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  181|  6.13k|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  182|  6.13k|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  183|  6.13k|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  184|  6.13k|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
              		if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
  ------------------
  |  |  185|  6.13k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  12.2k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 3.05k, False: 3.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (972:7): [True: 6.13k, False: 4.23k]
  |  Branch (972:32): [True: 864, False: 5.26k]
  ------------------
  973|    864|			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  172|    864|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  1.72k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 483, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  173|    864|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  174|    864|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
              			return xph_offset + (virtaddr - xph_vaddr);
  ------------------
  |  |  180|    864|#define xph_vaddr	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  3.45k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 360, False: 123]
  |  |  |  |  |  Branch (444:25): [True: 287, False: 94]
  |  |  |  |  |  Branch (444:25): [True: 483, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  181|    864|			 ? CAST(off_t, (ph32.p_vaddr ? 		\
  |  |  182|    864|			    elf_getu32(swap, ph32.p_vaddr) : 4))\
  |  |  183|    864|			 : CAST(off_t, (ph64.p_vaddr ?		\
  |  |  184|    864|			    elf_getu64(swap, ph64.p_vaddr) : 4))))
  ------------------
  974|  10.3k|	}
  975|    144|	return 0;
  976|  1.62k|}
readelf.c:getu32:
   96|   509k|{
   97|   509k|	union {
   98|   509k|		uint32_t ui;
   99|   509k|		char c[4];
  100|   509k|	} retval, tmpval;
  101|       |
  102|   509k|	if (swap) {
  ------------------
  |  Branch (102:6): [True: 285k, False: 223k]
  ------------------
  103|   285k|		tmpval.ui = value;
  104|       |
  105|   285k|		retval.c[0] = tmpval.c[3];
  106|   285k|		retval.c[1] = tmpval.c[2];
  107|   285k|		retval.c[2] = tmpval.c[1];
  108|   285k|		retval.c[3] = tmpval.c[0];
  109|       |
  110|   285k|		return retval.ui;
  111|   285k|	} else
  112|   223k|		return value;
  113|   509k|}
readelf.c:dophn_exec:
 1658|  1.59k|{
 1659|  1.59k|	Elf32_Phdr ph32;
 1660|  1.59k|	Elf64_Phdr ph64;
 1661|  1.59k|	const char *linking_style;
 1662|  1.59k|	unsigned char nbuf[BUFSIZ];
 1663|  1.59k|	char ibuf[BUFSIZ];
 1664|  1.59k|	char interp[BUFSIZ];
 1665|  1.59k|	ssize_t bufsize;
 1666|  1.59k|	size_t offset, align, need = 0;
 1667|  1.59k|	int pie = 0, dynamic = 0;
 1668|       |
 1669|  1.59k|	if (num == 0) {
  ------------------
  |  Branch (1669:6): [True: 536, False: 1.06k]
  ------------------
 1670|    536|		if (file_printf(ms, ", no program header") == -1)
  ------------------
  |  Branch (1670:7): [True: 0, False: 536]
  ------------------
 1671|      0|			return -1;
 1672|    536|		return 0;
 1673|    536|	}
 1674|  1.06k|	if (size != xph_sizeof) {
  ------------------
  |  |  166|  1.06k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.06k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:21): [True: 539, False: 524]
  |  |  ------------------
  |  |  167|  1.06k|			 ? sizeof(ph32)				\
  |  |  168|  1.06k|			 : sizeof(ph64))
  ------------------
  |  Branch (1674:6): [True: 331, False: 732]
  ------------------
 1675|    331|		if (file_printf(ms, ", corrupted program header size") == -1)
  ------------------
  |  Branch (1675:7): [True: 0, False: 331]
  ------------------
 1676|      0|			return -1;
 1677|    331|		return 0;
 1678|    331|	}
 1679|       |
 1680|    732|	interp[0] = '\0';
 1681|  26.8k|  	for ( ; num; num--) {
  ------------------
  |  Branch (1681:12): [True: 26.7k, False: 39]
  ------------------
 1682|  26.7k|		int doread;
 1683|  26.7k|		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  163|  26.7k|#define xph_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  26.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (163:19): [True: 18.3k, False: 8.46k]
  |  |  ------------------
  |  |  164|  26.7k|			 ? CAST(void *, &ph32)			\
  |  |  ------------------
  |  |  |  |  444|  18.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  165|  26.7k|			 : CAST(void *, &ph64))
  |  |  ------------------
  |  |  |  |  444|  8.46k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xph_addr, xph_sizeof, off) <
  ------------------
  |  |  166|  26.7k|#define xph_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  26.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (166:21): [True: 18.3k, False: 8.46k]
  |  |  ------------------
  |  |  167|  26.7k|			 ? sizeof(ph32)				\
  |  |  168|  26.7k|			 : sizeof(ph64))
  ------------------
  |  Branch (1683:7): [True: 675, False: 26.0k]
  ------------------
 1684|  26.7k|		    CAST(ssize_t, xph_sizeof)) {
  ------------------
  |  |  444|  53.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 18.3k, False: 8.46k]
  |  |  ------------------
  ------------------
 1685|    675|			if (file_printf(ms,
  ------------------
  |  Branch (1685:8): [True: 0, False: 675]
  ------------------
 1686|    675|			    ", can't read elf program headers at %jd",
 1687|    675|			    (intmax_t)off) == -1)
 1688|      0|				return -1;
 1689|    675|			return 0;
 1690|    675|		}
 1691|       |
 1692|  26.0k|		off += size;
 1693|  26.0k|		bufsize = 0;
 1694|  26.0k|		align = 4;
 1695|       |
 1696|       |		/* Things we can determine before we seek */
 1697|  26.0k|		switch (xph_type) {
  ------------------
  |  |  169|  26.0k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  26.0k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:19): [True: 17.9k, False: 8.14k]
  |  |  ------------------
  |  |  170|  26.0k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  141|  17.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  171|  26.0k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  141|  8.14k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1698|    803|		case PT_DYNAMIC:
  ------------------
  |  |  199|    803|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1698:3): [True: 803, False: 25.2k]
  ------------------
 1699|    803|			doread = 1;
 1700|    803|			break;
 1701|  3.65k|		case PT_NOTE:
  ------------------
  |  |  201|  3.65k|#define	PT_NOTE		4
  ------------------
  |  Branch (1701:3): [True: 3.65k, False: 22.4k]
  ------------------
 1702|  3.65k|			if (sh_num)	/* Did this through section headers */
  ------------------
  |  Branch (1702:8): [True: 237, False: 3.41k]
  ------------------
 1703|    237|				continue;
 1704|  3.41k|			if (((align = xph_align) & 0x80000000UL) != 0 ||
  ------------------
  |  |  175|  3.41k|#define xph_align	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  13.6k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 1.59k, False: 497]
  |  |  |  |  |  Branch (444:25): [True: 910, False: 415]
  |  |  |  |  |  Branch (444:25): [True: 2.09k, False: 1.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  176|  3.41k|			 ? CAST(off_t, (ph32.p_align ? 		\
  |  |  177|  3.41k|			    elf_getu32(swap, ph32.p_align) : 4))\
  |  |  178|  3.41k|			 : CAST(off_t, (ph64.p_align ?		\
  |  |  179|  3.41k|			    elf_getu64(swap, ph64.p_align) : 4))))
  ------------------
  |  Branch (1704:8): [True: 226, False: 3.19k]
  ------------------
 1705|  3.41k|			    align < 4) {
  ------------------
  |  Branch (1705:8): [True: 927, False: 2.26k]
  ------------------
 1706|  1.15k|				if (file_printf(ms,
  ------------------
  |  Branch (1706:9): [True: 0, False: 1.15k]
  ------------------
 1707|  1.15k|				    ", invalid note alignment %#lx",
 1708|  1.15k|				    CAST(unsigned long, align)) == -1)
  ------------------
  |  |  444|  1.15k|#define CAST(T, b)	((T)(b))
  ------------------
 1709|      0|					return -1;
 1710|  1.15k|				align = 4;
 1711|  1.15k|			}
 1712|       |			/*FALLTHROUGH*/
 1713|  4.07k|		case PT_INTERP:
  ------------------
  |  |  200|  4.07k|#define	PT_INTERP	3
  ------------------
  |  Branch (1713:3): [True: 653, False: 25.4k]
  ------------------
 1714|  4.07k|			doread = 1;
 1715|  4.07k|			break;
 1716|  20.9k|		default:
  ------------------
  |  Branch (1716:3): [True: 20.9k, False: 5.11k]
  ------------------
 1717|  20.9k|			doread = 0;
 1718|  20.9k|			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |   63|  20.9k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  444|  41.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
  ------------------
  |  |  172|  20.9k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  41.9k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 14.3k, False: 6.62k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  173|  20.9k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  174|  20.9k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
  |  Branch (1718:8): [True: 20.9k, False: 0]
  |  Branch (1718:33): [True: 14.0k, False: 6.95k]
  ------------------
 1719|       |				/* Maybe warn here? */
 1720|  14.0k|				continue;
 1721|  14.0k|			}
 1722|  6.95k|			break;
 1723|  26.0k|		}
 1724|       |
 1725|  11.8k|		if (doread) {
  ------------------
  |  Branch (1725:7): [True: 4.87k, False: 6.95k]
  ------------------
 1726|  4.87k|			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  185|  4.87k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  9.75k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 3.35k, False: 1.52k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  186|  4.87k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  187|  4.87k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
              			size_t len = xph_filesz < sizeof(nbuf) ? xph_filesz
  ------------------
  |  |  185|  1.82k|#define xph_filesz	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  3.65k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 1.37k, False: 455]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  186|  4.87k|			 ? elf_getu32(swap, ph32.p_filesz)	\
  |  |  187|  4.87k|			 : elf_getu64(swap, ph64.p_filesz)))
  ------------------
  |  Branch (1726:17): [True: 1.82k, False: 3.04k]
  ------------------
 1727|  4.87k|			    : sizeof(nbuf);
 1728|  4.87k|			off_t offs = xph_offset;
  ------------------
  |  |  172|  4.87k|#define xph_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  9.75k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 3.35k, False: 1.52k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  173|  4.87k|			 ? elf_getu32(swap, ph32.p_offset)	\
  |  |  174|  4.87k|			 : elf_getu64(swap, ph64.p_offset)))
  ------------------
 1729|  4.87k|			bufsize = pread(fd, nbuf, len, offs);
 1730|  4.87k|			if (bufsize == -1) {
  ------------------
  |  Branch (1730:8): [True: 18, False: 4.85k]
  ------------------
 1731|     18|				if (file_printf(ms,
  ------------------
  |  Branch (1731:9): [True: 0, False: 18]
  ------------------
 1732|     18|				    ", can't read section at %jd",
 1733|     18|				    (intmax_t)offs) == -1)
 1734|      0|					return -1;
 1735|     18|				return 0;
 1736|     18|			}
 1737|  4.87k|		}
 1738|       |
 1739|       |		/* Things we can determine when we seek */
 1740|  11.8k|		switch (xph_type) {
  ------------------
  |  |  169|  11.8k|#define xph_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  11.8k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (169:19): [True: 7.99k, False: 3.81k]
  |  |  ------------------
  |  |  170|  11.8k|			 ? elf_getu32(swap, ph32.p_type)	\
  |  |  ------------------
  |  |  |  |  141|  7.99k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  171|  11.8k|			 : elf_getu32(swap, ph64.p_type))
  |  |  ------------------
  |  |  |  |  141|  3.81k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1741|    801|		case PT_DYNAMIC:
  ------------------
  |  |  199|    801|#define	PT_DYNAMIC	2
  ------------------
  |  Branch (1741:3): [True: 801, False: 11.0k]
  ------------------
 1742|    801|			dynamic = 1;
 1743|    801|			offset = 0;
 1744|       |			// Let DF_1 determine if we are PIE or not.
 1745|    801|			ms->mode &= ~0111;
 1746|  88.4k|			for (;;) {
 1747|  88.4k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  444|  88.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1747:9): [True: 801, False: 87.6k]
  ------------------
 1748|    801|					break;
 1749|  87.6k|				offset = dodynamic(ms, nbuf, offset,
 1750|  87.6k|				    CAST(size_t, bufsize), clazz, swap,
  ------------------
  |  |  444|  87.6k|#define CAST(T, b)	((T)(b))
  ------------------
 1751|  87.6k|				    &pie, &need);
 1752|  87.6k|				if (offset == 0)
  ------------------
  |  Branch (1752:9): [True: 0, False: 87.6k]
  ------------------
 1753|      0|					break;
 1754|  87.6k|			}
 1755|    801|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    801|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    801|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    801|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1755:8): [True: 0, False: 801]
  ------------------
 1756|      0|				continue;
 1757|    801|			break;
 1758|       |
 1759|    801|		case PT_INTERP:
  ------------------
  |  |  200|    653|#define	PT_INTERP	3
  ------------------
  |  Branch (1759:3): [True: 653, False: 11.1k]
  ------------------
 1760|    653|			need++;
 1761|    653|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|    653|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    653|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    653|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1761:8): [True: 0, False: 653]
  ------------------
 1762|      0|				continue;
 1763|    653|			if (bufsize && nbuf[0]) {
  ------------------
  |  Branch (1763:8): [True: 379, False: 274]
  |  Branch (1763:19): [True: 175, False: 204]
  ------------------
 1764|    175|				nbuf[bufsize - 1] = '\0';
 1765|    175|				memcpy(interp, nbuf, CAST(size_t, bufsize));
  ------------------
  |  |  444|    175|#define CAST(T, b)	((T)(b))
  ------------------
 1766|    175|			} else
 1767|    478|				strlcpy(interp, "*empty*", sizeof(interp));
 1768|    653|			break;
 1769|  3.40k|		case PT_NOTE:
  ------------------
  |  |  201|  3.40k|#define	PT_NOTE		4
  ------------------
  |  Branch (1769:3): [True: 3.40k, False: 8.40k]
  ------------------
 1770|  3.40k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  3.40k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  3.40k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  3.40k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1770:8): [True: 0, False: 3.40k]
  ------------------
 1771|      0|				return 0;
 1772|       |			/*
 1773|       |			 * This is a PT_NOTE section; loop through all the notes
 1774|       |			 * in the section.
 1775|       |			 */
 1776|  3.40k|			offset = 0;
 1777|  7.59k|			for (;;) {
 1778|  7.59k|				if (offset >= CAST(size_t, bufsize))
  ------------------
  |  |  444|  7.59k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1778:9): [True: 2.82k, False: 4.77k]
  ------------------
 1779|  2.82k|					break;
 1780|  4.77k|				offset = donote(ms, nbuf, offset,
 1781|  4.77k|				    CAST(size_t, bufsize), clazz, swap, align,
  ------------------
  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  ------------------
 1782|  4.77k|				    flags, notecount, fd, 0, 0, 0);
 1783|  4.77k|				if (offset == 0)
  ------------------
  |  Branch (1783:9): [True: 578, False: 4.19k]
  ------------------
 1784|    578|					break;
 1785|  4.77k|			}
 1786|  3.40k|			break;
 1787|  6.95k|		default:
  ------------------
  |  Branch (1787:3): [True: 6.95k, False: 4.85k]
  ------------------
 1788|  6.95k|			if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  6.95k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  6.95k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  6.95k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1788:8): [True: 0, False: 6.95k]
  ------------------
 1789|      0|				continue;
 1790|  6.95k|			break;
 1791|  11.8k|		}
 1792|  11.8k|	}
 1793|     39|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   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 (1793:6): [True: 0, False: 39]
  ------------------
 1794|      0|		return 0;
 1795|     39|	if (dynamic) {
  ------------------
  |  Branch (1795:6): [True: 14, False: 25]
  ------------------
 1796|     14|		if (pie && need == 0)
  ------------------
  |  Branch (1796:7): [True: 4, False: 10]
  |  Branch (1796:14): [True: 1, False: 3]
  ------------------
 1797|      1|			linking_style = "static-pie";
 1798|     13|		else
 1799|     13|			linking_style = "dynamically";
 1800|     25|	} else {
 1801|     25|		linking_style = "statically";
 1802|     25|	}
 1803|     39|	if (file_printf(ms, ", %s linked", linking_style) == -1)
  ------------------
  |  Branch (1803:6): [True: 0, False: 39]
  ------------------
 1804|      0|		return -1;
 1805|     39|	if (interp[0])
  ------------------
  |  Branch (1805:6): [True: 6, False: 33]
  ------------------
 1806|      6|		if (file_printf(ms, ", interpreter %s", file_printable(ms,
  ------------------
  |  Branch (1806:7): [True: 1, False: 5]
  ------------------
 1807|      6|		    ibuf, sizeof(ibuf), interp, sizeof(interp))) == -1)
 1808|      1|			return -1;
 1809|     38|	return 0;
 1810|     39|}
readelf.c:dodynamic:
 1122|  87.6k|{
 1123|  87.6k|	Elf32_Dyn dh32;
 1124|  87.6k|	Elf64_Dyn dh64;
 1125|  87.6k|	unsigned char *dbuf = CAST(unsigned char *, vbuf);
  ------------------
  |  |  444|  87.6k|#define CAST(T, b)	((T)(b))
  ------------------
 1126|       |
 1127|  87.6k|	if (xdh_sizeof + offset > size) {
  ------------------
  |  |  210|  87.6k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  87.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (210:21): [True: 77.3k, False: 10.2k]
  |  |  ------------------
  |  |  211|  87.6k|			 ? sizeof(dh32)				\
  |  |  212|  87.6k|			 : sizeof(dh64))
  ------------------
  |  Branch (1127:6): [True: 471, False: 87.1k]
  ------------------
 1128|       |		/*
 1129|       |		 * We're out of note headers.
 1130|       |		 */
 1131|    471|		return xdh_sizeof + offset;
  ------------------
  |  |  210|    471|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    471|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (210:21): [True: 357, False: 114]
  |  |  ------------------
  |  |  211|    471|			 ? sizeof(dh32)				\
  |  |  212|    471|			 : sizeof(dh64))
  ------------------
 1132|    471|	}
 1133|       |
 1134|  87.1k|	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  207|  87.1k|#define xdh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  87.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (207:19): [True: 76.9k, False: 10.1k]
  |  |  ------------------
  |  |  208|  87.1k|			 ? CAST(void *, &dh32)			\
  |  |  ------------------
  |  |  |  |  444|  76.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  209|  87.1k|			 : CAST(void *, &dh64))
  |  |  ------------------
  |  |  |  |  444|  10.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
  ------------------
  |  |  210|  87.1k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  87.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (210:21): [True: 76.9k, False: 10.1k]
  |  |  ------------------
  |  |  211|  87.1k|			 ? sizeof(dh32)				\
  |  |  212|  87.1k|			 : sizeof(dh64))
  ------------------
 1135|  87.1k|	offset += xdh_sizeof;
  ------------------
  |  |  210|  87.1k|#define xdh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  87.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (210:21): [True: 76.9k, False: 10.1k]
  |  |  ------------------
  |  |  211|  87.1k|			 ? sizeof(dh32)				\
  |  |  212|  87.1k|			 : sizeof(dh64))
  ------------------
 1136|       |
 1137|  87.1k|	switch (xdh_tag) {
  ------------------
  |  |  213|  87.1k|#define xdh_tag		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  87.1k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (213:19): [True: 76.9k, False: 10.1k]
  |  |  ------------------
  |  |  214|  87.1k|			 ? elf_getu32(swap, dh32.d_tag)		\
  |  |  ------------------
  |  |  |  |  141|  76.9k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  215|  87.1k|			 : elf_getu64(swap, dh64.d_tag))
  |  |  ------------------
  |  |  |  |  142|  10.1k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1138|    839|	case DT_FLAGS_1:
  ------------------
  |  |  500|    839|#define DT_FLAGS_1	0x6ffffffb	/* ELF dynamic flags */
  ------------------
  |  Branch (1138:2): [True: 839, False: 86.2k]
  ------------------
 1139|    839|		*pie = 1;
 1140|    839|		if (xdh_val & DF_1_PIE)
  ------------------
  |  |  216|    839|#define xdh_val		(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    839|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (216:19): [True: 693, False: 146]
  |  |  ------------------
  |  |  217|    839|			 ? elf_getu32(swap, dh32.d_un.d_val)	\
  |  |  ------------------
  |  |  |  |  141|    693|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  218|    839|			 : elf_getu64(swap, dh64.d_un.d_val))
  |  |  ------------------
  |  |  |  |  142|    146|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
              		if (xdh_val & DF_1_PIE)
  ------------------
  |  |  543|    839|#define	DF_1_PIE	0x08000000	/* Position Independent Executable */
  ------------------
  |  Branch (1140:7): [True: 474, False: 365]
  ------------------
 1141|    474|			ms->mode |= 0111;
 1142|    365|		else
 1143|    365|			ms->mode &= ~0111;
 1144|    839|		break;
 1145|    445|	case DT_NEEDED:
  ------------------
  |  |  463|    445|#define DT_NEEDED	1	/* Name of needed library (DT_STRTAB offset) */
  ------------------
  |  Branch (1145:2): [True: 445, False: 86.6k]
  ------------------
 1146|    445|		(*need)++;
 1147|    445|		break;
 1148|  85.8k|	default:
  ------------------
  |  Branch (1148:2): [True: 85.8k, False: 1.28k]
  ------------------
 1149|  85.8k|		break;
 1150|  87.1k|	}
 1151|  87.1k|	return offset;
 1152|  87.1k|}
readelf.c:doshn:
 1352|  1.60k|{
 1353|  1.60k|	Elf32_Shdr sh32;
 1354|  1.60k|	Elf64_Shdr sh64;
 1355|  1.60k|	int stripped = 1, has_debug_info = 0;
 1356|  1.60k|	size_t nbadcap = 0;
 1357|  1.60k|	void *nbuf;
 1358|  1.60k|	off_t noff, coff, name_off, offs;
 1359|  1.60k|	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilities */
 1360|  1.60k|	uint64_t cap_sf1 = 0;	/* SunOS 5.x software capabilities */
 1361|  1.60k|	char name[50];
 1362|  1.60k|	ssize_t namesize;
 1363|       |
 1364|  1.60k|	if (ms->flags & MAGIC_MIME)
  ------------------
  |  |   44|  1.60k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  1.60k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  1.60k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (1364:6): [True: 0, False: 1.60k]
  ------------------
 1365|      0|		return 0;
 1366|       |
 1367|  1.60k|	if (num == 0) {
  ------------------
  |  Branch (1367:6): [True: 521, False: 1.08k]
  ------------------
 1368|    521|		if (file_printf(ms, ", no section header") == -1)
  ------------------
  |  Branch (1368:7): [True: 0, False: 521]
  ------------------
 1369|      0|			return -1;
 1370|    521|		return 0;
 1371|    521|	}
 1372|  1.08k|	if (size != xsh_sizeof) {
  ------------------
  |  |  147|  1.08k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.08k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (147:21): [True: 580, False: 503]
  |  |  ------------------
  |  |  148|  1.08k|			 ? sizeof(sh32)				\
  |  |  149|  1.08k|			 : sizeof(sh64))
  ------------------
  |  Branch (1372:6): [True: 219, False: 864]
  ------------------
 1373|    219|		if (file_printf(ms, ", corrupted section header size") == -1)
  ------------------
  |  Branch (1373:7): [True: 0, False: 219]
  ------------------
 1374|      0|			return -1;
 1375|    219|		return 0;
 1376|    219|	}
 1377|       |
 1378|       |	/* Read offset of name section to be able to read section names later */
 1379|    864|	offs = CAST(off_t, (off + size * strtab));
  ------------------
  |  |  444|    864|#define CAST(T, b)	((T)(b))
  ------------------
 1380|    864|	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  144|    864|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    864|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (144:19): [True: 447, False: 417]
  |  |  ------------------
  |  |  145|    864|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  444|    447|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  146|    864|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  444|    417|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  147|    864|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|    864|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (147:21): [True: 447, False: 417]
  |  |  ------------------
  |  |  148|    864|			 ? sizeof(sh32)				\
  |  |  149|    864|			 : sizeof(sh64))
  ------------------
              	if (pread(fd, xsh_addr, xsh_sizeof, offs) < CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  444|  1.72k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 447, False: 417]
  |  |  ------------------
  ------------------
  |  Branch (1380:6): [True: 5, False: 859]
  ------------------
 1381|      5|		if (file_printf(ms, ", missing section headers at %jd",
  ------------------
  |  Branch (1381:7): [True: 0, False: 5]
  ------------------
 1382|      5|		    (intmax_t)offs) == -1)
 1383|      0|			return -1;
 1384|      5|		return 0;
 1385|      5|	}
 1386|    859|	name_off = xsh_offset;
  ------------------
  |  |  153|    859|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  1.71k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 444, False: 415]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    859|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  155|    859|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1387|       |
 1388|    859|	if (fsize != SIZE_UNKNOWN && fsize < name_off) {
  ------------------
  |  |   63|    859|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  444|  1.71k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1388:6): [True: 859, False: 0]
  |  Branch (1388:31): [True: 59, False: 800]
  ------------------
 1389|     59|		if (file_printf(ms, ", too large section header offset %jd",
  ------------------
  |  Branch (1389:7): [True: 0, False: 59]
  ------------------
 1390|     59|		    (intmax_t)name_off) == -1)
 1391|      0|			return -1;
 1392|     59|		return 0;
 1393|     59|	}
 1394|       |
 1395|  52.4k|	for ( ; num; num--) {
  ------------------
  |  Branch (1395:10): [True: 52.2k, False: 186]
  ------------------
 1396|       |		/* Read the name of this section. */
 1397|  52.2k|		offs = name_off + xsh_name;
  ------------------
  |  |  159|  52.2k|#define xsh_name    	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (159:23): [True: 25.5k, False: 26.7k]
  |  |  ------------------
  |  |  160|  52.2k|			 ? elf_getu32(swap, sh32.sh_name)	\
  |  |  ------------------
  |  |  |  |  141|  25.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  161|  52.2k|			 : elf_getu32(swap, sh64.sh_name))
  |  |  ------------------
  |  |  |  |  141|  26.7k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1398|  52.2k|		if ((namesize = pread(fd, name, sizeof(name) - 1, offs))
  ------------------
  |  Branch (1398:7): [True: 13, False: 52.2k]
  ------------------
 1399|  52.2k|		    == -1) {
 1400|     13|			if (file_printf(ms, 
  ------------------
  |  Branch (1400:8): [True: 0, False: 13]
  ------------------
 1401|     13|			    ", can't read name of elf section at %jd",
 1402|     13|			    (intmax_t)offs) == -1)
 1403|      0|				return -1;
 1404|     13|			return 0;
 1405|     13|		}
 1406|  52.2k|		name[namesize] = '\0';
 1407|  52.2k|		if (strcmp(name, ".debug_info") == 0) {
  ------------------
  |  Branch (1407:7): [True: 333, False: 51.8k]
  ------------------
 1408|    333|			has_debug_info = 1;
 1409|    333|			stripped = 0;
 1410|    333|		}
 1411|       |
 1412|  52.2k|		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  144|  52.2k|#define xsh_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (144:19): [True: 25.5k, False: 26.7k]
  |  |  ------------------
  |  |  145|  52.2k|			 ? CAST(void *, &sh32)			\
  |  |  ------------------
  |  |  |  |  444|  25.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  146|  52.2k|			 : CAST(void *, &sh64))
  |  |  ------------------
  |  |  |  |  444|  26.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              		if (pread(fd, xsh_addr, xsh_sizeof, off) <
  ------------------
  |  |  147|  52.2k|#define xsh_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  52.2k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (147:21): [True: 25.5k, False: 26.7k]
  |  |  ------------------
  |  |  148|  52.2k|			 ? sizeof(sh32)				\
  |  |  149|  52.2k|			 : sizeof(sh64))
  ------------------
  |  Branch (1412:7): [True: 474, False: 51.7k]
  ------------------
 1413|  52.2k|		    CAST(ssize_t, xsh_sizeof)) {
  ------------------
  |  |  444|   104k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 25.5k, False: 26.7k]
  |  |  ------------------
  ------------------
 1414|    474|			if (file_printf(ms, ", can't read elf section at %jd",
  ------------------
  |  Branch (1414:8): [True: 0, False: 474]
  ------------------
 1415|    474|			    (intmax_t)off) == -1)
 1416|      0|				return -1;
 1417|    474|			return 0;
 1418|    474|		}
 1419|  51.7k|		off += size;
 1420|       |
 1421|       |		/* Things we can determine before we seek */
 1422|  51.7k|		switch (xsh_type) {
  ------------------
  |  |  156|  51.7k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  51.7k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (156:19): [True: 25.1k, False: 26.5k]
  |  |  ------------------
  |  |  157|  51.7k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  141|  25.1k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  158|  51.7k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  141|  26.5k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1423|  1.11k|		case SHT_SYMTAB:
  ------------------
  |  |  141|  1.11k|#define	SHT_SYMTAB	2
  ------------------
  |  Branch (1423:3): [True: 1.11k, False: 50.6k]
  ------------------
 1424|       |#if 0
 1425|       |		case SHT_DYNSYM:
 1426|       |#endif
 1427|  1.11k|			stripped = 0;
 1428|  1.11k|			break;
 1429|  50.6k|		default:
  ------------------
  |  Branch (1429:3): [True: 50.6k, False: 1.11k]
  ------------------
 1430|  50.6k|			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |   63|  50.6k|#define SIZE_UNKNOWN	CAST(off_t, -1)
  |  |  ------------------
  |  |  |  |  444|   101k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              			if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) {
  ------------------
  |  |  153|  50.6k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|   101k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 24.9k, False: 25.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  50.6k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  155|  50.6k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1430:8): [True: 50.6k, False: 0]
  |  Branch (1430:33): [True: 29.0k, False: 21.5k]
  ------------------
 1431|       |				/* Perhaps warn here */
 1432|  29.0k|				continue;
 1433|  29.0k|			}
 1434|  21.5k|			break;
 1435|  51.7k|		}
 1436|       |
 1437|       |
 1438|       |		/* Things we can determine when we seek */
 1439|  22.6k|		switch (xsh_type) {
  ------------------
  |  |  156|  22.6k|#define xsh_type	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  22.6k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (156:19): [True: 12.2k, False: 10.4k]
  |  |  ------------------
  |  |  157|  22.6k|			 ? elf_getu32(swap, sh32.sh_type)	\
  |  |  ------------------
  |  |  |  |  141|  12.2k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  158|  22.6k|			 : elf_getu32(swap, sh64.sh_type))
  |  |  ------------------
  |  |  |  |  141|  10.4k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  ------------------
 1440|  1.43k|		case SHT_NOTE:
  ------------------
  |  |  142|  1.43k|#define	SHT_NOTE	7
  ------------------
  |  Branch (1440:3): [True: 1.43k, False: 21.2k]
  ------------------
 1441|  1.43k|			if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
  ------------------
  |  |  444|  5.72k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 955, False: 477]
  |  |  |  Branch (444:25): [True: 955, False: 477]
  |  |  ------------------
  ------------------
  |  Branch (1441:8): [True: 22, False: 1.41k]
  ------------------
 1442|  1.43k|			    CAST(uintmax_t, fsize)) {
  ------------------
  |  |  444|  1.43k|#define CAST(T, b)	((T)(b))
  ------------------
 1443|     22|				if (file_printf(ms,
  ------------------
  |  Branch (1443:9): [True: 0, False: 22]
  ------------------
 1444|     22|				    ", note offset/size %#" INTMAX_T_FORMAT
 1445|     22|				    "x+%#" INTMAX_T_FORMAT "x exceeds"
 1446|     22|				    " file size %#" INTMAX_T_FORMAT "x",
 1447|     22|				    CAST(uintmax_t, xsh_offset),
  ------------------
  |  |  444|     44|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 7, False: 15]
  |  |  ------------------
  ------------------
 1448|     22|				    CAST(uintmax_t, xsh_size),
  ------------------
  |  |  444|     44|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 7, False: 15]
  |  |  ------------------
  ------------------
 1449|     22|				    CAST(uintmax_t, fsize)) == -1)
  ------------------
  |  |  444|     22|#define CAST(T, b)	((T)(b))
  ------------------
 1450|      0|					return -1;
 1451|     22|				return 0;
 1452|     22|			}
 1453|  1.41k|			if (xsh_size > ms->elf_shsize_max) {
  ------------------
  |  |  150|  1.41k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  2.82k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 948, False: 462]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|  1.41k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  152|  1.41k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1453:8): [True: 3, False: 1.40k]
  ------------------
 1454|      3|				file_error(ms, errno, "Note section size too "
 1455|      3|				    "big (%ju > %zu)", (uintmax_t)xsh_size,
  ------------------
  |  |  150|      3|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|      6|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|      3|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  152|      3|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1456|      3|				    ms->elf_shsize_max);
 1457|      3|				return -1;
 1458|      3|			}
 1459|  1.40k|			if ((nbuf = malloc(xsh_size)) == NULL) {
  ------------------
  |  |  150|  1.40k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 948, False: 459]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|  1.40k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  152|  1.40k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1459:8): [True: 0, False: 1.40k]
  ------------------
 1460|      0|				file_error(ms, errno, "Cannot allocate memory"
 1461|      0|				    " for note");
 1462|      0|				return -1;
 1463|      0|			}
 1464|  1.40k|			offs = xsh_offset;
  ------------------
  |  |  153|  1.40k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 948, False: 459]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.40k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  155|  1.40k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
 1465|  1.40k|			if (pread(fd, nbuf, xsh_size, offs) <
  ------------------
  |  |  150|  1.40k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 948, False: 459]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|  1.40k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  152|  1.40k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
  |  Branch (1465:8): [True: 11, False: 1.39k]
  ------------------
 1466|  1.40k|			    CAST(ssize_t, xsh_size)) {
  ------------------
  |  |  444|  2.81k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 948, False: 459]
  |  |  ------------------
  ------------------
 1467|     11|				free(nbuf);
 1468|     11|				if (file_printf(ms,
  ------------------
  |  Branch (1468:9): [True: 0, False: 11]
  ------------------
 1469|     11|				    ", can't read elf note at %jd",
 1470|     11|				    (intmax_t)offs) == -1)
 1471|      0|					return -1;
 1472|     11|				return 0;
 1473|     11|			}
 1474|       |
 1475|  1.39k|			noff = 0;
 1476|  2.67k|			for (;;) {
 1477|  2.67k|				if (noff >= CAST(off_t, xsh_size))
  ------------------
  |  |  444|  5.35k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 1.90k, False: 774]
  |  |  ------------------
  ------------------
  |  Branch (1477:9): [True: 1.24k, False: 1.43k]
  ------------------
 1478|  1.24k|					break;
 1479|  1.43k|				noff = donote(ms, nbuf, CAST(size_t, noff),
  ------------------
  |  |  444|  1.43k|#define CAST(T, b)	((T)(b))
  ------------------
 1480|  1.43k|				    xsh_size, clazz, swap, 4, flags, notecount,
  ------------------
  |  |  150|  1.43k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  2.87k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 1.11k, False: 326]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|  1.43k|			 ? elf_getu32(swap, sh32.sh_size)	\
  |  |  152|  1.43k|			 : elf_getu64(swap, sh64.sh_size)))
  ------------------
 1481|  1.43k|				    fd, 0, 0, 0);
 1482|  1.43k|				if (noff == 0)
  ------------------
  |  Branch (1482:9): [True: 156, False: 1.28k]
  ------------------
 1483|    156|					break;
 1484|  1.43k|			}
 1485|  1.39k|			free(nbuf);
 1486|  1.39k|			break;
 1487|  1.85k|		case SHT_SUNW_cap:
  ------------------
  |  |  144|  1.85k|#define	SHT_SUNW_cap	0x6ffffff5	/* SunOS 5.x hw/sw capabilities */
  ------------------
  |  Branch (1487:3): [True: 1.85k, False: 20.8k]
  ------------------
 1488|  1.85k|			switch (mach) {
 1489|    192|			case EM_SPARC:
  ------------------
  |  |  133|    192|#define	EM_SPARC	2
  ------------------
  |  Branch (1489:4): [True: 192, False: 1.66k]
  ------------------
 1490|    786|			case EM_SPARCV9:
  ------------------
  |  |  136|    786|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1490:4): [True: 594, False: 1.26k]
  ------------------
 1491|    911|			case EM_IA_64:
  ------------------
  |  |  137|    911|#define	EM_IA_64	50
  ------------------
  |  Branch (1491:4): [True: 125, False: 1.73k]
  ------------------
 1492|  1.52k|			case EM_386:
  ------------------
  |  |  134|  1.52k|#define	EM_386		3
  ------------------
  |  Branch (1492:4): [True: 614, False: 1.24k]
  ------------------
 1493|  1.78k|			case EM_AMD64:
  ------------------
  |  |  138|  1.78k|#define	EM_AMD64	62
  ------------------
  |  Branch (1493:4): [True: 259, False: 1.59k]
  ------------------
 1494|  1.78k|				break;
 1495|     72|			default:
  ------------------
  |  Branch (1495:4): [True: 72, False: 1.78k]
  ------------------
 1496|     72|				goto skip;
 1497|  1.85k|			}
 1498|       |
 1499|  1.78k|			if (nbadcap > 5)
  ------------------
  |  Branch (1499:8): [True: 727, False: 1.05k]
  ------------------
 1500|    727|				break;
 1501|  1.05k|			if (lseek(fd, xsh_offset, SEEK_SET)
  ------------------
  |  |  153|  1.05k|#define xsh_offset	CAST(off_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|  2.11k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 735, False: 322]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.05k|			 ? elf_getu32(swap, sh32.sh_offset)	\
  |  |  155|  1.05k|			 : elf_getu64(swap, sh64.sh_offset)))
  ------------------
  |  Branch (1501:8): [True: 1, False: 1.05k]
  ------------------
 1502|  1.05k|			    == CAST(off_t, -1)) {
  ------------------
  |  |  444|  1.05k|#define CAST(T, b)	((T)(b))
  ------------------
 1503|      1|				file_badseek(ms);
 1504|      1|				return -1;
 1505|      1|			}
 1506|  1.05k|			coff = 0;
 1507|  67.4k|			for (;;) {
 1508|  67.4k|				Elf32_Cap cap32;
 1509|  67.4k|				Elf64_Cap cap64;
 1510|  67.4k|				char cbuf[/*CONSTCOND*/
 1511|  67.4k|				    MAX(sizeof(cap32), sizeof(cap64))];
 1512|  67.4k|				if ((coff += xcap_sizeof) >
  ------------------
  |  |  223|  67.4k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  67.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (223:22): [True: 5.35k, False: 62.1k]
  |  |  ------------------
  |  |  224|  67.4k|			 ? sizeof(cap32)			\
  |  |  225|  67.4k|			 : sizeof(cap64))
  ------------------
  |  Branch (1512:9): [True: 570, False: 66.8k]
  ------------------
 1513|  67.4k|				    CAST(off_t, xsh_size))
  ------------------
  |  |  444|   134k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 5.35k, False: 62.1k]
  |  |  ------------------
  ------------------
 1514|    570|					break;
 1515|  66.8k|				if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
  ------------------
  |  |  444|   133k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 5.01k, False: 61.8k]
  |  |  ------------------
  ------------------
  |  Branch (1515:9): [True: 90, False: 66.8k]
  ------------------
 1516|  66.8k|				    CAST(ssize_t, xcap_sizeof)) {
  ------------------
  |  |  444|   133k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 5.01k, False: 61.8k]
  |  |  ------------------
  ------------------
 1517|     90|					file_badread(ms);
 1518|     90|					return -1;
 1519|     90|				}
 1520|  66.8k|				if (cbuf[0] == 'A') {
  ------------------
  |  Branch (1520:9): [True: 396, False: 66.4k]
  ------------------
 1521|       |#ifdef notyet
 1522|       |					char *p = cbuf + 1;
 1523|       |					uint32_t len, tag;
 1524|       |					memcpy(&len, p, sizeof(len));
 1525|       |					p += 4;
 1526|       |					len = getu32(swap, len);
 1527|       |					if (memcmp("gnu", p, 3) != 0) {
 1528|       |					    if (file_printf(ms,
 1529|       |						", unknown capability %.3s", p)
 1530|       |						== -1)
 1531|       |						return -1;
 1532|       |					    break;
 1533|       |					}
 1534|       |					p += strlen(p) + 1;
 1535|       |					tag = *p++;
 1536|       |					memcpy(&len, p, sizeof(len));
 1537|       |					p += 4;
 1538|       |					len = getu32(swap, len);
 1539|       |					if (tag != 1) {
 1540|       |					    if (file_printf(ms, ", unknown gnu"
 1541|       |						" capability tag %d", tag)
 1542|       |						== -1)
 1543|       |						return -1;
 1544|       |					    break;
 1545|       |					}
 1546|       |					// gnu attributes
 1547|       |#endif
 1548|    396|					break;
 1549|    396|				}
 1550|  66.4k|				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  220|  66.4k|#define xcap_addr	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  66.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (220:20): [True: 4.61k, False: 61.7k]
  |  |  ------------------
  |  |  221|  66.4k|			 ? CAST(void *, &cap32)			\
  |  |  ------------------
  |  |  |  |  444|  4.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  222|  66.4k|			 : CAST(void *, &cap64))
  |  |  ------------------
  |  |  |  |  444|  61.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              				memcpy(xcap_addr, cbuf, xcap_sizeof);
  ------------------
  |  |  223|  66.4k|#define xcap_sizeof	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  66.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (223:22): [True: 4.61k, False: 61.7k]
  |  |  ------------------
  |  |  224|  66.4k|			 ? sizeof(cap32)			\
  |  |  225|  66.4k|			 : sizeof(cap64))
  ------------------
 1551|  66.4k|				switch (xcap_tag) {
  ------------------
  |  |  226|  66.4k|#define xcap_tag	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  66.4k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (226:19): [True: 4.61k, False: 61.7k]
  |  |  ------------------
  |  |  227|  66.4k|			 ? elf_getu32(swap, cap32.c_tag)	\
  |  |  ------------------
  |  |  |  |  141|  4.61k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  228|  66.4k|			 : elf_getu64(swap, cap64.c_tag))
  |  |  ------------------
  |  |  |  |  142|  61.7k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1552|  7.28k|				case CA_SUNW_NULL:
  ------------------
  |  |  393|  7.28k|#define	CA_SUNW_NULL	0
  ------------------
  |  Branch (1552:5): [True: 7.28k, False: 59.1k]
  ------------------
 1553|  7.28k|					break;
 1554|  1.94k|				case CA_SUNW_HW_1:
  ------------------
  |  |  394|  1.94k|#define	CA_SUNW_HW_1	1
  ------------------
  |  Branch (1554:5): [True: 1.94k, False: 64.4k]
  ------------------
 1555|  1.94k|					cap_hw1 |= xcap_val;
  ------------------
  |  |  229|  1.94k|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  1.94k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (229:19): [True: 425, False: 1.51k]
  |  |  ------------------
  |  |  230|  1.94k|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  141|    425|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  231|  1.94k|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  142|  1.51k|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1556|  1.94k|					break;
 1557|  2.04k|				case CA_SUNW_SF_1:
  ------------------
  |  |  395|  2.04k|#define	CA_SUNW_SF_1	2
  ------------------
  |  Branch (1557:5): [True: 2.04k, False: 64.3k]
  ------------------
 1558|  2.04k|					cap_sf1 |= xcap_val;
  ------------------
  |  |  229|  2.04k|#define xcap_val	(clazz == ELFCLASS32			\
  |  |  ------------------
  |  |  |  |  153|  2.04k|#define	ELFCLASS32	1
  |  |  ------------------
  |  |  |  Branch (229:19): [True: 1.09k, False: 949]
  |  |  ------------------
  |  |  230|  2.04k|			 ? elf_getu32(swap, cap32.c_un.c_val)	\
  |  |  ------------------
  |  |  |  |  141|  1.09k|#define elf_getu32(swap, value) getu32(swap, value)
  |  |  ------------------
  |  |  231|  2.04k|			 : elf_getu64(swap, cap64.c_un.c_val))
  |  |  ------------------
  |  |  |  |  142|    949|#define elf_getu64(swap, value) getu64(swap, value)
  |  |  ------------------
  ------------------
 1559|  2.04k|					break;
 1560|  55.1k|				default:
  ------------------
  |  Branch (1560:5): [True: 55.1k, False: 11.2k]
  ------------------
 1561|  55.1k|					if (file_printf(ms,
  ------------------
  |  Branch (1561:10): [True: 0, False: 55.1k]
  ------------------
 1562|  55.1k|					    ", with unknown capability "
 1563|  55.1k|					    "%#" INT64_T_FORMAT "x = %#"
 1564|  55.1k|					    INT64_T_FORMAT "x",
 1565|  55.1k|					    CAST(unsigned long long, xcap_tag),
  ------------------
  |  |  444|   110k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 700, False: 54.4k]
  |  |  ------------------
  ------------------
 1566|  55.1k|					    CAST(unsigned long long, xcap_val))
  ------------------
  |  |  444|   110k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 700, False: 54.4k]
  |  |  ------------------
  ------------------
 1567|  55.1k|					    == -1)
 1568|      0|						return -1;
 1569|  55.1k|					if (nbadcap++ > 2)
  ------------------
  |  Branch (1569:10): [True: 54.0k, False: 1.06k]
  ------------------
 1570|  54.0k|						coff = xsh_size;
  ------------------
  |  |  150|  54.0k|#define xsh_size	CAST(size_t, (clazz == ELFCLASS32	\
  |  |  ------------------
  |  |  |  |  444|   108k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 206, False: 53.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1571|  55.1k|					break;
 1572|  66.4k|				}
 1573|  66.4k|			}
 1574|       |			/*FALLTHROUGH*/
 1575|  1.03k|		skip:
 1576|  20.4k|		default:
  ------------------
  |  Branch (1576:3): [True: 19.3k, False: 3.28k]
  ------------------
 1577|  20.4k|			break;
 1578|  22.6k|		}
 1579|  22.6k|	}
 1580|       |
 1581|    186|	if (has_debug_info) {
  ------------------
  |  Branch (1581:6): [True: 1, False: 185]
  ------------------
 1582|      1|		if (file_printf(ms, ", with debug_info") == -1)
  ------------------
  |  Branch (1582:7): [True: 0, False: 1]
  ------------------
 1583|      0|			return -1;
 1584|      1|	}
 1585|    186|	if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
  ------------------
  |  Branch (1585:6): [True: 0, False: 186]
  |  Branch (1585:38): [True: 162, False: 24]
  ------------------
 1586|      0|		return -1;
 1587|    186|	if (cap_hw1) {
  ------------------
  |  Branch (1587:6): [True: 92, False: 94]
  ------------------
 1588|     92|		const cap_desc_t *cdp;
 1589|     92|		switch (mach) {
 1590|      6|		case EM_SPARC:
  ------------------
  |  |  133|      6|#define	EM_SPARC	2
  ------------------
  |  Branch (1590:3): [True: 6, False: 86]
  ------------------
 1591|      6|		case EM_SPARC32PLUS:
  ------------------
  |  |  135|      6|#define	EM_SPARC32PLUS	18
  ------------------
  |  Branch (1591:3): [True: 0, False: 92]
  ------------------
 1592|     51|		case EM_SPARCV9:
  ------------------
  |  |  136|     51|#define	EM_SPARCV9	43
  ------------------
  |  Branch (1592:3): [True: 45, False: 47]
  ------------------
 1593|     51|			cdp = cap_desc_sparc;
 1594|     51|			break;
 1595|      5|		case EM_386:
  ------------------
  |  |  134|      5|#define	EM_386		3
  ------------------
  |  Branch (1595:3): [True: 5, False: 87]
  ------------------
 1596|      5|		case EM_IA_64:
  ------------------
  |  |  137|      5|#define	EM_IA_64	50
  ------------------
  |  Branch (1596:3): [True: 0, False: 92]
  ------------------
 1597|     41|		case EM_AMD64:
  ------------------
  |  |  138|     41|#define	EM_AMD64	62
  ------------------
  |  Branch (1597:3): [True: 36, False: 56]
  ------------------
 1598|     41|			cdp = cap_desc_386;
 1599|     41|			break;
 1600|      0|		default:
  ------------------
  |  Branch (1600:3): [True: 0, False: 92]
  ------------------
 1601|      0|			cdp = NULL;
 1602|      0|			break;
 1603|     92|		}
 1604|     92|		if (file_printf(ms, ", uses") == -1)
  ------------------
  |  Branch (1604:7): [True: 0, False: 92]
  ------------------
 1605|      0|			return -1;
 1606|     92|		if (cdp) {
  ------------------
  |  Branch (1606:7): [True: 92, False: 0]
  ------------------
 1607|  1.67k|			while (cdp->cd_name) {
  ------------------
  |  Branch (1607:11): [True: 1.58k, False: 92]
  ------------------
 1608|  1.58k|				if (cap_hw1 & cdp->cd_mask) {
  ------------------
  |  Branch (1608:9): [True: 854, False: 732]
  ------------------
 1609|    854|					if (file_printf(ms,
  ------------------
  |  Branch (1609:10): [True: 0, False: 854]
  ------------------
 1610|    854|					    " %s", cdp->cd_name) == -1)
 1611|      0|						return -1;
 1612|    854|					cap_hw1 &= ~cdp->cd_mask;
 1613|    854|				}
 1614|  1.58k|				++cdp;
 1615|  1.58k|			}
 1616|     92|			if (cap_hw1)
  ------------------
  |  Branch (1616:8): [True: 84, False: 8]
  ------------------
 1617|     84|				if (file_printf(ms,
  ------------------
  |  Branch (1617:9): [True: 0, False: 84]
  ------------------
 1618|     84|				    " unknown hardware capability %#"
 1619|     84|				    INT64_T_FORMAT "x",
 1620|     84|				    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  444|     84|#define CAST(T, b)	((T)(b))
  ------------------
 1621|      0|					return -1;
 1622|     92|		} else {
 1623|      0|			if (file_printf(ms,
  ------------------
  |  Branch (1623:8): [True: 0, False: 0]
  ------------------
 1624|      0|			    " hardware capability %#" INT64_T_FORMAT "x",
 1625|      0|			    CAST(unsigned long long, cap_hw1)) == -1)
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1626|      0|				return -1;
 1627|      0|		}
 1628|     92|	}
 1629|    186|	if (cap_sf1) {
  ------------------
  |  Branch (1629:6): [True: 97, False: 89]
  ------------------
 1630|     97|		if (cap_sf1 & SF1_SUNW_FPUSED) {
  ------------------
  |  |  399|     97|#define	SF1_SUNW_FPUSED	0x02
  ------------------
  |  Branch (1630:7): [True: 33, False: 64]
  ------------------
 1631|     33|			if (file_printf(ms,
  ------------------
  |  Branch (1631:8): [True: 0, False: 33]
  ------------------
 1632|     33|			    (cap_sf1 & SF1_SUNW_FPKNWN)
  ------------------
  |  |  398|     33|#define	SF1_SUNW_FPKNWN	0x01
  ------------------
  |  Branch (1632:8): [True: 28, False: 5]
  ------------------
 1633|     33|			    ? ", uses frame pointer"
 1634|     33|			    : ", not known to use frame pointer") == -1)
 1635|      0|				return -1;
 1636|     33|		}
 1637|     97|		cap_sf1 &= ~SF1_SUNW_MASK;
  ------------------
  |  |  400|     97|#define	SF1_SUNW_MASK	0x03
  ------------------
 1638|     97|		if (cap_sf1)
  ------------------
  |  Branch (1638:7): [True: 93, False: 4]
  ------------------
 1639|     93|			if (file_printf(ms,
  ------------------
  |  Branch (1639:8): [True: 0, False: 93]
  ------------------
 1640|     93|			    ", with unknown software capability %#"
 1641|     93|			    INT64_T_FORMAT "x",
 1642|     93|			    CAST(unsigned long long, cap_sf1)) == -1)
  ------------------
  |  |  444|     93|#define CAST(T, b)	((T)(b))
  ------------------
 1643|      0|				return -1;
 1644|     97|	}
 1645|    186|	return 0;
 1646|    186|}
readelf.c:getu64:
  117|   381k|{
  118|   381k|	union {
  119|   381k|		uint64_t ui;
  120|   381k|		char c[8];
  121|   381k|	} retval, tmpval;
  122|       |
  123|   381k|	if (swap) {
  ------------------
  |  Branch (123:6): [True: 281k, False: 100k]
  ------------------
  124|   281k|		tmpval.ui = value;
  125|       |
  126|   281k|		retval.c[0] = tmpval.c[7];
  127|   281k|		retval.c[1] = tmpval.c[6];
  128|   281k|		retval.c[2] = tmpval.c[5];
  129|   281k|		retval.c[3] = tmpval.c[4];
  130|   281k|		retval.c[4] = tmpval.c[3];
  131|   281k|		retval.c[5] = tmpval.c[2];
  132|   281k|		retval.c[6] = tmpval.c[1];
  133|   281k|		retval.c[7] = tmpval.c[0];
  134|       |
  135|   281k|		return retval.ui;
  136|   281k|	} else
  137|   100k|		return value;
  138|   381k|}

file_softmagic:
  121|  11.2k|{
  122|  11.2k|	struct mlist *ml;
  123|  11.2k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  124|  11.2k|	uint16_t nc, ic;
  125|       |
  126|  11.2k|	if (name_count == NULL) {
  ------------------
  |  Branch (126:6): [True: 11.2k, False: 0]
  ------------------
  127|  11.2k|		nc = 0;
  128|  11.2k|		name_count = &nc;
  129|  11.2k|	}
  130|  11.2k|	if (indir_count == NULL) {
  ------------------
  |  Branch (130:6): [True: 11.2k, False: 0]
  ------------------
  131|  11.2k|		ic = 0;
  132|  11.2k|		indir_count = &ic;
  133|  11.2k|	}
  134|       |
  135|  22.4k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (135:32): [True: 11.2k, False: 11.2k]
  ------------------
  136|  11.2k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  137|  11.2k|		    0, mode, text, 0, indir_count, name_count,
  138|  11.2k|		    &printed_something, &need_separator, &firstline,
  139|  11.2k|		    NULL, NULL);
  140|  11.2k|		switch (ret) {
  141|     79|		case -1:
  ------------------
  |  Branch (141:3): [True: 79, False: 11.2k]
  ------------------
  142|     79|			return ret;
  143|  3.74k|		case 0:
  ------------------
  |  Branch (143:3): [True: 3.74k, False: 7.53k]
  ------------------
  144|  3.74k|			continue;
  145|  7.45k|		default:
  ------------------
  |  Branch (145:3): [True: 7.45k, False: 3.82k]
  ------------------
  146|  7.45k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  7.45k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (146:8): [True: 0, False: 7.45k]
  ------------------
  147|      0|				return ret;
  148|  7.45k|			rv = ret;
  149|  7.45k|			break;
  150|  11.2k|		}
  151|  11.2k|	}
  152|       |
  153|  11.2k|	return rv;
  154|  11.2k|}
softmagic.c:match:
  213|  69.6k|{
  214|  69.6k|	uint32_t magindex = 0;
  215|  69.6k|	unsigned int cont_level = 0;
  216|  69.6k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  217|  69.6k|	int returnvalv = 0, e;
  218|  69.6k|	struct buffer bb;
  219|  69.6k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  69.6k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  69.6k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  69.6k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  69.6k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  69.6k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  69.6k|#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|  69.6k|	if (returnval == NULL)
  ------------------
  |  Branch (225:6): [True: 25.0k, False: 44.6k]
  ------------------
  226|  25.0k|		returnval = &returnvalv;
  227|  69.6k|	if (found_match == NULL)
  ------------------
  |  Branch (227:6): [True: 25.0k, False: 44.6k]
  ------------------
  228|  25.0k|		found_match = &found_matchv;
  229|       |
  230|  69.6k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (230:6): [True: 0, False: 69.6k]
  ------------------
  231|      0|		return -1;
  232|       |
  233|  88.9M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (233:21): [True: 88.8M, False: 67.8k]
  ------------------
  234|  88.8M|		int flush = 0;
  235|  88.8M|		struct magic *m = &magic[magindex];
  236|  88.8M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  237|       |
  238|  88.8M|		if (m->type != FILE_NAME)
  ------------------
  |  |  285|  88.8M|#define				FILE_NAME		45
  ------------------
  |  Branch (238:7): [True: 88.8M, False: 44.6k]
  ------------------
  239|  88.8M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  303|   177M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  245|   177M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (303:3): [True: 55.1M, False: 33.7M]
  |  |  ------------------
  |  |  304|  88.8M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  253|   122M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (304:3): [True: 24.9k, False: 33.7M]
  |  |  ------------------
  |  |  305|  88.8M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  258|   122M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (305:3): [True: 0, False: 33.7M]
  |  |  ------------------
  |  |  306|  88.8M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  259|   122M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (306:3): [True: 49.5k, False: 33.6M]
  |  |  ------------------
  |  |  307|  88.8M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  257|   122M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (307:3): [True: 1.67M, False: 31.9M]
  |  |  ------------------
  |  |  308|  88.8M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  260|   120M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (308:3): [True: 6.03M, False: 25.9M]
  |  |  ------------------
  |  |  309|  88.8M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  281|   114M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (309:3): [True: 0, False: 25.9M]
  |  |  ------------------
  |  |  310|  88.8M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  285|   114M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (310:3): [True: 0, False: 25.9M]
  |  |  ------------------
  |  |  311|  88.8M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  286|   114M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (311:3): [True: 0, False: 25.9M]
  |  |  ------------------
  |  |  312|   177M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  299|  25.9M|#define				FILE_OCTAL		59
  |  |  ------------------
  |  |  |  Branch (312:3): [True: 0, False: 25.9M]
  |  |  ------------------
  ------------------
  240|  88.8M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  241|  88.8M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  375|  7.91M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  240|  7.91M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  395|  7.91M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  7.91M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  394|  7.91M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  7.91M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  395|  7.91M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  388|  7.91M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (241:10): [True: 7.91M, False: 54.9M]
  |  Branch (241:18): [True: 301k, False: 7.61M]
  ------------------
  242|  62.8M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  375|  54.9M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  240|  54.9M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  395|  54.9M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  54.9M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  394|  54.9M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  54.9M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  394|  54.9M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  388|  54.9M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (242:10): [True: 54.9M, False: 7.61M]
  |  Branch (242:19): [True: 2.54M, False: 52.4M]
  ------------------
  243|  88.8M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (243:7): [True: 11.2M, False: 74.6M]
  ------------------
  244|  88.6M|flush:
  245|       |			/* Skip sub-tests */
  246|   401M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (246:11): [True: 401M, False: 22.7k]
  ------------------
  247|   401M|			    magic[magindex + 1].cont_level != 0)
  ------------------
  |  Branch (247:8): [True: 313M, False: 88.5M]
  ------------------
  248|   313M|				magindex++;
  249|  88.6M|			cont_level = 0;
  250|  88.6M|			continue; /* Skip to next top-level test*/
  251|  14.1M|		}
  252|       |
  253|  74.7M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (253:7): [True: 49.5k, False: 74.6M]
  ------------------
  254|  49.5k|			goto flush;
  255|  74.6M|		ms->line = m->lineno;
  256|       |
  257|       |		/* if main entry matches, print it... */
  258|  74.6M|		switch (mget(ms, m, b, CAST(const unsigned char *, bb.fbuf),
  ------------------
  |  |  444|  74.6M|#define CAST(T, b)	((T)(b))
  ------------------
  259|  74.6M|		    bb.flen, offset, cont_level,
  260|  74.6M|		    mode, text, flip, indir_count, name_count,
  261|  74.6M|		    printed_something, need_separator, firstline, returnval,
  262|  74.6M|		    found_match))
  263|  74.6M|		{
  264|    335|		case -1:
  ------------------
  |  Branch (264:3): [True: 335, False: 74.6M]
  ------------------
  265|    335|			return -1;
  266|  10.9M|		case 0:
  ------------------
  |  Branch (266:3): [True: 10.9M, False: 63.7M]
  ------------------
  267|  10.9M|			flush = m->reln != '!';
  268|  10.9M|			break;
  269|  63.7M|		default:
  ------------------
  |  Branch (269:3): [True: 63.7M, False: 10.9M]
  ------------------
  270|  63.7M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  281|  63.7M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (270:8): [True: 0, False: 63.7M]
  ------------------
  271|      0|				*found_match = 1;
  272|      0|				*returnval = 1;
  273|      0|			}
  274|       |
  275|  63.7M|			switch (magiccheck(ms, m, m_rxcomp)) {
  276|      0|			case -1:
  ------------------
  |  Branch (276:4): [True: 0, False: 63.7M]
  ------------------
  277|      0|				return -1;
  278|  63.4M|			case 0:
  ------------------
  |  Branch (278:4): [True: 63.4M, False: 291k]
  ------------------
  279|  63.4M|				flush++;
  280|  63.4M|				break;
  281|   291k|			default:
  ------------------
  |  Branch (281:4): [True: 291k, False: 63.4M]
  ------------------
  282|   291k|				flush = 0;
  283|   291k|				break;
  284|  63.7M|			}
  285|  63.7M|			break;
  286|  74.6M|		}
  287|  74.6M|		if (flush) {
  ------------------
  |  Branch (287:7): [True: 74.3M, False: 291k]
  ------------------
  288|       |			/*
  289|       |			 * main entry didn't match,
  290|       |			 * flush its continuations
  291|       |			 */
  292|  74.3M|			goto flush;
  293|  74.3M|		}
  294|       |
  295|   291k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (295:7): [True: 0, False: 291k]
  ------------------
  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|   291k|		if (*m->desc) {
  ------------------
  |  Branch (309:7): [True: 23.9k, False: 268k]
  ------------------
  310|  23.9k|			*found_match = 1;
  311|  23.9k|			if (print) {
  ------------------
  |  Branch (311:8): [True: 23.9k, False: 0]
  ------------------
  312|  23.9k|				*returnval = 1;
  313|  23.9k|				*need_separator = 1;
  314|  23.9k|				*printed_something = 1;
  315|  23.9k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (315:9): [True: 0, False: 23.9k]
  ------------------
  316|      0|					return -1;
  317|  23.9k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (317:9): [True: 0, False: 23.9k]
  ------------------
  318|      0|					return -1;
  319|  23.9k|			}
  320|  23.9k|		}
  321|       |
  322|   291k|		switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
  323|  19.6k|		case -1:
  ------------------
  |  Branch (323:3): [True: 19.6k, False: 272k]
  ------------------
  324|  19.6k|		case 0:
  ------------------
  |  Branch (324:3): [True: 0, False: 291k]
  ------------------
  325|  19.6k|			goto flush;
  326|   272k|		default:
  ------------------
  |  Branch (326:3): [True: 272k, False: 19.6k]
  ------------------
  327|   272k|			break;
  328|   291k|		}
  329|       |
  330|       |		/* and any continuations that match */
  331|   272k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (331:7): [True: 0, False: 272k]
  ------------------
  332|      0|			return -1;
  333|       |
  334|  4.44M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (334:10): [True: 4.40M, False: 45.1k]
  ------------------
  335|  4.44M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (335:7): [True: 4.17M, False: 225k]
  ------------------
  336|  4.17M|			m = &magic[++magindex];
  337|  4.17M|			m_rxcomp = &magic_rxcomp[magindex];
  338|  4.17M|			ms->line = m->lineno; /* for messages */
  339|       |
  340|  4.17M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (340:8): [True: 3.03M, False: 1.14M]
  ------------------
  341|  3.03M|				continue;
  342|  1.14M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (342:8): [True: 92.6k, False: 1.04M]
  ------------------
  343|       |				/*
  344|       |				 * We're at the end of the level
  345|       |				 * "cont_level" continuations.
  346|       |				 */
  347|  92.6k|				cont_level = m->cont_level;
  348|  92.6k|			}
  349|  1.14M|			if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (349:8): [True: 119, False: 1.14M]
  ------------------
  350|    119|				goto flush;
  351|  1.14M|			if (m->flag & OFFADD) {
  ------------------
  |  |  224|  1.14M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (351:8): [True: 81.3k, False: 1.06M]
  ------------------
  352|  81.3k|				if (cont_level == 0) {
  ------------------
  |  Branch (352:9): [True: 0, False: 81.3k]
  ------------------
  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|  81.3k|				ms->offset +=
  360|  81.3k|				    ms->c.li[cont_level - 1].off;
  361|  81.3k|			}
  362|       |
  363|  1.14M|#ifdef ENABLE_CONDITIONALS
  364|  1.14M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  356|  2.28M|#define				COND_ELSE	3
  ------------------
  |  Branch (364:8): [True: 0, False: 1.14M]
  ------------------
  365|  1.14M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  355|  1.14M|#define				COND_ELIF	2
  ------------------
  |  Branch (365:8): [True: 0, False: 1.14M]
  ------------------
  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.14M|#endif
  370|  1.14M|			switch (mget(ms, m, b, CAST(const unsigned char *,
  ------------------
  |  |  444|  1.14M|#define CAST(T, b)	((T)(b))
  ------------------
  371|  1.14M|			    bb.fbuf), bb.flen, offset,
  372|  1.14M|			    cont_level, mode, text, flip, indir_count,
  373|  1.14M|			    name_count, printed_something, need_separator,
  374|  1.14M|			    firstline, returnval, found_match)) {
  375|  1.46k|			case -1:
  ------------------
  |  Branch (375:4): [True: 1.46k, False: 1.14M]
  ------------------
  376|  1.46k|				return -1;
  377|  62.8k|			case 0:
  ------------------
  |  Branch (377:4): [True: 62.8k, False: 1.07M]
  ------------------
  378|  62.8k|				if (m->reln != '!')
  ------------------
  |  Branch (378:9): [True: 60.8k, False: 1.93k]
  ------------------
  379|  60.8k|					continue;
  380|  1.93k|				flush = 1;
  381|  1.93k|				break;
  382|  1.07M|			default:
  ------------------
  |  Branch (382:4): [True: 1.07M, False: 64.2k]
  ------------------
  383|  1.07M|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  281|  1.07M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (383:9): [True: 10.2k, False: 1.06M]
  ------------------
  384|  10.2k|					*found_match = 1;
  385|  10.2k|					*returnval = 1;
  386|  10.2k|				}
  387|  1.07M|				flush = 0;
  388|  1.07M|				break;
  389|  1.14M|			}
  390|       |
  391|  1.07M|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (391:12): [True: 1.93k, False: 1.07M]
  ------------------
  392|      0|			case -1:
  ------------------
  |  Branch (392:4): [True: 0, False: 1.07M]
  ------------------
  393|      0|				return -1;
  394|   831k|			case 0:
  ------------------
  |  Branch (394:4): [True: 831k, False: 248k]
  ------------------
  395|   831k|#ifdef ENABLE_CONDITIONALS
  396|   831k|				ms->c.li[cont_level].last_match = 0;
  397|   831k|#endif
  398|   831k|				break;
  399|   248k|			default:
  ------------------
  |  Branch (399:4): [True: 248k, False: 831k]
  ------------------
  400|   248k|#ifdef ENABLE_CONDITIONALS
  401|   248k|				ms->c.li[cont_level].last_match = 1;
  402|   248k|#endif
  403|   248k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  287|   248k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (403:9): [True: 754, False: 247k]
  ------------------
  404|    754|					ms->c.li[cont_level].got_match = 0;
  405|   247k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (405:14): [True: 65.4k, False: 182k]
  ------------------
  406|  65.4k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  243|  65.4k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (406:10): [True: 988, False: 64.4k]
  ------------------
  407|    988|						break;
  408|  65.4k|				} else
  409|   182k|					ms->c.li[cont_level].got_match = 1;
  410|       |
  411|   247k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (411:9): [True: 0, False: 247k]
  ------------------
  412|   247k|				    != 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|   247k|				if (*m->desc) {
  ------------------
  |  Branch (419:9): [True: 87.4k, False: 159k]
  ------------------
  420|  87.4k|					*found_match = 1;
  421|  87.4k|				}
  422|   247k|				if (print && *m->desc) {
  ------------------
  |  Branch (422:9): [True: 247k, False: 0]
  |  Branch (422:18): [True: 87.4k, False: 159k]
  ------------------
  423|  87.4k|					*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|  87.4k|					if (!*printed_something) {
  ------------------
  |  Branch (435:10): [True: 13.6k, False: 73.8k]
  ------------------
  436|  13.6k|						*printed_something = 1;
  437|  13.6k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (437:11): [True: 0, False: 13.6k]
  ------------------
  438|  13.6k|						    == -1)
  439|      0|							return -1;
  440|  13.6k|					}
  441|       |					/* space if previous printed */
  442|  87.4k|					if (*need_separator
  ------------------
  |  Branch (442:10): [True: 83.0k, False: 4.37k]
  ------------------
  443|  87.4k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  227|  83.0k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (443:13): [True: 28.8k, False: 54.1k]
  ------------------
  444|  28.8k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (444:11): [True: 0, False: 28.8k]
  ------------------
  445|      0|							return -1;
  446|  28.8k|					}
  447|  87.4k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (447:10): [True: 0, False: 87.4k]
  ------------------
  448|      0|						return -1;
  449|  87.4k|					*need_separator = 1;
  450|  87.4k|				}
  451|       |
  452|   247k|				switch (moffset(ms, m, &bb,
  453|   247k|				    &ms->c.li[cont_level].off)) {
  454|  3.45k|				case -1:
  ------------------
  |  Branch (454:5): [True: 3.45k, False: 243k]
  ------------------
  455|  3.45k|				case 0:
  ------------------
  |  Branch (455:5): [True: 0, False: 247k]
  ------------------
  456|  3.45k|					cont_level--;
  457|  3.45k|					break;
  458|   243k|				default:
  ------------------
  |  Branch (458:5): [True: 243k, False: 3.45k]
  ------------------
  459|   243k|					break;
  460|   247k|				}
  461|       |
  462|       |				/*
  463|       |				 * If we see any continuations
  464|       |				 * at a higher level,
  465|       |				 * process them.
  466|       |				 */
  467|   247k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (467:9): [True: 0, False: 247k]
  ------------------
  468|      0|					return -1;
  469|   247k|				break;
  470|  1.07M|			}
  471|  1.07M|		}
  472|   270k|		if (*printed_something) {
  ------------------
  |  Branch (472:7): [True: 75.0k, False: 195k]
  ------------------
  473|  75.0k|			*firstline = 0;
  474|  75.0k|		}
  475|   270k|		if (*found_match) {
  ------------------
  |  Branch (475:7): [True: 189k, False: 80.6k]
  ------------------
  476|   189k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   189k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (476:8): [True: 0, False: 189k]
  ------------------
  477|      0|				return *returnval;
  478|       |			// So that we print a separator
  479|   189k|			*printed_something = 0;
  480|   189k|			*firstline = 0;
  481|   189k|		}
  482|   270k|		cont_level = 0;
  483|   270k|	}
  484|  67.8k|	return *returnval;
  485|  69.6k|}
softmagic.c:msetoffset:
 1515|  75.8M|{
 1516|  75.8M|	int32_t offset;
 1517|  75.8M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  231|  75.8M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1517:6): [True: 192k, False: 75.6M]
  ------------------
 1518|   192k|		offset = -m->offset;
 1519|   192k|		if (cont_level > 0) {
  ------------------
  |  Branch (1519:7): [True: 7.36k, False: 185k]
  ------------------
 1520|  7.36k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  224|  7.36k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  225|  7.36k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1520:8): [True: 5.09k, False: 2.27k]
  ------------------
 1521|  5.09k|				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|  7.36k|		}
 1528|   187k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1528:7): [True: 13.9k, False: 173k]
  ------------------
 1529|  13.9k|			return -1;
 1530|   173k|		if (o != 0) {
  ------------------
  |  Branch (1530:7): [True: 0, False: 173k]
  ------------------
 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|   173k|		if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  444|   173k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1536:7): [True: 35.7k, False: 138k]
  ------------------
 1537|  35.7k|			return -1;
 1538|   138k|		buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1539|   138k|		ms->eoffset = ms->offset = CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  444|   138k|#define CAST(T, b)	((T)(b))
  ------------------
 1540|  75.6M|	} else {
 1541|  75.6M|		offset = m->offset;
 1542|  75.6M|		if (cont_level == 0) {
  ------------------
  |  Branch (1542:7): [True: 74.5M, False: 1.13M]
  ------------------
 1543|  74.5M|normal:
 1544|       |			// XXX: Pass real fd, then who frees bb?
 1545|  74.5M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1546|  74.5M|			ms->offset = offset;
 1547|  74.5M|			ms->eoffset = 0;
 1548|  74.5M|		} else {
 1549|  1.13M|			ms->offset = ms->eoffset + offset;
 1550|  1.13M|		}
 1551|  75.6M|	}
 1552|  75.8M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  75.8M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1552:6): [True: 0, False: 75.8M]
  ------------------
 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|  75.8M|	return 0;
 1560|  75.8M|}
softmagic.c:mget:
 1590|  75.8M|{
 1591|  75.8M|	uint32_t eoffset, offset = ms->offset;
 1592|  75.8M|	struct buffer bb;
 1593|  75.8M|	intmax_t lhs;
 1594|  75.8M|	file_pushbuf_t *pb;
 1595|  75.8M|	int rv, oneed_separator, in_type, nfound_match;
 1596|  75.8M|	char *rbuf;
 1597|  75.8M|	union VALUETYPE *p = &ms->ms_value;
 1598|  75.8M|	struct mlist ml, *mlp;
 1599|  75.8M|	struct cont c;
 1600|       |
 1601|  75.8M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1601:6): [True: 405, False: 75.8M]
  ------------------
 1602|    405|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1603|    405|		    *indir_count);
 1604|    405|		return -1;
 1605|    405|	}
 1606|       |
 1607|  75.8M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1607:6): [True: 10, False: 75.8M]
  ------------------
 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|  75.8M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  223|  75.8M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1615:6): [True: 0, False: 75.8M]
  ------------------
 1616|  75.8M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  444|  75.8M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  444|  75.8M|#define CAST(T, b)	((T)(b))
  ------------------
 1617|      0|		return -1;
 1618|       |
 1619|  75.8M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  75.8M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1619:6): [True: 0, False: 75.8M]
  ------------------
 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|  75.8M|	if (m->flag & INDIR) {
  ------------------
  |  |  223|  75.8M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1632:6): [True: 93.1k, False: 75.7M]
  ------------------
 1633|  93.1k|		intmax_t off = m->in_offset;
 1634|  93.1k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  348|  93.1k|#define				FILE_OPSIGNED	0x20
  ------------------
 1635|  93.1k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  350|  93.1k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1635:7): [True: 691, False: 92.4k]
  ------------------
 1636|    691|			const union VALUETYPE *q = CAST(const union VALUETYPE *,
  ------------------
  |  |  444|    691|#define CAST(T, b)	((T)(b))
  ------------------
 1637|    691|			    RCAST(const void *, s + offset + off));
 1638|    691|			int op;
 1639|    691|			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: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 1666|      0|			case FILE_BEID3:
  ------------------
  |  |  279|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1666:4): [True: 0, False: 691]
  ------------------
 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: 691]
  ------------------
 1672|    691|			case FILE_LELONG:
  ------------------
  |  |  251|    691|#define				FILE_LELONG		11
  ------------------
  |  Branch (1672:4): [True: 691, False: 0]
  ------------------
 1673|    691|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|    691|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  1.38k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 31, False: 660]
  |  |  |  Branch (72:59): [True: 68, False: 592]
  |  |  ------------------
  ------------------
 1674|     99|					return 0;
 1675|    592|				off = SEXT(sgn,32,LE32(q));
  ------------------
  |  |  109|    592|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 592]
  |  |  ------------------
  |  |  110|    592|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    592|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    592|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1676|    592|				break;
 1677|      0|			case FILE_MELONG:
  ------------------
  |  |  263|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1677:4): [True: 0, False: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 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: 691]
  ------------------
 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|    691|			}
 1702|    592|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    592|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1702:8): [True: 0, False: 592]
  ------------------
 1703|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1704|    592|		}
 1705|  93.0k|		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: 75.5k]
  ------------------
 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: 3, False: 17.4k]
  |  |  |  Branch (72:59): [True: 21, False: 17.4k]
  |  |  ------------------
  ------------------
 1708|     24|				return 0;
 1709|  17.4k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  109|  17.4k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 17.4k]
  |  |  ------------------
  |  |  110|  17.4k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  17.4k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  17.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1709:8): [True: 0, False: 17.4k]
  ------------------
 1710|      0|				return 0;
 1711|  17.4k|			break;
 1712|  20.2k|		case FILE_BESHORT:
  ------------------
  |  |  247|  20.2k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1712:3): [True: 20.2k, False: 72.8k]
  ------------------
 1713|  20.2k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  20.2k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  40.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 44, False: 20.1k]
  |  |  |  Branch (72:59): [True: 69, False: 20.1k]
  |  |  ------------------
  ------------------
 1714|    113|				return 0;
 1715|  20.1k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p)), off))
  ------------------
  |  |  109|  20.1k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 20.1k]
  |  |  ------------------
  |  |  110|  20.1k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  20.1k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  20.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1715:8): [True: 0, False: 20.1k]
  ------------------
 1716|      0|				return 0;
 1717|  20.1k|			break;
 1718|  20.1k|		case FILE_LESHORT:
  ------------------
  |  |  250|  4.58k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1718:3): [True: 4.58k, False: 88.4k]
  ------------------
 1719|  4.58k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  4.58k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  9.16k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 519, False: 4.06k]
  |  |  |  Branch (72:59): [True: 91, False: 3.97k]
  |  |  ------------------
  ------------------
 1720|    610|				return 0;
 1721|  3.97k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p)), off))
  ------------------
  |  |  109|  3.97k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 48, False: 3.92k]
  |  |  ------------------
  |  |  110|  3.97k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|     48|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  3.97k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  3.92k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1721:8): [True: 0, False: 3.97k]
  ------------------
 1722|      0|				return 0;
 1723|  3.97k|			break;
 1724|  3.97k|		case FILE_SHORT:
  ------------------
  |  |  242|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1724:3): [True: 0, False: 93.0k]
  ------------------
 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|  4.06k|		case FILE_BELONG:
  ------------------
  |  |  248|  4.06k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1730:3): [True: 4.06k, False: 89.0k]
  ------------------
 1731|  4.96k|		case FILE_BEID3:
  ------------------
  |  |  279|  4.96k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1731:3): [True: 902, False: 92.1k]
  ------------------
 1732|  4.96k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  4.96k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  9.93k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 76, False: 4.89k]
  |  |  |  Branch (72:59): [True: 120, False: 4.77k]
  |  |  ------------------
  ------------------
 1733|    196|				return 0;
 1734|  4.77k|			lhs = BE32(p);
  ------------------
  |  |   96|  4.77k|#define BE32(p) ( \
  |  |   97|  4.77k|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  4.77k|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  4.77k|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  100|  4.77k|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1735|  4.77k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  279|  4.77k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1735:8): [True: 877, False: 3.89k]
  ------------------
 1736|    877|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  444|    877|#define CAST(T, b)	((T)(b))
  ------------------
 1737|  4.77k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  109|  4.77k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 4.77k]
  |  |  ------------------
  |  |  110|  4.77k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  4.77k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1737:8): [True: 299, False: 4.47k]
  ------------------
 1738|    299|				return 0;
 1739|  4.47k|			break;
 1740|  42.9k|		case FILE_LELONG:
  ------------------
  |  |  251|  42.9k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1740:3): [True: 42.9k, False: 50.1k]
  ------------------
 1741|  42.9k|		case FILE_LEID3:
  ------------------
  |  |  280|  42.9k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1741:3): [True: 0, False: 93.0k]
  ------------------
 1742|  42.9k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  42.9k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  85.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 1.40k, False: 41.5k]
  |  |  |  Branch (72:59): [True: 2.04k, False: 39.4k]
  |  |  ------------------
  ------------------
 1743|  3.44k|				return 0;
 1744|  39.4k|			lhs = LE32(p);
  ------------------
  |  |   91|  39.4k|#define LE32(p) ( \
  |  |   92|  39.4k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  39.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  39.4k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  39.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  39.4k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  39.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   95|  39.4k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  444|  39.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1745|  39.4k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  280|  39.4k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1745:8): [True: 0, False: 39.4k]
  ------------------
 1746|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1747|  39.4k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  109|  39.4k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 39.4k]
  |  |  ------------------
  |  |  110|  39.4k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  39.4k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  39.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1747:8): [True: 443, False: 39.0k]
  ------------------
 1748|    443|				return 0;
 1749|  39.0k|			break;
 1750|  39.0k|		case FILE_MELONG:
  ------------------
  |  |  263|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1750:3): [True: 0, False: 93.0k]
  ------------------
 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|  2.60k|		case FILE_LONG:
  ------------------
  |  |  244|  2.60k|#define				FILE_LONG		4
  ------------------
  |  Branch (1756:3): [True: 2.60k, False: 90.4k]
  ------------------
 1757|  2.60k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  2.60k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  5.20k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 151, False: 2.45k]
  |  |  |  Branch (72:59): [True: 99, False: 2.35k]
  |  |  ------------------
  ------------------
 1758|    250|				return 0;
 1759|  2.35k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  109|  2.35k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 2.35k]
  |  |  ------------------
  |  |  110|  2.35k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  2.35k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  2.35k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1759:8): [True: 125, False: 2.22k]
  ------------------
 1760|    125|				return 0;
 1761|  2.22k|			break;
 1762|  2.22k|		case FILE_LEQUAD:
  ------------------
  |  |  265|    191|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1762:3): [True: 191, False: 92.8k]
  ------------------
 1763|    191|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    191|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    382|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 191]
  |  |  |  Branch (72:59): [True: 0, False: 191]
  |  |  ------------------
  ------------------
 1764|      0|				return 0;
 1765|    191|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p)), off))	
  ------------------
  |  |  109|    191|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 191]
  |  |  ------------------
  |  |  110|    191|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    191|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    191|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1765:8): [True: 116, False: 75]
  ------------------
 1766|    116|				return 0;
 1767|     75|			break;
 1768|    116|		case FILE_BEQUAD:
  ------------------
  |  |  266|    116|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1768:3): [True: 116, False: 92.9k]
  ------------------
 1769|    116|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    116|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    232|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 116]
  |  |  |  Branch (72:59): [True: 0, False: 116]
  |  |  ------------------
  ------------------
 1770|      0|				return 0;
 1771|    116|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p)), off))
  ------------------
  |  |  109|    116|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 116]
  |  |  ------------------
  |  |  110|    116|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    116|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    116|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1771:8): [True: 67, False: 49]
  ------------------
 1772|     67|				return 0;
 1773|     49|			break;
 1774|     49|		case FILE_OCTAL:
  ------------------
  |  |  299|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1774:3): [True: 0, False: 93.0k]
  ------------------
 1775|      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]
  |  |  ------------------
  ------------------
 1776|      0|				return 0;
 1777|      0|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1777:7): [True: 0, False: 0]
  ------------------
 1778|      0|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), 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))
  |  |  ------------------
  ------------------
 1779|      0|				return 0;
 1780|      0|			break;
 1781|      0|		default:
  ------------------
  |  Branch (1781:3): [True: 0, False: 93.0k]
  ------------------
 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|  93.0k|		}
 1786|       |
 1787|  87.3k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  225|  87.3k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1787:7): [True: 1.13k, False: 86.2k]
  ------------------
 1788|  1.13k|			if (cont_level == 0) {
  ------------------
  |  Branch (1788:8): [True: 0, False: 1.13k]
  ------------------
 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|  1.13k|			offset += ms->c.li[cont_level - 1].off;
 1795|  1.13k|			if (offset == 0) {
  ------------------
  |  Branch (1795:8): [True: 93, False: 1.04k]
  ------------------
 1796|     93|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|     93|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1796:9): [True: 0, False: 93]
  ------------------
 1797|      0|					fprintf(stderr,
 1798|      0|					    "indirect *zero* offset\n");
 1799|     93|				return 0;
 1800|     93|			}
 1801|  1.04k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.04k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1801:8): [True: 0, False: 1.04k]
  ------------------
 1802|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1803|  1.04k|		}
 1804|  87.2k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1804:7): [True: 0, False: 87.2k]
  ------------------
 1805|      0|			return -1;
 1806|  87.2k|		ms->offset = offset;
 1807|       |
 1808|  87.2k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  87.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1808:7): [True: 0, False: 87.2k]
  ------------------
 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|  87.2k|	}
 1816|       |
 1817|       |	/* Verify we have enough data to match magic type */
 1818|  75.8M|	switch (m->type) {
 1819|  1.15M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.15M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1819:2): [True: 1.15M, False: 74.6M]
  ------------------
 1820|  1.15M|		if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   72|  1.15M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.30M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 82.3k, False: 1.07M]
  |  |  |  Branch (72:59): [True: 9.92k, False: 1.06M]
  |  |  ------------------
  ------------------
 1821|  92.2k|			return 0;
 1822|  1.06M|		break;
 1823|       |
 1824|  1.06M|	case FILE_SHORT:
  ------------------
  |  |  242|   751k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1824:2): [True: 751k, False: 75.0M]
  ------------------
 1825|  4.06M|	case FILE_BESHORT:
  ------------------
  |  |  247|  4.06M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1825:2): [True: 3.31M, False: 72.5M]
  ------------------
 1826|  6.50M|	case FILE_LESHORT:
  ------------------
  |  |  250|  6.50M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1826:2): [True: 2.44M, False: 73.3M]
  ------------------
 1827|  6.50M|		if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  6.50M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  13.0M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 338k, False: 6.17M]
  |  |  |  Branch (72:59): [True: 92.3k, False: 6.07M]
  |  |  ------------------
  ------------------
 1828|   430k|			return 0;
 1829|  6.07M|		break;
 1830|       |
 1831|  6.07M|	case FILE_LONG:
  ------------------
  |  |  244|  1.16M|#define				FILE_LONG		4
  ------------------
  |  Branch (1831:2): [True: 1.16M, False: 74.6M]
  ------------------
 1832|  11.0M|	case FILE_BELONG:
  ------------------
  |  |  248|  11.0M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1832:2): [True: 9.90M, False: 65.9M]
  ------------------
 1833|  15.8M|	case FILE_LELONG:
  ------------------
  |  |  251|  15.8M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1833:2): [True: 4.78M, False: 71.0M]
  ------------------
 1834|  15.8M|	case FILE_MELONG:
  ------------------
  |  |  263|  15.8M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1834:2): [True: 28, False: 75.8M]
  ------------------
 1835|  15.8M|	case FILE_DATE:
  ------------------
  |  |  246|  15.8M|#define				FILE_DATE		6
  ------------------
  |  Branch (1835:2): [True: 0, False: 75.8M]
  ------------------
 1836|  15.8M|	case FILE_BEDATE:
  ------------------
  |  |  249|  15.8M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1836:2): [True: 203, False: 75.8M]
  ------------------
 1837|  15.8M|	case FILE_LEDATE:
  ------------------
  |  |  252|  15.8M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1837:2): [True: 106, False: 75.8M]
  ------------------
 1838|  15.8M|	case FILE_MEDATE:
  ------------------
  |  |  261|  15.8M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1838:2): [True: 34, False: 75.8M]
  ------------------
 1839|  15.8M|	case FILE_LDATE:
  ------------------
  |  |  254|  15.8M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1839:2): [True: 0, False: 75.8M]
  ------------------
 1840|  15.8M|	case FILE_BELDATE:
  ------------------
  |  |  255|  15.8M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1840:2): [True: 243, False: 75.8M]
  ------------------
 1841|  15.8M|	case FILE_LELDATE:
  ------------------
  |  |  256|  15.8M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1841:2): [True: 0, False: 75.8M]
  ------------------
 1842|  15.8M|	case FILE_MELDATE:
  ------------------
  |  |  262|  15.8M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1842:2): [True: 0, False: 75.8M]
  ------------------
 1843|  15.8M|	case FILE_FLOAT:
  ------------------
  |  |  273|  15.8M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1843:2): [True: 0, False: 75.8M]
  ------------------
 1844|  15.8M|	case FILE_BEFLOAT:
  ------------------
  |  |  274|  15.8M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1844:2): [True: 0, False: 75.8M]
  ------------------
 1845|  15.8M|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  15.8M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1845:2): [True: 1.18k, False: 75.8M]
  ------------------
 1846|  15.8M|		if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  15.8M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  31.7M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 741k, False: 15.1M]
  |  |  |  Branch (72:59): [True: 767k, False: 14.3M]
  |  |  ------------------
  ------------------
 1847|  1.50M|			return 0;
 1848|  14.3M|		break;
 1849|       |
 1850|  14.3M|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1850:2): [True: 0, False: 75.8M]
  ------------------
 1851|    165|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    165|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1851:2): [True: 165, False: 75.8M]
  ------------------
 1852|    425|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    425|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1852:2): [True: 260, False: 75.8M]
  ------------------
 1853|    425|		if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    425|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    850|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 84, False: 341]
  |  |  |  Branch (72:59): [True: 96, False: 245]
  |  |  ------------------
  ------------------
 1854|    180|			return 0;
 1855|    245|		break;
 1856|       |
 1857|   157k|	case FILE_GUID:
  ------------------
  |  |  289|   157k|#define				FILE_GUID		49
  ------------------
  |  Branch (1857:2): [True: 157k, False: 75.6M]
  ------------------
 1858|   157k|		if (OFFSET_OOB(nbytes, offset, 16))
  ------------------
  |  |   72|   157k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   314k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 157k]
  |  |  |  Branch (72:59): [True: 16.4k, False: 140k]
  |  |  ------------------
  ------------------
 1859|  16.4k|			return 0;
 1860|   140k|		break;
 1861|       |
 1862|  49.5M|	case FILE_STRING:
  ------------------
  |  |  245|  49.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1862:2): [True: 49.5M, False: 26.2M]
  ------------------
 1863|  49.5M|	case FILE_PSTRING:
  ------------------
  |  |  253|  49.5M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1863:2): [True: 24.2k, False: 75.7M]
  ------------------
 1864|  50.2M|	case FILE_SEARCH:
  ------------------
  |  |  260|  50.2M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1864:2): [True: 654k, False: 75.1M]
  ------------------
 1865|  50.2M|	case FILE_OCTAL:
  ------------------
  |  |  299|  50.2M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1865:2): [True: 0, False: 75.8M]
  ------------------
 1866|  50.2M|		if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|  50.2M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   100M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 3.04M, False: 47.1M]
  |  |  |  Branch (72:59): [True: 5.90M, False: 41.2M]
  |  |  ------------------
  ------------------
 1867|  8.95M|			return 0;
 1868|  41.2M|		break;
 1869|       |
 1870|  41.2M|	case FILE_REGEX:
  ------------------
  |  |  257|   161k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1870:2): [True: 161k, False: 75.6M]
  ------------------
 1871|   161k|		if (nbytes < offset)
  ------------------
  |  Branch (1871:7): [True: 817, False: 160k]
  ------------------
 1872|    817|			return 0;
 1873|   160k|		break;
 1874|       |
 1875|   160k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  16.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1875:2): [True: 16.2k, False: 75.8M]
  ------------------
 1876|  16.2k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  375|  16.2k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  427|  16.2k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  388|  16.2k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1876:7): [True: 12.5k, False: 3.69k]
  ------------------
 1877|  12.5k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  444|  12.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1878|  16.2k|		if (offset == 0)
  ------------------
  |  Branch (1878:7): [True: 596, False: 15.6k]
  ------------------
 1879|    596|			return 0;
 1880|       |
 1881|  15.6k|		if (nbytes < offset)
  ------------------
  |  Branch (1881:7): [True: 1.59k, False: 14.0k]
  ------------------
 1882|  1.59k|			return 0;
 1883|       |
 1884|  14.0k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1884:7): [True: 300, False: 13.7k]
  ------------------
 1885|    300|			return -1;
 1886|       |
 1887|  13.7k|		(*indir_count)++;
 1888|  13.7k|		bb = *b;
 1889|  13.7k|		bb.fbuf = s + offset;
 1890|  13.7k|		bb.flen = nbytes - offset;
 1891|  13.7k|		bb.ebuf = NULL;
 1892|  13.7k|		bb.elen = 0;
 1893|  13.7k|		rv = -1;
 1894|  16.2k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1894:34): [True: 13.7k, False: 2.46k]
  ------------------
 1895|  13.7k|		    mlp = mlp->next)
 1896|  13.7k|		{
 1897|  13.7k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1897:8): [True: 11.2k, False: 2.46k]
  ------------------
 1898|  13.7k|			    mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  228|  13.7k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1899|  13.7k|			    name_count, printed_something, need_separator,
 1900|  13.7k|			    firstline, NULL, NULL)) != 0)
 1901|  11.2k|				break;
 1902|  13.7k|		}
 1903|  13.7k|		buffer_fini(&bb);
 1904|       |
 1905|  13.7k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.7k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1905:7): [True: 0, False: 13.7k]
  ------------------
 1906|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1907|       |
 1908|  13.7k|		rbuf = file_pop_buffer(ms, pb);
 1909|  13.7k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  3.10k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1909:7): [True: 3.10k, False: 10.6k]
  |  Branch (1909:23): [True: 995, False: 2.10k]
  ------------------
 1910|    995|			return -1;
 1911|       |
 1912|  12.7k|		if (rv == 1) {
  ------------------
  |  Branch (1912:7): [True: 10.2k, False: 2.46k]
  ------------------
 1913|  10.2k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  10.2k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  10.2k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   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 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  10.2k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1913:8): [True: 10.2k, False: 0]
  ------------------
 1914|  10.2k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  158|  10.2k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1914:8): [True: 0, False: 10.2k]
  ------------------
 1915|      0|			{
 1916|      0|				free(rbuf);
 1917|      0|				return -1;
 1918|      0|			}
 1919|  10.2k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1919:8): [True: 93, False: 10.2k]
  ------------------
 1920|     93|				free(rbuf);
 1921|     93|				return -1;
 1922|     93|			}
 1923|  10.2k|		}
 1924|  12.6k|		free(rbuf);
 1925|  12.6k|		return rv;
 1926|       |
 1927|  51.0k|	case FILE_USE:
  ------------------
  |  |  286|  51.0k|#define				FILE_USE		46
  ------------------
  |  Branch (1927:2): [True: 51.0k, False: 75.7M]
  ------------------
 1928|  51.0k|		if (nbytes < offset)
  ------------------
  |  Branch (1928:7): [True: 6.43k, False: 44.6k]
  ------------------
 1929|  6.43k|			return 0;
 1930|  44.6k|		rbuf = m->value.s;
 1931|  44.6k|		if (*rbuf == '^') {
  ------------------
  |  Branch (1931:7): [True: 238, False: 44.4k]
  ------------------
 1932|    238|			rbuf++;
 1933|    238|			flip = !flip;
 1934|    238|		}
 1935|  44.6k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (1935:7): [True: 0, False: 44.6k]
  ------------------
 1936|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 1937|      0|			return -1;
 1938|      0|		}
 1939|  44.6k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (1939:7): [True: 0, False: 44.6k]
  ------------------
 1940|      0|			file_error(ms, errno, "can't allocate continuation");
 1941|      0|			return -1;
 1942|      0|		}
 1943|       |
 1944|  44.6k|		oneed_separator = *need_separator;
 1945|  44.6k|		if (m->flag & NOSPACE)
  ------------------
  |  |  227|  44.6k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (1945:7): [True: 5.81k, False: 38.8k]
  ------------------
 1946|  5.81k|			*need_separator = 0;
 1947|       |
 1948|  44.6k|		nfound_match = 0;
 1949|  44.6k|		(*name_count)++;
 1950|  44.6k|		eoffset = ms->eoffset;
 1951|  44.6k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 1952|  44.6k|		    offset + o, mode, text, flip, indir_count, name_count,
 1953|  44.6k|		    printed_something, need_separator, firstline, returnval,
 1954|  44.6k|		    &nfound_match);
 1955|  44.6k|		ms->ms_value.q = nfound_match;
 1956|  44.6k|		(*name_count)--;
 1957|  44.6k|		*found_match |= nfound_match;
 1958|       |
 1959|  44.6k|		restore_cont(ms, &c);
 1960|       |
 1961|  44.6k|		if (rv != 1)
  ------------------
  |  Branch (1961:7): [True: 3.07k, False: 41.5k]
  ------------------
 1962|  3.07k|		    *need_separator = oneed_separator;
 1963|  44.6k|		ms->offset = offset;
 1964|  44.6k|		ms->eoffset = eoffset;
 1965|  44.6k|		return rv || *found_match;
  ------------------
  |  Branch (1965:10): [True: 42.5k, False: 2.07k]
  |  Branch (1965:16): [True: 0, False: 2.07k]
  ------------------
 1966|       |
 1967|  44.6k|	case FILE_NAME:
  ------------------
  |  |  285|  44.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (1967:2): [True: 44.6k, False: 75.7M]
  ------------------
 1968|  44.6k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  44.6k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  44.6k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  44.6k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  44.6k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  44.6k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  44.6k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1968:7): [True: 0, False: 44.6k]
  ------------------
 1969|      0|			return 1;
 1970|  44.6k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (1970:7): [True: 0, False: 44.6k]
  ------------------
 1971|      0|			return -1;
 1972|  44.6k|		return 1;
 1973|   306k|	case FILE_DER:
  ------------------
  |  |  288|   306k|#define				FILE_DER		48
  ------------------
  |  Branch (1973:2): [True: 306k, False: 75.5M]
  ------------------
 1974|   312k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  243|   312k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1974:2): [True: 6.52k, False: 75.8M]
  ------------------
 1975|   313k|	case FILE_CLEAR:
  ------------------
  |  |  287|   313k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1975:2): [True: 754, False: 75.8M]
  ------------------
 1976|  1.62M|	default:
  ------------------
  |  Branch (1976:2): [True: 1.31M, False: 74.5M]
  ------------------
 1977|  1.62M|		break;
 1978|  75.8M|	}
 1979|  64.7M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (1979:6): [True: 18, False: 64.7M]
  ------------------
 1980|     18|		return 0;
 1981|  64.7M|	return 1;
 1982|  64.7M|}
softmagic.c:mcopy:
 1325|  75.9M|{
 1326|  75.9M|	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|  75.9M|	if (indir == 0) {
  ------------------
  |  Branch (1331:6): [True: 75.8M, False: 93.1k]
  ------------------
 1332|  75.8M|		switch (type) {
 1333|   306k|		case FILE_DER:
  ------------------
  |  |  288|   306k|#define				FILE_DER		48
  ------------------
  |  Branch (1333:3): [True: 306k, False: 75.5M]
  ------------------
 1334|   960k|		case FILE_SEARCH:
  ------------------
  |  |  260|   960k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1334:3): [True: 654k, False: 75.1M]
  ------------------
 1335|   960k|			if (offset > nbytes)
  ------------------
  |  Branch (1335:8): [True: 48.4k, False: 912k]
  ------------------
 1336|  48.4k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  444|  48.4k|#define CAST(T, b)	((T)(b))
  ------------------
 1337|   960k|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  445|   960k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1338|   960k|			ms->search.s_len = nbytes - offset;
 1339|   960k|			ms->search.offset = offset;
 1340|   960k|			return 0;
 1341|       |
 1342|   161k|		case FILE_REGEX: {
  ------------------
  |  |  257|   161k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1342:3): [True: 161k, False: 75.6M]
  ------------------
 1343|   161k|			const char *b;
 1344|   161k|			const char *c;
 1345|   161k|			const char *last;	/* end of search region */
 1346|   161k|			const char *buf;	/* start of search region */
 1347|   161k|			const char *end;
 1348|   161k|			size_t lines, linecnt, bytecnt;
 1349|       |
 1350|   161k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1350:8): [True: 0, False: 161k]
  |  Branch (1350:21): [True: 848, False: 160k]
  ------------------
 1351|    848|				ms->search.s_len = 0;
 1352|    848|				ms->search.s = NULL;
 1353|    848|				return 0;
 1354|    848|			}
 1355|       |
 1356|   160k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  375|   160k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  402|   160k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  388|   160k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1356:8): [True: 40.0k, False: 120k]
  ------------------
 1357|  40.0k|				linecnt = m->str_range;
  ------------------
  |  |  374|  40.0k|#define str_range _u._s._count
  ------------------
 1358|  40.0k|				bytecnt = linecnt * 80;
 1359|   120k|			} else {
 1360|   120k|				linecnt = 0;
 1361|   120k|				bytecnt = m->str_range;
  ------------------
  |  |  374|   120k|#define str_range _u._s._count
  ------------------
 1362|   120k|			}
 1363|       |
 1364|   160k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1364:8): [True: 103k, False: 56.6k]
  |  Branch (1364:24): [True: 51.0k, False: 5.62k]
  ------------------
 1365|   154k|				bytecnt = nbytes - offset;
 1366|   160k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1366:8): [True: 9.77k, False: 150k]
  ------------------
 1367|  9.77k|				bytecnt = ms->regex_max;
 1368|       |
 1369|   160k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  445|   160k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1370|   160k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  445|   160k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1371|       |			/* mget() guarantees buf <= last */
 1372|   330k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1372:35): [True: 209k, False: 121k]
  |  Branch (1372:44): [True: 206k, False: 2.51k]
  ------------------
 1373|   330k|			     ((b = CAST(const char *,
  ------------------
  |  |  444|   206k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1373:10): [True: 124k, False: 81.8k]
  ------------------
 1374|   206k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1375|   206k|			     || (b = CAST(const char *,
  ------------------
  |  |  444|  81.8k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1375:12): [True: 45.7k, False: 36.0k]
  ------------------
 1376|  81.8k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1377|   170k|			     lines--, b++) {
 1378|   170k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1378:9): [True: 168k, False: 1.82k]
  |  Branch (1378:24): [True: 45.2k, False: 123k]
  |  Branch (1378:40): [True: 0, False: 45.2k]
  ------------------
 1379|      0|					b++;
 1380|   170k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1380:9): [True: 168k, False: 1.82k]
  |  Branch (1380:24): [True: 123k, False: 45.2k]
  ------------------
 1381|   123k|					b++;
 1382|   170k|				last = b;
 1383|   170k|			}
 1384|   160k|			if (lines)
  ------------------
  |  Branch (1384:8): [True: 38.5k, False: 121k]
  ------------------
 1385|  38.5k|				last = end;
 1386|       |
 1387|   160k|			ms->search.s = buf;
 1388|   160k|			ms->search.s_len = last - buf;
 1389|   160k|			ms->search.offset = offset;
 1390|   160k|			ms->search.rm_len = 0;
 1391|   160k|			return 0;
 1392|   161k|		}
 1393|    126|		case FILE_BESTRING16:
  ------------------
  |  |  258|    126|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1393:3): [True: 126, False: 75.8M]
  ------------------
 1394|  47.8k|		case FILE_LESTRING16: {
  ------------------
  |  |  259|  47.8k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1394:3): [True: 47.6k, False: 75.7M]
  ------------------
 1395|  47.8k|			const unsigned char *src = s + offset;
 1396|  47.8k|			const unsigned char *esrc = s + nbytes;
 1397|  47.8k|			char *dst = p->s;
 1398|  47.8k|			char *edst = &p->s[sizeof(p->s) - 1];
 1399|       |
 1400|  47.8k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  258|  47.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1400:8): [True: 126, False: 47.6k]
  ------------------
 1401|    126|				src++;
 1402|       |
 1403|       |			/* check that offset is within range */
 1404|  47.8k|			if (offset >= nbytes)
  ------------------
  |  Branch (1404:8): [True: 1.30k, False: 46.5k]
  ------------------
 1405|  1.30k|				break;
 1406|  2.37M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1406:20): [True: 2.34M, False: 35.5k]
  ------------------
 1407|  2.34M|				if (dst < edst)
  ------------------
  |  Branch (1407:9): [True: 2.33M, False: 11.0k]
  ------------------
 1408|  2.33M|					*dst = *src;
 1409|  11.0k|				else
 1410|  11.0k|					break;
 1411|  2.33M|				if (*dst == '\0') {
  ------------------
  |  Branch (1411:9): [True: 880k, False: 1.44M]
  ------------------
 1412|   880k|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  258|   880k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1412:10): [True: 3.86k, False: 876k]
  |  Branch (1412:10): [True: 260k, False: 620k]
  ------------------
 1413|  3.86k|					    *(src - 1) != '\0' :
 1414|   880k|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1414:11): [True: 871k, False: 5.02k]
  ------------------
 1415|   876k|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1415:10): [True: 259k, False: 612k]
  ------------------
 1416|   260k|						*dst = ' ';
 1417|   880k|				}
 1418|  2.33M|			}
 1419|  46.5k|			*edst = '\0';
 1420|  46.5k|			return 0;
 1421|  47.8k|		}
 1422|  49.5M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  245|  49.5M|#define				FILE_STRING		5
  ------------------
  |  Branch (1422:3): [True: 49.5M, False: 26.2M]
  ------------------
 1423|  49.5M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  253|  49.5M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1423:3): [True: 24.2k, False: 75.7M]
  ------------------
 1424|  49.5M|			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  374|  49.5M|#define str_range _u._s._count
  ------------------
              			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  374|     15|#define str_range _u._s._count
  ------------------
  |  Branch (1424:8): [True: 15, False: 49.5M]
  |  Branch (1424:29): [True: 15, False: 0]
  ------------------
 1425|     15|				size = m->str_range;
  ------------------
  |  |  374|     15|#define str_range _u._s._count
  ------------------
 1426|  49.5M|			break;
 1427|  25.0M|		default:
  ------------------
  |  Branch (1427:3): [True: 25.0M, False: 50.7M]
  ------------------
 1428|  25.0M|			break;
 1429|  75.8M|		}
 1430|  75.8M|	}
 1431|       |
 1432|  74.7M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  290|  74.7M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1432:6): [True: 2.01k, False: 74.7M]
  ------------------
 1433|  2.01k|		(void)memset(p, '\0', sizeof(*p));
 1434|  2.01k|		p->q = offset;
 1435|  2.01k|		return 0;
 1436|  2.01k|	}
 1437|       |
 1438|  74.7M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1438:6): [True: 5.00M, False: 69.7M]
  ------------------
 1439|  5.00M|		(void)memset(p, '\0', sizeof(*p));
 1440|  5.00M|		return 0;
 1441|  5.00M|	}
 1442|  69.7M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1442:6): [True: 47.5M, False: 22.1M]
  ------------------
 1443|  47.5M|		nbytes = nbytes - offset;
 1444|  22.1M|	else
 1445|  22.1M|		nbytes = size;
 1446|       |
 1447|  69.7M|	(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|  69.7M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1453:6): [True: 47.5M, False: 22.1M]
  ------------------
 1454|  47.5M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  445|  47.5M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1455|  47.5M|		    sizeof(*p) - nbytes);
 1456|  69.7M|	return 0;
 1457|  74.7M|}
softmagic.c:cvt_flip:
 1001|  64.8M|{
 1002|  64.8M|	if (flip == 0)
  ------------------
  |  Branch (1002:6): [True: 64.7M, False: 10.5k]
  ------------------
 1003|  64.7M|		return type;
 1004|  10.5k|	switch (type) {
 1005|     57|	case FILE_BESHORT:
  ------------------
  |  |  247|     57|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1005:2): [True: 57, False: 10.5k]
  ------------------
 1006|     57|		return FILE_LESHORT;
  ------------------
  |  |  250|     57|#define				FILE_LESHORT		10
  ------------------
 1007|  1.17k|	case FILE_BELONG:
  ------------------
  |  |  248|  1.17k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1007:2): [True: 1.17k, False: 9.39k]
  ------------------
 1008|  1.17k|		return FILE_LELONG;
  ------------------
  |  |  251|  1.17k|#define				FILE_LELONG		11
  ------------------
 1009|      3|	case FILE_BEDATE:
  ------------------
  |  |  249|      3|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1009:2): [True: 3, False: 10.5k]
  ------------------
 1010|      3|		return FILE_LEDATE;
  ------------------
  |  |  252|      3|#define				FILE_LEDATE		12
  ------------------
 1011|      0|	case FILE_BELDATE:
  ------------------
  |  |  255|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1011:2): [True: 0, False: 10.5k]
  ------------------
 1012|      0|		return FILE_LELDATE;
  ------------------
  |  |  256|      0|#define				FILE_LELDATE		16
  ------------------
 1013|      3|	case FILE_BEQUAD:
  ------------------
  |  |  266|      3|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1013:2): [True: 3, False: 10.5k]
  ------------------
 1014|      3|		return FILE_LEQUAD;
  ------------------
  |  |  265|      3|#define				FILE_LEQUAD		25
  ------------------
 1015|     18|	case FILE_BEQDATE:
  ------------------
  |  |  269|     18|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1015:2): [True: 18, False: 10.5k]
  ------------------
 1016|     18|		return FILE_LEQDATE;
  ------------------
  |  |  268|     18|#define				FILE_LEQDATE		28
  ------------------
 1017|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1017:2): [True: 0, False: 10.5k]
  ------------------
 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: 10.5k]
  ------------------
 1020|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  283|      0|#define				FILE_LEQWDATE		43
  ------------------
 1021|  8.52k|	case FILE_LESHORT:
  ------------------
  |  |  250|  8.52k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1021:2): [True: 8.52k, False: 2.04k]
  ------------------
 1022|  8.52k|		return FILE_BESHORT;
  ------------------
  |  |  247|  8.52k|#define				FILE_BESHORT		7
  ------------------
 1023|    335|	case FILE_LELONG:
  ------------------
  |  |  251|    335|#define				FILE_LELONG		11
  ------------------
  |  Branch (1023:2): [True: 335, False: 10.2k]
  ------------------
 1024|    335|		return FILE_BELONG;
  ------------------
  |  |  248|    335|#define				FILE_BELONG		8
  ------------------
 1025|      4|	case FILE_LEDATE:
  ------------------
  |  |  252|      4|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1025:2): [True: 4, False: 10.5k]
  ------------------
 1026|      4|		return FILE_BEDATE;
  ------------------
  |  |  249|      4|#define				FILE_BEDATE		9
  ------------------
 1027|      0|	case FILE_LELDATE:
  ------------------
  |  |  256|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1027:2): [True: 0, False: 10.5k]
  ------------------
 1028|      0|		return FILE_BELDATE;
  ------------------
  |  |  255|      0|#define				FILE_BELDATE		15
  ------------------
 1029|     28|	case FILE_LEQUAD:
  ------------------
  |  |  265|     28|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1029:2): [True: 28, False: 10.5k]
  ------------------
 1030|     28|		return FILE_BEQUAD;
  ------------------
  |  |  266|     28|#define				FILE_BEQUAD		26
  ------------------
 1031|      0|	case FILE_LEQDATE:
  ------------------
  |  |  268|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1031:2): [True: 0, False: 10.5k]
  ------------------
 1032|      0|		return FILE_BEQDATE;
  ------------------
  |  |  269|      0|#define				FILE_BEQDATE		29
  ------------------
 1033|      7|	case FILE_LEQLDATE:
  ------------------
  |  |  271|      7|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1033:2): [True: 7, False: 10.5k]
  ------------------
 1034|      7|		return FILE_BEQLDATE;
  ------------------
  |  |  272|      7|#define				FILE_BEQLDATE		32
  ------------------
 1035|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  283|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1035:2): [True: 0, False: 10.5k]
  ------------------
 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: 10.5k]
  ------------------
 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: 10.5k]
  ------------------
 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: 10.5k]
  ------------------
 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: 10.5k]
  ------------------
 1044|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1045|    414|	default:
  ------------------
  |  Branch (1045:2): [True: 414, False: 10.1k]
  ------------------
 1046|    414|		return type;
 1047|  10.5k|	}
 1048|  10.5k|}
softmagic.c:do_ops:
 1462|  88.4k|{
 1463|  88.4k|	intmax_t offset;
 1464|       |	// On purpose not INTMAX_MAX
 1465|  88.4k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1465:6): [True: 715, False: 87.7k]
  |  Branch (1465:25): [True: 64, False: 87.6k]
  ------------------
 1466|  88.4k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1466:6): [True: 70, False: 87.5k]
  |  Branch (1466:25): [True: 0, False: 87.5k]
  ------------------
 1467|    849|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    849|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1467:7): [True: 0, False: 849]
  ------------------
 1468|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1469|    849|		return 1;
 1470|    849|	}
 1471|       |	   
 1472|  87.5k|	if (off) {
  ------------------
  |  Branch (1472:6): [True: 60.4k, False: 27.1k]
  ------------------
 1473|  60.4k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  345|  60.4k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1473:11): [True: 0, False: 60.4k]
  ------------------
 1474|     11|		case FILE_OPAND:
  ------------------
  |  |  337|     11|#define				FILE_OPAND	0
  ------------------
  |  Branch (1474:3): [True: 11, False: 60.4k]
  ------------------
 1475|     11|			offset = lhs & off;
 1476|     11|			break;
 1477|      0|		case FILE_OPOR:
  ------------------
  |  |  338|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1477:3): [True: 0, False: 60.4k]
  ------------------
 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: 60.4k]
  ------------------
 1481|      0|			offset = lhs ^ off;
 1482|      0|			break;
 1483|  56.4k|		case FILE_OPADD:
  ------------------
  |  |  340|  56.4k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1483:3): [True: 56.4k, False: 3.93k]
  ------------------
 1484|  56.4k|			offset = lhs + off;
 1485|  56.4k|			break;
 1486|    652|		case FILE_OPMINUS:
  ------------------
  |  |  341|    652|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1486:3): [True: 652, False: 59.7k]
  ------------------
 1487|    652|			offset = lhs - off;
 1488|    652|			break;
 1489|  3.25k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  342|  3.25k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1489:3): [True: 3.25k, False: 57.1k]
  ------------------
 1490|  3.25k|			offset = lhs * off;
 1491|  3.25k|			break;
 1492|     17|		case FILE_OPDIVIDE:
  ------------------
  |  |  343|     17|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1492:3): [True: 17, False: 60.4k]
  ------------------
 1493|     17|			offset = lhs / off;
 1494|     17|			break;
 1495|      0|		case FILE_OPMODULO:
  ------------------
  |  |  344|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1495:3): [True: 0, False: 60.4k]
  ------------------
 1496|      0|			offset = lhs % off;
 1497|      0|			break;
 1498|  60.4k|		}
 1499|  60.4k|	} else
 1500|  27.1k|		offset = lhs;
 1501|  87.5k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  349|  87.5k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1501:6): [True: 0, False: 87.5k]
  ------------------
 1502|      0|		offset = ~offset;
 1503|  87.5k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1503:6): [True: 201, False: 87.3k]
  ------------------
 1504|    201|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    201|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1504:7): [True: 0, False: 201]
  ------------------
 1505|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1506|    201|		return 1;
 1507|    201|	}
 1508|  87.3k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  444|  87.3k|#define CAST(T, b)	((T)(b))
  ------------------
 1509|  87.3k|	return 0;
 1510|  87.5k|}
softmagic.c:cvt_id3:
  989|    877|{
  990|    877|	v = ((((v >>  0) & 0x7f) <<  0) |
  991|    877|	     (((v >>  8) & 0x7f) <<  7) |
  992|    877|	     (((v >> 16) & 0x7f) << 14) |
  993|    877|	     (((v >> 24) & 0x7f) << 21));
  994|    877|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    877|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (994:6): [True: 0, False: 877]
  ------------------
  995|      0|		fprintf(stderr, "id3 offs=%u\n", v);
  996|    877|	return v;
  997|    877|}
softmagic.c:file_fmtcheck:
  163|   117k|{
  164|   117k|	const char *ptr;
  165|       |
  166|   117k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (166:6): [True: 84.9k, False: 32.1k]
  ------------------
  167|  84.9k|		return desc;
  168|       |
  169|  32.1k|	ptr = fmtcheck(desc, def);
  170|  32.1k|	if (ptr == def)
  ------------------
  |  Branch (170:6): [True: 0, False: 32.1k]
  ------------------
  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.1k|	return ptr;
  175|   117k|}
softmagic.c:save_cont:
 1564|  44.6k|{
 1565|  44.6k|	size_t len;
 1566|  44.6k|	*c = ms->c;
 1567|  44.6k|	len = c->len * sizeof(*c->li);
 1568|  44.6k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  444|  44.6k|#define CAST(T, b)	((T)(b))
  ------------------
 1569|  44.6k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1569:6): [True: 0, False: 44.6k]
  ------------------
 1570|      0|		ms->c = *c;
 1571|      0|		return -1;
 1572|      0|	}
 1573|  44.6k|	memcpy(ms->c.li, c->li, len);
 1574|  44.6k|	return 0;
 1575|  44.6k|}
softmagic.c:restore_cont:
 1579|  44.6k|{
 1580|  44.6k|	free(ms->c.li);
 1581|  44.6k|	ms->c = *c;
 1582|  44.6k|}
softmagic.c:mconvert:
 1152|  64.7M|{
 1153|  64.7M|	union VALUETYPE *p = &ms->ms_value;
 1154|       |
 1155|  64.7M|	switch (cvt_flip(m->type, flip)) {
 1156|  1.06M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.06M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1156:2): [True: 1.06M, False: 63.6M]
  ------------------
 1157|  1.06M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1157:7): [True: 0, False: 1.06M]
  ------------------
 1158|      0|			goto out;
 1159|  1.06M|		return 1;
 1160|   734k|	case FILE_SHORT:
  ------------------
  |  |  242|   734k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1160:2): [True: 734k, False: 63.9M]
  ------------------
 1161|   734k|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|   734k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1161:2): [True: 0, False: 64.7M]
  ------------------
 1162|   734k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|   734k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1162:2): [True: 20, False: 64.7M]
  ------------------
 1163|   734k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|   734k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1163:2): [True: 0, False: 64.7M]
  ------------------
 1164|   734k|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|   734k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1164:2): [True: 0, False: 64.7M]
  ------------------
 1165|   734k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|   734k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1165:2): [True: 20, False: 64.7M]
  ------------------
 1166|   734k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|   734k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1166:2): [True: 0, False: 64.7M]
  ------------------
 1167|   734k|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1167:7): [True: 0, False: 734k]
  ------------------
 1168|      0|			goto out;
 1169|   734k|		return 1;
 1170|  1.08M|	case FILE_LONG:
  ------------------
  |  |  244|  1.08M|#define				FILE_LONG		4
  ------------------
  |  Branch (1170:2): [True: 1.08M, False: 63.6M]
  ------------------
 1171|  1.08M|	case FILE_DATE:
  ------------------
  |  |  246|  1.08M|#define				FILE_DATE		6
  ------------------
  |  Branch (1171:2): [True: 0, False: 64.7M]
  ------------------
 1172|  1.08M|	case FILE_LDATE:
  ------------------
  |  |  254|  1.08M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1172:2): [True: 0, False: 64.7M]
  ------------------
 1173|  1.08M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1173:7): [True: 0, False: 1.08M]
  ------------------
 1174|      0|			goto out;
 1175|  1.08M|		return 1;
 1176|  47.6k|	case FILE_QUAD:
  ------------------
  |  |  264|  47.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1176:2): [True: 47.6k, False: 64.6M]
  ------------------
 1177|  47.6k|	case FILE_QDATE:
  ------------------
  |  |  267|  47.6k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1177:2): [True: 0, False: 64.7M]
  ------------------
 1178|  47.6k|	case FILE_QLDATE:
  ------------------
  |  |  270|  47.6k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1178:2): [True: 0, False: 64.7M]
  ------------------
 1179|  47.9k|	case FILE_QWDATE:
  ------------------
  |  |  282|  47.9k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1179:2): [True: 268, False: 64.7M]
  ------------------
 1180|  49.9k|	case FILE_OFFSET:
  ------------------
  |  |  290|  49.9k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1180:2): [True: 2.01k, False: 64.7M]
  ------------------
 1181|  49.9k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1181:7): [True: 0, False: 49.9k]
  ------------------
 1182|      0|			goto out;
 1183|  49.9k|		return 1;
 1184|  40.8M|	case FILE_STRING:
  ------------------
  |  |  245|  40.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (1184:2): [True: 40.8M, False: 23.8M]
  ------------------
 1185|  40.8M|	case FILE_BESTRING16:
  ------------------
  |  |  258|  40.8M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1185:2): [True: 126, False: 64.7M]
  ------------------
 1186|  40.9M|	case FILE_LESTRING16:
  ------------------
  |  |  259|  40.9M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1186:2): [True: 47.6k, False: 64.6M]
  ------------------
 1187|  40.9M|	case FILE_OCTAL: {
  ------------------
  |  |  299|  40.9M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1187:2): [True: 0, False: 64.7M]
  ------------------
 1188|       |		/* Null terminate and eat *trailing* return */
 1189|  40.9M|		p->s[sizeof(p->s) - 1] = '\0';
 1190|  40.9M|		return 1;
 1191|  40.9M|	}
 1192|  18.0k|	case FILE_PSTRING: {
  ------------------
  |  |  253|  18.0k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1192:2): [True: 18.0k, False: 64.6M]
  ------------------
 1193|  18.0k|		char *ptr1, *ptr2;
 1194|  18.0k|		size_t len, sz = file_pstring_length_size(ms, m);
 1195|  18.0k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  175|  18.0k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  18.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1195:7): [True: 0, False: 18.0k]
  ------------------
 1196|      0|			return 0;
 1197|  18.0k|		ptr1 = p->s;
 1198|  18.0k|		ptr2 = ptr1 + sz;
 1199|  18.0k|		len = file_pstring_get_length(ms, m, ptr1);
 1200|  18.0k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  175|  18.0k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  18.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1200:7): [True: 18, False: 18.0k]
  ------------------
 1201|     18|			return 0;
 1202|  18.0k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1203|  18.0k|		if (len >= sz) {
  ------------------
  |  Branch (1203:7): [True: 12.3k, False: 5.70k]
  ------------------
 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|  12.3k|			len = sz;
 1213|  12.3k|		}
 1214|  1.82M|		while (len--)
  ------------------
  |  Branch (1214:10): [True: 1.80M, False: 18.0k]
  ------------------
 1215|  1.80M|			*ptr1++ = *ptr2++;
 1216|  18.0k|		*ptr1 = '\0';
 1217|  18.0k|		return 1;
 1218|  18.0k|	}
 1219|  3.10M|	case FILE_BESHORT:
  ------------------
  |  |  247|  3.10M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1219:2): [True: 3.10M, False: 61.6M]
  ------------------
 1220|  3.10M|		p->h = CAST(short, BE16(p));
  ------------------
  |  |  444|  3.10M|#define CAST(T, b)	((T)(b))
  ------------------
 1221|  3.10M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1221:7): [True: 0, False: 3.10M]
  ------------------
 1222|      0|			goto out;
 1223|  3.10M|		return 1;
 1224|  9.07M|	case FILE_BELONG:
  ------------------
  |  |  248|  9.07M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1224:2): [True: 9.07M, False: 55.6M]
  ------------------
 1225|  9.07M|	case FILE_BEDATE:
  ------------------
  |  |  249|  9.07M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1225:2): [True: 181, False: 64.7M]
  ------------------
 1226|  9.07M|	case FILE_BELDATE:
  ------------------
  |  |  255|  9.07M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1226:2): [True: 213, False: 64.7M]
  ------------------
 1227|  9.07M|		p->l = CAST(int32_t, BE32(p));
  ------------------
  |  |  444|  9.07M|#define CAST(T, b)	((T)(b))
  ------------------
 1228|  9.07M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1228:7): [True: 0, False: 9.07M]
  ------------------
 1229|      0|			goto out;
 1230|  9.07M|		return 1;
 1231|   633k|	case FILE_BEQUAD:
  ------------------
  |  |  266|   633k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1231:2): [True: 633k, False: 64.0M]
  ------------------
 1232|   634k|	case FILE_BEQDATE:
  ------------------
  |  |  269|   634k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1232:2): [True: 198, False: 64.7M]
  ------------------
 1233|   634k|	case FILE_BEQLDATE:
  ------------------
  |  |  272|   634k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1233:2): [True: 7, False: 64.7M]
  ------------------
 1234|   634k|	case FILE_BEQWDATE:
  ------------------
  |  |  284|   634k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1234:2): [True: 0, False: 64.7M]
  ------------------
 1235|   634k|		p->q = CAST(uint64_t, BE64(p));
  ------------------
  |  |  444|   634k|#define CAST(T, b)	((T)(b))
  ------------------
 1236|   634k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1236:7): [True: 0, False: 634k]
  ------------------
 1237|      0|			goto out;
 1238|   634k|		return 1;
 1239|  2.23M|	case FILE_LESHORT:
  ------------------
  |  |  250|  2.23M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1239:2): [True: 2.23M, False: 62.4M]
  ------------------
 1240|  2.23M|		p->h = CAST(short, LE16(p));
  ------------------
  |  |  444|  2.23M|#define CAST(T, b)	((T)(b))
  ------------------
 1241|  2.23M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1241:7): [True: 0, False: 2.23M]
  ------------------
 1242|      0|			goto out;
 1243|  2.23M|		return 1;
 1244|  4.18M|	case FILE_LELONG:
  ------------------
  |  |  251|  4.18M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1244:2): [True: 4.18M, False: 60.5M]
  ------------------
 1245|  4.18M|	case FILE_LEDATE:
  ------------------
  |  |  252|  4.18M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1245:2): [True: 99, False: 64.7M]
  ------------------
 1246|  4.18M|	case FILE_LELDATE:
  ------------------
  |  |  256|  4.18M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1246:2): [True: 0, False: 64.7M]
  ------------------
 1247|  4.18M|		p->l = CAST(int32_t, LE32(p));
  ------------------
  |  |  444|  4.18M|#define CAST(T, b)	((T)(b))
  ------------------
 1248|  4.18M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1248:7): [True: 0, False: 4.18M]
  ------------------
 1249|      0|			goto out;
 1250|  4.18M|		return 1;
 1251|   578k|	case FILE_LEQUAD:
  ------------------
  |  |  265|   578k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1251:2): [True: 578k, False: 64.1M]
  ------------------
 1252|   578k|	case FILE_LEQDATE:
  ------------------
  |  |  268|   578k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1252:2): [True: 18, False: 64.7M]
  ------------------
 1253|   578k|	case FILE_LEQLDATE:
  ------------------
  |  |  271|   578k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1253:2): [True: 5, False: 64.7M]
  ------------------
 1254|   579k|	case FILE_LEQWDATE:
  ------------------
  |  |  283|   579k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1254:2): [True: 876, False: 64.7M]
  ------------------
 1255|   579k|		p->q = CAST(uint64_t, LE64(p));
  ------------------
  |  |  444|   579k|#define CAST(T, b)	((T)(b))
  ------------------
 1256|   579k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1256:7): [True: 0, False: 579k]
  ------------------
 1257|      0|			goto out;
 1258|   579k|		return 1;
 1259|     28|	case FILE_MELONG:
  ------------------
  |  |  263|     28|#define				FILE_MELONG		23
  ------------------
  |  Branch (1259:2): [True: 28, False: 64.7M]
  ------------------
 1260|     62|	case FILE_MEDATE:
  ------------------
  |  |  261|     62|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1260:2): [True: 34, False: 64.7M]
  ------------------
 1261|     62|	case FILE_MELDATE:
  ------------------
  |  |  262|     62|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1261:2): [True: 0, False: 64.7M]
  ------------------
 1262|     62|		p->l = CAST(int32_t, ME32(p));
  ------------------
  |  |  444|     62|#define CAST(T, b)	((T)(b))
  ------------------
 1263|     62|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1263:7): [True: 0, False: 62]
  ------------------
 1264|      0|			goto out;
 1265|     62|		return 1;
 1266|      0|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1266:2): [True: 0, False: 64.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: 64.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|  1.18k|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  1.18k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1275:2): [True: 1.18k, False: 64.7M]
  ------------------
 1276|  1.18k|		p->l = LE32(p);
  ------------------
  |  |   91|  1.18k|#define LE32(p) ( \
  |  |   92|  1.18k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  1.18k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  1.18k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   95|  1.18k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  444|  1.18k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1277|  1.18k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1277:7): [True: 0, False: 1.18k]
  ------------------
 1278|      0|			goto out;
 1279|  1.18k|		return 1;
 1280|      0|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1280:2): [True: 0, False: 64.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|    106|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    106|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1284:2): [True: 106, False: 64.7M]
  ------------------
 1285|    106|		p->q = BE64(p);
  ------------------
  |  |   73|    106|#define BE64(p) ( \
  |  |   74|    106|    (CAST(uint64_t, (p)->hq[0])<<56)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    106|    (CAST(uint64_t, (p)->hq[1])<<48)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    106|    (CAST(uint64_t, (p)->hq[2])<<40)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    106|    (CAST(uint64_t, (p)->hq[3])<<32)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    106|    (CAST(uint64_t, (p)->hq[4])<<24)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    106|    (CAST(uint64_t, (p)->hq[5])<<16)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   80|    106|    (CAST(uint64_t, (p)->hq[6])<<8)| \
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   81|    106|    (CAST(uint64_t, (p)->hq[7])))
  |  |  ------------------
  |  |  |  |  444|    106|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1286|    106|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1286:7): [True: 0, False: 106]
  ------------------
 1287|      0|			goto out;
 1288|    106|		return 1;
 1289|    139|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    139|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1289:2): [True: 139, False: 64.7M]
  ------------------
 1290|    139|		p->q = LE64(p);
  ------------------
  |  |   82|    139|#define LE64(p) ( \
  |  |   83|    139|    (CAST(uint64_t, (p)->hq[7])<<56)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    139|    (CAST(uint64_t, (p)->hq[6])<<48)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    139|    (CAST(uint64_t, (p)->hq[5])<<40)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    139|    (CAST(uint64_t, (p)->hq[4])<<32)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    139|    (CAST(uint64_t, (p)->hq[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    139|    (CAST(uint64_t, (p)->hq[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    139|    (CAST(uint64_t, (p)->hq[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   90|    139|    (CAST(uint64_t, (p)->hq[0])))
  |  |  ------------------
  |  |  |  |  444|    139|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1291|    139|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1291:7): [True: 0, False: 139]
  ------------------
 1292|      0|			goto out;
 1293|    139|		return 1;
 1294|   160k|	case FILE_REGEX:
  ------------------
  |  |  257|   160k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1294:2): [True: 160k, False: 64.5M]
  ------------------
 1295|   560k|	case FILE_SEARCH:
  ------------------
  |  |  260|   560k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1295:2): [True: 399k, False: 64.3M]
  ------------------
 1296|   566k|	case FILE_DEFAULT:
  ------------------
  |  |  243|   566k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1296:2): [True: 6.52k, False: 64.6M]
  ------------------
 1297|   567k|	case FILE_CLEAR:
  ------------------
  |  |  287|   567k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1297:2): [True: 754, False: 64.7M]
  ------------------
 1298|   567k|	case FILE_NAME:
  ------------------
  |  |  285|   567k|#define				FILE_NAME		45
  ------------------
  |  Branch (1298:2): [True: 0, False: 64.7M]
  ------------------
 1299|   567k|	case FILE_USE:
  ------------------
  |  |  286|   567k|#define				FILE_USE		46
  ------------------
  |  Branch (1299:2): [True: 0, False: 64.7M]
  ------------------
 1300|   873k|	case FILE_DER:
  ------------------
  |  |  288|   873k|#define				FILE_DER		48
  ------------------
  |  Branch (1300:2): [True: 306k, False: 64.4M]
  ------------------
 1301|  1.01M|	case FILE_GUID:
  ------------------
  |  |  289|  1.01M|#define				FILE_GUID		49
  ------------------
  |  Branch (1301:2): [True: 140k, False: 64.5M]
  ------------------
 1302|  1.01M|		return 1;
 1303|      0|	default:
  ------------------
  |  Branch (1303:2): [True: 0, False: 64.7M]
  ------------------
 1304|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1305|      0|		return 0;
 1306|  64.7M|	}
 1307|      0|out:
 1308|      0|	file_magerror(ms, "zerodivide in mconvert()");
 1309|      0|	return 0;
 1310|  64.7M|}
softmagic.c:cvt_8:
 1086|  1.06M|{
 1087|  1.06M|	DO_CVT(b, uint8_t);
  ------------------
  |  | 1050|  1.06M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.06M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 91.7k, False: 968k]
  |  |  ------------------
  |  | 1051|  1.06M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|  91.7k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 91.7k]
  |  |  ------------------
  |  | 1052|  77.1k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|  77.1k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 77.1k, False: 14.5k]
  |  |  ------------------
  |  | 1053|  77.1k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  77.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|  77.1k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 91.7k]
  |  |  ------------------
  |  | 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: 91.7k]
  |  |  ------------------
  |  | 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: 91.7k]
  |  |  ------------------
  |  | 1062|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|      0|			break; \
  |  | 1064|  14.1k|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|  14.1k|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 14.1k, False: 77.5k]
  |  |  ------------------
  |  | 1065|  14.1k|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  14.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|  14.1k|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 91.7k]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|    337|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    337|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 337, False: 91.4k]
  |  |  ------------------
  |  | 1071|    337|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    337|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 337]
  |  |  ------------------
  |  | 1072|    337|				return -1; \
  |  | 1073|    337|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    337|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    337|			break; \
  |  | 1075|    337|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|     73|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 73, False: 91.6k]
  |  |  ------------------
  |  | 1076|     73|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|     73|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 73]
  |  |  ------------------
  |  | 1077|     73|				return -1; \
  |  | 1078|     73|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     73|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|     73|			break; \
  |  | 1080|  91.7k|		} \
  |  | 1081|  1.06M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  1.06M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 1.06M]
  |  |  ------------------
  |  | 1082|  1.06M|		p->fld = ~p->fld \
  ------------------
 1088|  1.06M|	return 0;
 1089|  1.06M|}
softmagic.c:cvt_16:
 1093|  6.07M|{
 1094|  6.07M|	DO_CVT(h, uint16_t);
  ------------------
  |  | 1050|  6.07M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  6.07M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 438k, False: 5.63M]
  |  |  ------------------
  |  | 1051|  6.07M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   438k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 438k]
  |  |  ------------------
  |  | 1052|   417k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|   417k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 417k, False: 20.9k]
  |  |  ------------------
  |  | 1053|   417k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|   417k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|   417k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 438k]
  |  |  ------------------
  |  | 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: 438k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|     24|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|     24|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 24, False: 438k]
  |  |  ------------------
  |  | 1062|     24|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     24|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     24|			break; \
  |  | 1064|    126|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|    126|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 126, False: 438k]
  |  |  ------------------
  |  | 1065|    126|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    126|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|    126|			break; \
  |  | 1067|     55|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|     55|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 55, False: 438k]
  |  |  ------------------
  |  | 1068|     55|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     55|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|     55|			break; \
  |  | 1070|     50|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|     50|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 50, False: 438k]
  |  |  ------------------
  |  | 1071|     50|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|     50|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 50]
  |  |  ------------------
  |  | 1072|     50|				return -1; \
  |  | 1073|     50|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     50|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|     50|			break; \
  |  | 1075|  20.7k|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|  20.7k|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 20.7k, False: 417k]
  |  |  ------------------
  |  | 1076|  20.7k|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|  20.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 20.7k]
  |  |  ------------------
  |  | 1077|  20.7k|				return -1; \
  |  | 1078|  20.7k|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  20.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|  20.7k|			break; \
  |  | 1080|   438k|		} \
  |  | 1081|  6.07M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  6.07M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 6.07M]
  |  |  ------------------
  |  | 1082|  6.07M|		p->fld = ~p->fld \
  ------------------
 1095|  6.07M|	return 0;
 1096|  6.07M|}
softmagic.c:cvt_32:
 1100|  14.3M|{
 1101|  14.3M|	DO_CVT(l, uint32_t);
  ------------------
  |  | 1050|  14.3M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  14.3M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 2.62M, False: 11.7M]
  |  |  ------------------
  |  | 1051|  14.3M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|  2.62M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 2.62M]
  |  |  ------------------
  |  | 1052|  2.61M|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|  2.61M|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 2.61M, False: 1.30k]
  |  |  ------------------
  |  | 1053|  2.61M|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  2.61M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|  2.61M|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 2.62M]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|     44|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|     44|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 44, False: 2.62M]
  |  |  ------------------
  |  | 1059|     44|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     44|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|     44|			break; \
  |  | 1061|    195|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|    195|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 195, False: 2.62M]
  |  |  ------------------
  |  | 1062|    195|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    195|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|    195|			break; \
  |  | 1064|    178|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|    178|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 178, False: 2.62M]
  |  |  ------------------
  |  | 1065|    178|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    178|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|    178|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 2.62M]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|    555|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    555|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 555, False: 2.62M]
  |  |  ------------------
  |  | 1071|    555|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    555|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 555]
  |  |  ------------------
  |  | 1072|    555|				return -1; \
  |  | 1073|    555|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    555|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    555|			break; \
  |  | 1075|    555|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|    333|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 333, False: 2.62M]
  |  |  ------------------
  |  | 1076|    333|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    333|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 333]
  |  |  ------------------
  |  | 1077|    333|				return -1; \
  |  | 1078|    333|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    333|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|    333|			break; \
  |  | 1080|  2.62M|		} \
  |  | 1081|  14.3M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  14.3M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 14.3M]
  |  |  ------------------
  |  | 1082|  14.3M|		p->fld = ~p->fld \
  ------------------
 1102|  14.3M|	return 0;
 1103|  14.3M|}
softmagic.c:cvt_64:
 1107|  1.26M|{
 1108|  1.26M|	DO_CVT(q, uint64_t);
  ------------------
  |  | 1050|  1.26M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.26M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 116k, False: 1.14M]
  |  |  ------------------
  |  | 1051|  1.26M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   116k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 116k]
  |  |  ------------------
  |  | 1052|   116k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|   116k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 116k, False: 4]
  |  |  ------------------
  |  | 1053|   116k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|   116k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|   116k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 116k]
  |  |  ------------------
  |  | 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: 116k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|      4|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      4|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 4, False: 116k]
  |  |  ------------------
  |  | 1062|      4|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      4|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|      4|			break; \
  |  | 1064|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 116k]
  |  |  ------------------
  |  | 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: 116k]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 0, False: 116k]
  |  |  ------------------
  |  | 1071|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1072|      0|				return -1; \
  |  | 1073|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|      0|			break; \
  |  | 1075|      0|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|      0|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 0, False: 116k]
  |  |  ------------------
  |  | 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|   116k|		} \
  |  | 1081|  1.26M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  1.26M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 1.26M]
  |  |  ------------------
  |  | 1082|  1.26M|		p->fld = ~p->fld \
  ------------------
 1109|  1.26M|	return 0;
 1110|  1.26M|}
softmagic.c:cvt_float:
 1133|  1.18k|{
 1134|  1.18k|	DO_CVT2(f, float);
  ------------------
  |  | 1113|  1.18k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.18k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1113:6): [True: 0, False: 1.18k]
  |  |  ------------------
  |  | 1114|  1.18k|		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|  1.18k|	return 0;
 1136|  1.18k|}
softmagic.c:cvt_double:
 1140|    245|{
 1141|    245|	DO_CVT2(d, double);
  ------------------
  |  | 1113|    245|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|    245|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1113:6): [True: 0, False: 245]
  |  |  ------------------
  |  | 1114|    245|		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|    245|	return 0;
 1143|    245|}
softmagic.c:magiccheck:
 2097|  64.8M|{
 2098|  64.8M|	uint64_t l = m->value.q;
 2099|  64.8M|	uint64_t v;
 2100|  64.8M|	float fl, fv;
 2101|  64.8M|	double dl, dv;
 2102|  64.8M|	int matched;
 2103|  64.8M|	union VALUETYPE *p = &ms->ms_value;
 2104|       |
 2105|  64.8M|	switch (m->type) {
 2106|  1.06M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.06M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2106:2): [True: 1.06M, False: 63.7M]
  ------------------
 2107|  1.06M|		v = p->b;
 2108|  1.06M|		break;
 2109|       |
 2110|   734k|	case FILE_SHORT:
  ------------------
  |  |  242|   734k|#define				FILE_SHORT		2
  ------------------
  |  Branch (2110:2): [True: 734k, False: 64.0M]
  ------------------
 2111|  3.83M|	case FILE_BESHORT:
  ------------------
  |  |  247|  3.83M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2111:2): [True: 3.09M, False: 61.7M]
  ------------------
 2112|  6.07M|	case FILE_LESHORT:
  ------------------
  |  |  250|  6.07M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2112:2): [True: 2.24M, False: 62.5M]
  ------------------
 2113|  6.07M|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|  6.07M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (2113:2): [True: 0, False: 64.8M]
  ------------------
 2114|  6.07M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  6.07M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (2114:2): [True: 20, False: 64.8M]
  ------------------
 2115|  6.07M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  6.07M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (2115:2): [True: 0, False: 64.8M]
  ------------------
 2116|  6.07M|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|  6.07M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (2116:2): [True: 0, False: 64.8M]
  ------------------
 2117|  6.07M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  6.07M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (2117:2): [True: 20, False: 64.8M]
  ------------------
 2118|  6.07M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  6.07M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (2118:2): [True: 0, False: 64.8M]
  ------------------
 2119|  6.07M|		v = p->h;
 2120|  6.07M|		break;
 2121|       |
 2122|  1.08M|	case FILE_LONG:
  ------------------
  |  |  244|  1.08M|#define				FILE_LONG		4
  ------------------
  |  Branch (2122:2): [True: 1.08M, False: 63.7M]
  ------------------
 2123|  10.1M|	case FILE_BELONG:
  ------------------
  |  |  248|  10.1M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2123:2): [True: 9.07M, False: 55.7M]
  ------------------
 2124|  14.3M|	case FILE_LELONG:
  ------------------
  |  |  251|  14.3M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2124:2): [True: 4.18M, False: 60.6M]
  ------------------
 2125|  14.3M|	case FILE_MELONG:
  ------------------
  |  |  263|  14.3M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2125:2): [True: 28, False: 64.8M]
  ------------------
 2126|  14.3M|	case FILE_DATE:
  ------------------
  |  |  246|  14.3M|#define				FILE_DATE		6
  ------------------
  |  Branch (2126:2): [True: 0, False: 64.8M]
  ------------------
 2127|  14.3M|	case FILE_BEDATE:
  ------------------
  |  |  249|  14.3M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2127:2): [True: 180, False: 64.8M]
  ------------------
 2128|  14.3M|	case FILE_LEDATE:
  ------------------
  |  |  252|  14.3M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2128:2): [True: 100, False: 64.8M]
  ------------------
 2129|  14.3M|	case FILE_MEDATE:
  ------------------
  |  |  261|  14.3M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2129:2): [True: 34, False: 64.8M]
  ------------------
 2130|  14.3M|	case FILE_LDATE:
  ------------------
  |  |  254|  14.3M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2130:2): [True: 0, False: 64.8M]
  ------------------
 2131|  14.3M|	case FILE_BELDATE:
  ------------------
  |  |  255|  14.3M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2131:2): [True: 213, False: 64.8M]
  ------------------
 2132|  14.3M|	case FILE_LELDATE:
  ------------------
  |  |  256|  14.3M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2132:2): [True: 0, False: 64.8M]
  ------------------
 2133|  14.3M|	case FILE_MELDATE:
  ------------------
  |  |  262|  14.3M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2133:2): [True: 0, False: 64.8M]
  ------------------
 2134|  14.3M|		v = p->l;
 2135|  14.3M|		break;
 2136|       |
 2137|  47.6k|	case FILE_QUAD:
  ------------------
  |  |  264|  47.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2137:2): [True: 47.6k, False: 64.7M]
  ------------------
 2138|   625k|	case FILE_LEQUAD:
  ------------------
  |  |  265|   625k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2138:2): [True: 578k, False: 64.2M]
  ------------------
 2139|  1.25M|	case FILE_BEQUAD:
  ------------------
  |  |  266|  1.25M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2139:2): [True: 633k, False: 64.1M]
  ------------------
 2140|  1.25M|	case FILE_QDATE:
  ------------------
  |  |  267|  1.25M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2140:2): [True: 0, False: 64.8M]
  ------------------
 2141|  1.25M|	case FILE_BEQDATE:
  ------------------
  |  |  269|  1.25M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2141:2): [True: 216, False: 64.8M]
  ------------------
 2142|  1.25M|	case FILE_LEQDATE:
  ------------------
  |  |  268|  1.25M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2142:2): [True: 0, False: 64.8M]
  ------------------
 2143|  1.25M|	case FILE_QLDATE:
  ------------------
  |  |  270|  1.25M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2143:2): [True: 0, False: 64.8M]
  ------------------
 2144|  1.25M|	case FILE_BEQLDATE:
  ------------------
  |  |  272|  1.25M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2144:2): [True: 0, False: 64.8M]
  ------------------
 2145|  1.25M|	case FILE_LEQLDATE:
  ------------------
  |  |  271|  1.25M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2145:2): [True: 12, False: 64.8M]
  ------------------
 2146|  1.26M|	case FILE_QWDATE:
  ------------------
  |  |  282|  1.26M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2146:2): [True: 268, False: 64.8M]
  ------------------
 2147|  1.26M|	case FILE_BEQWDATE:
  ------------------
  |  |  284|  1.26M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2147:2): [True: 0, False: 64.8M]
  ------------------
 2148|  1.26M|	case FILE_LEQWDATE:
  ------------------
  |  |  283|  1.26M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2148:2): [True: 876, False: 64.8M]
  ------------------
 2149|  1.26M|	case FILE_OFFSET:
  ------------------
  |  |  290|  1.26M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (2149:2): [True: 2.01k, False: 64.8M]
  ------------------
 2150|  1.26M|		v = p->q;
 2151|  1.26M|		break;
 2152|       |
 2153|      0|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2153:2): [True: 0, False: 64.8M]
  ------------------
 2154|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2154:2): [True: 0, False: 64.8M]
  ------------------
 2155|  1.18k|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  1.18k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2155:2): [True: 1.18k, False: 64.8M]
  ------------------
 2156|  1.18k|		fl = m->value.f;
 2157|  1.18k|		fv = p->f;
 2158|  1.18k|		switch (m->reln) {
 2159|    333|		case 'x':
  ------------------
  |  Branch (2159:3): [True: 333, False: 855]
  ------------------
 2160|    333|			matched = 1;
 2161|    333|			break;
 2162|       |
 2163|      0|		case '!':
  ------------------
  |  Branch (2163:3): [True: 0, False: 1.18k]
  ------------------
 2164|      0|			matched = isunordered(fl, fv) ? 1 : fv != fl;
 2165|      0|			break;
 2166|       |
 2167|      0|		case '=':
  ------------------
  |  Branch (2167:3): [True: 0, False: 1.18k]
  ------------------
 2168|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
 2169|      0|			break;
 2170|       |
 2171|    855|		case '>':
  ------------------
  |  Branch (2171:3): [True: 855, False: 333]
  ------------------
 2172|    855|			matched = isgreater(fv, fl);
 2173|    855|			break;
 2174|       |
 2175|      0|		case '<':
  ------------------
  |  Branch (2175:3): [True: 0, False: 1.18k]
  ------------------
 2176|      0|			matched = isless(fv, fl);
 2177|      0|			break;
 2178|       |
 2179|      0|		default:
  ------------------
  |  Branch (2179:3): [True: 0, False: 1.18k]
  ------------------
 2180|      0|			file_magerror(ms, "cannot happen with float: "
 2181|      0|			    "invalid relation `%c'", m->reln);
 2182|      0|			return -1;
 2183|  1.18k|		}
 2184|  1.18k|		return matched;
 2185|       |
 2186|      0|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2186:2): [True: 0, False: 64.8M]
  ------------------
 2187|    106|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    106|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2187:2): [True: 106, False: 64.8M]
  ------------------
 2188|    245|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    245|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2188:2): [True: 139, False: 64.8M]
  ------------------
 2189|    245|		dl = m->value.d;
 2190|    245|		dv = p->d;
 2191|    245|		switch (m->reln) {
 2192|     64|		case 'x':
  ------------------
  |  Branch (2192:3): [True: 64, False: 181]
  ------------------
 2193|     64|			matched = 1;
 2194|     64|			break;
 2195|       |
 2196|      0|		case '!':
  ------------------
  |  Branch (2196:3): [True: 0, False: 245]
  ------------------
 2197|      0|			matched = isunordered(dv, dl) ? 1 : dv != dl;
 2198|      0|			break;
 2199|       |
 2200|    181|		case '=':
  ------------------
  |  Branch (2200:3): [True: 181, False: 64]
  ------------------
 2201|    181|			matched = isunordered(dv, dl) ? 0 : dv == dl;
 2202|    181|			break;
 2203|       |
 2204|      0|		case '>':
  ------------------
  |  Branch (2204:3): [True: 0, False: 245]
  ------------------
 2205|      0|			matched = isgreater(dv, dl);
 2206|      0|			break;
 2207|       |
 2208|      0|		case '<':
  ------------------
  |  Branch (2208:3): [True: 0, False: 245]
  ------------------
 2209|      0|			matched = isless(dv, dl);
 2210|      0|			break;
 2211|       |
 2212|      0|		default:
  ------------------
  |  Branch (2212:3): [True: 0, False: 245]
  ------------------
 2213|      0|			file_magerror(ms, "cannot happen with double: "
 2214|      0|			    "invalid relation `%c'", m->reln);
 2215|      0|			return -1;
 2216|    245|		}
 2217|    245|		return matched;
 2218|       |
 2219|  6.52k|	case FILE_DEFAULT:
  ------------------
  |  |  243|  6.52k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2219:2): [True: 6.52k, False: 64.7M]
  ------------------
 2220|  7.28k|	case FILE_CLEAR:
  ------------------
  |  |  287|  7.28k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2220:2): [True: 754, False: 64.8M]
  ------------------
 2221|  7.28k|		l = 0;
 2222|  7.28k|		v = 0;
 2223|  7.28k|		break;
 2224|       |
 2225|  40.8M|	case FILE_STRING:
  ------------------
  |  |  245|  40.8M|#define				FILE_STRING		5
  ------------------
  |  Branch (2225:2): [True: 40.8M, False: 23.9M]
  ------------------
 2226|  40.8M|	case FILE_PSTRING:
  ------------------
  |  |  253|  40.8M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2226:2): [True: 18.0k, False: 64.7M]
  ------------------
 2227|  40.8M|	case FILE_OCTAL:
  ------------------
  |  |  299|  40.8M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (2227:2): [True: 0, False: 64.8M]
  ------------------
 2228|  40.8M|		l = 0;
 2229|  40.8M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  444|  40.8M|#define CAST(T, b)	((T)(b))
  ------------------
 2230|  40.8M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  375|  40.8M|#define str_flags _u._s._flags
  ------------------
 2231|  40.8M|		break;
 2232|       |
 2233|    126|	case FILE_BESTRING16:
  ------------------
  |  |  258|    126|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2233:2): [True: 126, False: 64.8M]
  ------------------
 2234|  47.8k|	case FILE_LESTRING16:
  ------------------
  |  |  259|  47.8k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2234:2): [True: 47.6k, False: 64.7M]
  ------------------
 2235|  47.8k|		l = 0;
 2236|  47.8k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  444|  47.8k|#define CAST(T, b)	((T)(b))
  ------------------
 2237|  47.8k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  375|  47.8k|#define str_flags _u._s._flags
  ------------------
 2238|  47.8k|		break;
 2239|       |
 2240|   399k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  260|   399k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2240:2): [True: 399k, False: 64.4M]
  ------------------
 2241|   399k|		size_t slen;
 2242|   399k|		size_t idx;
 2243|       |
 2244|   399k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2244:7): [True: 0, False: 399k]
  ------------------
 2245|      0|			return 0;
 2246|       |
 2247|   399k|		slen = MIN(m->vallen, sizeof(m->value.s));
 2248|   399k|		l = 0;
 2249|   399k|		v = 0;
 2250|   399k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   399k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2250:7): [True: 0, False: 399k]
  ------------------
 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|   399k|#ifdef HAVE_MEMMEM
 2261|   399k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  375|   399k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2261:7): [True: 399k, False: 0]
  |  Branch (2261:19): [True: 225k, False: 173k]
  ------------------
 2262|   225k|			const char *found;
 2263|   225k|			idx = m->str_range + slen;
  ------------------
  |  |  374|   225k|#define str_range _u._s._count
  ------------------
 2264|   225k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  374|   225k|#define str_range _u._s._count
  ------------------
  |  Branch (2264:8): [True: 3.20k, False: 222k]
  |  Branch (2264:29): [True: 89.4k, False: 133k]
  ------------------
 2265|  92.6k|				idx = ms->search.s_len;
 2266|   225k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  444|   225k|#define CAST(T, b)	((T)(b))
  ------------------
 2267|   225k|			    m->value.s, slen));
 2268|   225k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   225k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2268:8): [True: 0, False: 225k]
  ------------------
 2269|      0|				fprintf(stderr, "] %sfound\n",
 2270|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2270:9): [True: 0, False: 0]
  ------------------
 2271|      0|			}
 2272|   225k|			if (!found) {
  ------------------
  |  Branch (2272:8): [True: 224k, False: 1.51k]
  ------------------
 2273|   224k|				v = 1;
 2274|   224k|				break;
 2275|   224k|			}
 2276|  1.51k|			idx = found - ms->search.s;
 2277|  1.51k|			ms->search.offset += idx;
 2278|  1.51k|			ms->search.rm_len = ms->search.s_len - idx;
 2279|  1.51k|			break;
 2280|   225k|		}
 2281|   173k|#endif
 2282|       |
 2283|   156M|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  374|   156M|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  374|   156M|#define str_range _u._s._count
  ------------------
  |  Branch (2283:17): [True: 0, False: 156M]
  |  Branch (2283:38): [True: 156M, False: 78.6k]
  ------------------
 2284|   156M|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2284:8): [True: 95.0k, False: 155M]
  ------------------
 2285|  95.0k|				v = 1;
 2286|  95.0k|				break;
 2287|  95.0k|			}
 2288|       |
 2289|   155M|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2290|   155M|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  375|   155M|#define str_flags _u._s._flags
  ------------------
 2291|   155M|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2291:8): [True: 227, False: 155M]
  ------------------
 2292|    227|				ms->search.offset += idx;
 2293|    227|				ms->search.rm_len = ms->search.s_len - idx;
 2294|    227|				break;
 2295|    227|			}
 2296|   155M|		}
 2297|   173k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   173k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2297:7): [True: 0, False: 173k]
  ------------------
 2298|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2298:35): [True: 0, False: 0]
  ------------------
 2299|      0|		}
 2300|   173k|		break;
 2301|   399k|	}
 2302|   160k|	case FILE_REGEX: {
  ------------------
  |  |  257|   160k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2302:2): [True: 160k, False: 64.6M]
  ------------------
 2303|   160k|		int rc;
 2304|   160k|		file_regex_t *rx = *m_cache;
 2305|   160k|		const char *search;
 2306|   160k|		regmatch_t pmatch;
 2307|   160k|		size_t slen = ms->search.s_len;
 2308|   160k|		char *copy;
 2309|       |
 2310|   160k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2310:7): [True: 31, False: 160k]
  ------------------
 2311|     31|			return 0;
 2312|       |
 2313|   160k|		if (rx == NULL) {
  ------------------
  |  Branch (2313:7): [True: 143, False: 160k]
  ------------------
 2314|    143|			rx = *m_cache = alloc_regex(ms, m);
 2315|    143|			if (rx == NULL)
  ------------------
  |  Branch (2315:8): [True: 0, False: 143]
  ------------------
 2316|      0|				return -1;
 2317|    143|		}
 2318|   160k|		l = 0;
 2319|   160k|		if (slen != 0) {
  ------------------
  |  Branch (2319:7): [True: 158k, False: 1.40k]
  ------------------
 2320|   158k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  444|   158k|#define CAST(T, b)	((T)(b))
  ------------------
 2321|   158k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2321:11): [True: 0, False: 158k]
  ------------------
 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|   158k|		    memcpy(copy, ms->search.s, slen);
 2328|   158k|		    copy[--slen] = '\0';
 2329|   158k|		    search = copy;
 2330|   158k|		} else {
 2331|  1.40k|		    search = CCAST(char *, "");
  ------------------
  |  |  446|  1.40k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2332|  1.40k|		    copy = NULL;
 2333|  1.40k|		}
 2334|   160k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  445|   160k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2335|   160k|		    1, &pmatch, 0);
 2336|   160k|		free(copy);
 2337|   160k|		switch (rc) {
 2338|  2.02k|		case 0:
  ------------------
  |  Branch (2338:3): [True: 2.02k, False: 158k]
  ------------------
 2339|  2.02k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  444|  2.02k|#define CAST(T, b)	((T)(b))
  ------------------
 2340|  2.02k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  444|  2.02k|#define CAST(T, b)	((T)(b))
  ------------------
 2341|  2.02k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  444|  2.02k|#define CAST(T, b)	((T)(b))
  ------------------
 2342|  2.02k|			    pmatch.rm_eo - pmatch.rm_so);
 2343|  2.02k|			v = 0;
 2344|  2.02k|			break;
 2345|       |
 2346|   158k|		case REG_NOMATCH:
  ------------------
  |  Branch (2346:3): [True: 158k, False: 2.02k]
  ------------------
 2347|   158k|			v = 1;
 2348|   158k|			break;
 2349|       |
 2350|      0|		default:
  ------------------
  |  Branch (2350:3): [True: 0, False: 160k]
  ------------------
 2351|      0|			return -1;
 2352|   160k|		}
 2353|   160k|		break;
 2354|   160k|	}
 2355|   160k|	case FILE_USE:
  ------------------
  |  |  286|  42.5k|#define				FILE_USE		46
  ------------------
  |  Branch (2355:2): [True: 42.5k, False: 64.7M]
  ------------------
 2356|  42.5k|		return ms->ms_value.q != 0;
 2357|  44.6k|	case FILE_NAME:
  ------------------
  |  |  285|  44.6k|#define				FILE_NAME		45
  ------------------
  |  Branch (2357:2): [True: 44.6k, False: 64.7M]
  ------------------
 2358|  54.8k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  54.8k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2358:2): [True: 10.2k, False: 64.7M]
  ------------------
 2359|  54.8k|		return 1;
 2360|   306k|	case FILE_DER:
  ------------------
  |  |  288|   306k|#define				FILE_DER		48
  ------------------
  |  Branch (2360:2): [True: 306k, False: 64.4M]
  ------------------
 2361|   306k|		matched = der_cmp(ms, m);
 2362|   306k|		if (matched == -1) {
  ------------------
  |  Branch (2362:7): [True: 103k, False: 202k]
  ------------------
 2363|   103k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   103k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2363:8): [True: 0, False: 103k]
  ------------------
 2364|      0|				(void) fprintf(stderr,
 2365|      0|				    "EOF comparing DER entries\n");
 2366|      0|			}
 2367|   103k|			return 0;
 2368|   103k|		}
 2369|   202k|		return matched;
 2370|   140k|	case FILE_GUID:
  ------------------
  |  |  289|   140k|#define				FILE_GUID		49
  ------------------
  |  Branch (2370:2): [True: 140k, False: 64.6M]
  ------------------
 2371|   140k|		l = 0;
 2372|   140k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2373|   140k|		break;
 2374|      0|	default:
  ------------------
  |  Branch (2374:2): [True: 0, False: 64.8M]
  ------------------
 2375|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2376|      0|		return -1;
 2377|  64.8M|	}
 2378|       |
 2379|  64.3M|	v = file_signextend(ms, m, v);
 2380|       |
 2381|  64.3M|	switch (m->reln) {
 2382|  64.3k|	case 'x':
  ------------------
  |  Branch (2382:2): [True: 64.3k, False: 64.3M]
  ------------------
 2383|  64.3k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  64.3k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2383:7): [True: 0, False: 64.3k]
  ------------------
 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|  64.3k|		matched = 1;
 2387|  64.3k|		break;
 2388|       |
 2389|  45.6k|	case '!':
  ------------------
  |  Branch (2389:2): [True: 45.6k, False: 64.3M]
  ------------------
 2390|  45.6k|		matched = v != l;
 2391|  45.6k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  45.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2391:7): [True: 0, False: 45.6k]
  ------------------
 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|  45.6k|		break;
 2397|       |
 2398|  63.8M|	case '=':
  ------------------
  |  Branch (2398:2): [True: 63.8M, False: 527k]
  ------------------
 2399|  63.8M|		matched = v == l;
 2400|  63.8M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  63.8M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2400:7): [True: 0, False: 63.8M]
  ------------------
 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|  63.8M|		break;
 2406|       |
 2407|   160k|	case '>':
  ------------------
  |  Branch (2407:2): [True: 160k, False: 64.2M]
  ------------------
 2408|   160k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  226|   160k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2408:7): [True: 125k, False: 34.2k]
  ------------------
 2409|   125k|			matched = v > l;
 2410|   125k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   125k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2410:8): [True: 0, False: 125k]
  ------------------
 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|   125k|		}
 2416|  34.2k|		else {
 2417|  34.2k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  444|  34.2k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  444|  34.2k|#define CAST(T, b)	((T)(b))
  ------------------
 2418|  34.2k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  34.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2418:8): [True: 0, False: 34.2k]
  ------------------
 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|  34.2k|		}
 2424|   160k|		break;
 2425|       |
 2426|   225k|	case '<':
  ------------------
  |  Branch (2426:2): [True: 225k, False: 64.1M]
  ------------------
 2427|   225k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  226|   225k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2427:7): [True: 191k, False: 34.1k]
  ------------------
 2428|   191k|			matched = v < l;
 2429|   191k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   191k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2429:8): [True: 0, False: 191k]
  ------------------
 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|   191k|		}
 2435|  34.1k|		else {
 2436|  34.1k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  444|  34.1k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  444|  34.1k|#define CAST(T, b)	((T)(b))
  ------------------
 2437|  34.1k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  34.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2437:8): [True: 0, False: 34.1k]
  ------------------
 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|  34.1k|		}
 2443|   225k|		break;
 2444|       |
 2445|  31.0k|	case '&':
  ------------------
  |  Branch (2445:2): [True: 31.0k, False: 64.3M]
  ------------------
 2446|  31.0k|		matched = (v & l) == l;
 2447|  31.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  31.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2447:7): [True: 0, False: 31.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|  31.0k|		break;
 2455|       |
 2456|    572|	case '^':
  ------------------
  |  Branch (2456:2): [True: 572, False: 64.3M]
  ------------------
 2457|    572|		matched = (v & l) != l;
 2458|    572|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    572|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2458:7): [True: 0, False: 572]
  ------------------
 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|    572|		break;
 2465|       |
 2466|      0|	default:
  ------------------
  |  Branch (2466:2): [True: 0, False: 64.3M]
  ------------------
 2467|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2468|      0|		    m->reln);
 2469|      0|		return -1;
 2470|  64.3M|	}
 2471|  64.3M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  64.3M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2471:6): [True: 0, False: 64.3M]
  ------------------
 2472|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2473|      0|		    file_magic_strength(m, 1));
 2474|      0|	}
 2475|       |
 2476|  64.3M|	return matched;
 2477|  64.3M|}
softmagic.c:file_strncmp:
 1987|   196M|{
 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|   196M|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  445|   196M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1995|   196M|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  445|   196M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1996|   196M|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  389|   196M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  388|   196M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1997|   196M|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  390|   196M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  388|   196M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1998|   196M|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (1998:33): [True: 22.8M, False: 173M]
  ------------------
 1999|   196M|	uint64_t v;
 2000|       |
 2001|       |	/*
 2002|       |	 * What we want here is v = strncmp(s1, s2, len),
 2003|       |	 * but ignoring any nulls.
 2004|       |	 */
 2005|   196M|	v = 0;
 2006|   196M|	len++;
 2007|   196M|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2007:6): [True: 38.8M, False: 158M]
  ------------------
 2008|  39.4M|		while (--len > 0)
  ------------------
  |  Branch (2008:10): [True: 39.4M, False: 40.2k]
  ------------------
 2009|  39.4M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2009:8): [True: 38.8M, False: 615k]
  ------------------
 2010|  38.8M|				break;
 2011|  38.8M|	}
 2012|   158M|	else { /* combine the others */
 2013|   158M|		while (--len > 0) {
  ------------------
  |  Branch (2013:10): [True: 158M, False: 23.8k]
  ------------------
 2014|   158M|			if (b >= eb) {
  ------------------
  |  Branch (2014:8): [True: 202k, False: 158M]
  ------------------
 2015|   202k|				v = 1;
 2016|   202k|				break;
 2017|   202k|			}
 2018|   158M|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  391|   158M|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  388|   158M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2018:8): [True: 22.9M, False: 135M]
  ------------------
 2019|   158M|			    islower(*a)) {
 2020|  1.98M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2020:9): [True: 1.95M, False: 35.3k]
  ------------------
 2021|  1.95M|					break;
 2022|  1.98M|			}
 2023|   156M|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  392|   156M|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  388|   156M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2023:13): [True: 11.0k, False: 156M]
  ------------------
 2024|   156M|			    isupper(*a)) {
 2025|  10.9k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2025:9): [True: 10.8k, False: 144]
  ------------------
 2026|  10.8k|					break;
 2027|  10.9k|			}
 2028|   156M|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  389|   156M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  388|   156M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2028:13): [True: 16.6M, False: 139M]
  ------------------
 2029|   156M|			    isspace(*a)) {
 2030|   784k|				a++;
 2031|   784k|				if (isspace(*b)) {
 2032|   214k|					b++;
 2033|   214k|					if (!isspace(*a))
  ------------------
  |  Branch (2033:10): [True: 214k, False: 0]
  ------------------
 2034|  6.08G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2034:14): [True: 6.08G, False: 202k]
  ------------------
 2035|  6.08G|							b++;
 2036|   214k|				}
 2037|   570k|				else {
 2038|   570k|					v = 1;
 2039|   570k|					break;
 2040|   570k|				}
 2041|   784k|			}
 2042|   155M|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  390|   155M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  388|   155M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2042:13): [True: 6.22M, False: 149M]
  ------------------
 2043|   155M|			    isspace(*a)) {
 2044|  3.37k|				a++;
 2045|  9.46k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2045:12): [True: 9.42k, False: 45]
  ------------------
 2046|  6.09k|					b++;
 2047|  3.37k|			}
 2048|   155M|			else {
 2049|   155M|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2049:9): [True: 155M, False: 117k]
  ------------------
 2050|   155M|					break;
 2051|   155M|			}
 2052|   158M|		}
 2053|   158M|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  407|  23.8k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  388|  23.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2053:7): [True: 23.8k, False: 157M]
  |  Branch (2053:19): [True: 23.8k, False: 0]
  |  Branch (2053:29): [True: 184, False: 23.7k]
  ------------------
 2054|    184|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2054:8): [True: 121, False: 63]
  |  Branch (2054:14): [True: 91, False: 30]
  ------------------
 2055|     91|				v = 1;
 2056|    184|		}
 2057|   158M|	}
 2058|   196M|	return v;
 2059|   196M|}
softmagic.c:file_strncmp16:
 2064|  47.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|  47.8k|	flags = 0;
 2071|  47.8k|	return file_strncmp(a, b, len, maxlen, flags);
 2072|  47.8k|}
softmagic.c:alloc_regex:
 2076|    143|{
 2077|    143|	int rc;
 2078|    143|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  444|    143|#define CAST(T, b)	((T)(b))
  ------------------
 2079|       |
 2080|    143|	if (rx == NULL) {
  ------------------
  |  Branch (2080:6): [True: 0, False: 143]
  ------------------
 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|    143|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2087|    143|	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  375|    143|#define str_flags _u._s._flags
  ------------------
              	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  424|    143|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  391|    143|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|    143|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  392|    143|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|    143|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2087:7): [True: 19, False: 124]
  ------------------
 2088|    143|	if (rc == 0)
  ------------------
  |  Branch (2088:6): [True: 143, False: 0]
  ------------------
 2089|    143|		return rx;
 2090|       |
 2091|      0|	free(rx);
 2092|      0|	return NULL;
 2093|    143|}
softmagic.c:handle_annotation:
 2481|   539k|{
 2482|   539k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   539k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2482:6): [True: 0, False: 539k]
  |  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|   539k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   539k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2489:6): [True: 0, False: 539k]
  |  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|   539k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   539k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2496:6): [True: 0, False: 539k]
  |  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|   539k|	return 0;
 2510|   539k|}
softmagic.c:varexpand:
  530|   111k|{
  531|   111k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  532|   111k|	size_t l;
  533|       |
  534|   111k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (534:19): [True: 429, False: 111k]
  ------------------
  535|    429|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  444|    429|#define CAST(T, b)	((T)(b))
  ------------------
  536|    429|		if (l >= len)
  ------------------
  |  Branch (536:7): [True: 0, False: 429]
  ------------------
  537|      0|			return -1;
  538|    429|		memcpy(buf, sptr, l);
  539|    429|		buf += l;
  540|    429|		len -= l;
  541|    429|		ptr += 2;
  542|    429|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (542:7): [True: 0, False: 429]
  |  Branch (542:16): [True: 0, False: 429]
  ------------------
  543|      0|			return -1;
  544|  6.43k|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (544:26): [True: 6.43k, False: 0]
  |  Branch (544:33): [True: 6.00k, False: 429]
  ------------------
  545|  6.00k|			continue;
  546|    429|		if (*et != ':')
  ------------------
  |  Branch (546:7): [True: 0, False: 429]
  ------------------
  547|      0|			return -1;
  548|  6.00k|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (548:25): [True: 6.00k, False: 0]
  |  Branch (548:32): [True: 5.57k, False: 429]
  ------------------
  549|  5.57k|			continue;
  550|    429|		if (*ee != '}')
  ------------------
  |  Branch (550:7): [True: 0, False: 429]
  ------------------
  551|      0|			return -1;
  552|    429|		switch (*ptr) {
  553|    429|		case 'x':
  ------------------
  |  Branch (553:3): [True: 429, False: 0]
  ------------------
  554|    429|			if (ms->mode & 0111) {
  ------------------
  |  Branch (554:8): [True: 0, False: 429]
  ------------------
  555|      0|				ptr = t;
  556|      0|				l = et - t;
  557|    429|			} else {
  558|    429|				ptr = e;
  559|    429|				l = ee - e;
  560|    429|			}
  561|    429|			break;
  562|      0|		default:
  ------------------
  |  Branch (562:3): [True: 0, False: 429]
  ------------------
  563|      0|			return -1;
  564|    429|		}
  565|    429|		if (l >= len)
  ------------------
  |  Branch (565:7): [True: 0, False: 429]
  ------------------
  566|      0|			return -1;
  567|    429|		memcpy(buf, ptr, l);
  568|    429|		buf += l;
  569|    429|		len -= l;
  570|    429|		sptr = ee + 1;
  571|    429|	}
  572|       |
  573|   111k|	l = strlen(sptr);
  574|   111k|	if (l >= len)
  ------------------
  |  Branch (574:6): [True: 0, False: 111k]
  ------------------
  575|      0|		return -1;
  576|       |
  577|   111k|	memcpy(buf, sptr, l);
  578|   111k|	buf[l] = '\0';
  579|   111k|	return 0;
  580|   111k|}
softmagic.c:print_sep:
 2514|  37.5k|{
 2515|  37.5k|	if (firstline)
  ------------------
  |  Branch (2515:6): [True: 9.49k, False: 28.0k]
  ------------------
 2516|  9.49k|		return 0;
 2517|       |	/*
 2518|       |	 * we found another match
 2519|       |	 * put a newline and '-' to do some simple formatting
 2520|       |	 */
 2521|  28.0k|	return file_separator(ms);
 2522|  37.5k|}
softmagic.c:mprint:
  585|   111k|{
  586|   111k|	uint64_t v;
  587|   111k|	float vf;
  588|   111k|	double vd;
  589|   111k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  590|   111k|	const char *desc;
  591|   111k|	union VALUETYPE *p = &ms->ms_value;
  592|       |
  593|   111k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (593:6): [True: 0, False: 111k]
  ------------------
  594|      0|		desc = m->desc;
  595|   111k|	else
  596|   111k|		desc = ebuf;
  597|       |
  598|   111k|#define	PRINTER(value, format, stype, utype)	\
  599|   111k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  600|   111k|	switch (check_fmt(ms, desc)) { \
  601|   111k|	case -1: \
  602|   111k|		return -1; \
  603|   111k|	case 1: \
  604|   111k|		if (m->flag & UNSIGNED) { \
  605|   111k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  606|   111k|			    CAST(utype, v)); \
  607|   111k|		} else { \
  608|   111k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  609|   111k|			    CAST(stype, v)); \
  610|   111k|		} \
  611|   111k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  612|   111k|			return -1; \
  613|   111k|		break; \
  614|   111k|	default: \
  615|   111k|		if (m->flag & UNSIGNED) { \
  616|   111k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  617|   111k|			   CAST(utype, v)) == -1) \
  618|   111k|			   return -1; \
  619|   111k|		} else { \
  620|   111k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  621|   111k|			   CAST(stype, v)) == -1) \
  622|   111k|			   return -1; \
  623|   111k|		} \
  624|   111k|		break; \
  625|   111k|	} \
  626|   111k|	break
  627|       |
  628|   111k|  	switch (m->type) {
  629|  17.1k|  	case FILE_BYTE:
  ------------------
  |  |  241|  17.1k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (629:4): [True: 17.1k, False: 94.2k]
  ------------------
  630|  17.1k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  599|  17.1k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  17.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  17.1k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 17.1k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 17.1k]
  |  |  ------------------
  |  |  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|  17.1k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 17.1k, False: 0]
  |  |  ------------------
  |  |  615|  17.1k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  17.1k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 4.79k, False: 12.3k]
  |  |  ------------------
  |  |  616|  4.79k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  4.79k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 4.79k]
  |  |  ------------------
  |  |  617|  4.79k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  4.79k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  4.79k|			   return -1; \
  |  |  619|  12.3k|		} else { \
  |  |  620|  12.3k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  12.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 12.3k]
  |  |  ------------------
  |  |  621|  12.3k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  12.3k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  12.3k|			   return -1; \
  |  |  623|  12.3k|		} \
  |  |  624|  17.1k|		break; \
  |  |  625|  17.1k|	} \
  |  |  626|  17.1k|	break
  ------------------
  631|       |
  632|  17.1k|  	case FILE_SHORT:
  ------------------
  |  |  242|  1.27k|#define				FILE_SHORT		2
  ------------------
  |  Branch (632:4): [True: 1.27k, False: 110k]
  ------------------
  633|  6.19k|  	case FILE_BESHORT:
  ------------------
  |  |  247|  6.19k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (633:4): [True: 4.91k, False: 106k]
  ------------------
  634|  15.0k|  	case FILE_LESHORT:
  ------------------
  |  |  250|  15.0k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (634:4): [True: 8.83k, False: 102k]
  ------------------
  635|  15.0k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  599|  15.0k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  15.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  15.0k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 15.0k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 15.0k]
  |  |  ------------------
  |  |  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|  15.0k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 15.0k, False: 0]
  |  |  ------------------
  |  |  615|  15.0k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  15.0k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 8.33k, False: 6.69k]
  |  |  ------------------
  |  |  616|  8.33k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  8.33k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 8.33k]
  |  |  ------------------
  |  |  617|  8.33k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  8.33k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  8.33k|			   return -1; \
  |  |  619|  8.33k|		} else { \
  |  |  620|  6.69k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  6.69k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 6.69k]
  |  |  ------------------
  |  |  621|  6.69k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  6.69k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  6.69k|			   return -1; \
  |  |  623|  6.69k|		} \
  |  |  624|  15.0k|		break; \
  |  |  625|  15.0k|	} \
  |  |  626|  15.0k|	break
  ------------------
  636|       |
  637|  15.0k|  	case FILE_LONG:
  ------------------
  |  |  244|    345|#define				FILE_LONG		4
  ------------------
  |  Branch (637:4): [True: 345, False: 111k]
  ------------------
  638|  21.2k|  	case FILE_BELONG:
  ------------------
  |  |  248|  21.2k|#define				FILE_BELONG		8
  ------------------
  |  Branch (638:4): [True: 20.9k, False: 90.4k]
  ------------------
  639|  28.4k|  	case FILE_LELONG:
  ------------------
  |  |  251|  28.4k|#define				FILE_LELONG		11
  ------------------
  |  Branch (639:4): [True: 7.19k, False: 104k]
  ------------------
  640|  28.4k|  	case FILE_MELONG:
  ------------------
  |  |  263|  28.4k|#define				FILE_MELONG		23
  ------------------
  |  Branch (640:4): [True: 28, False: 111k]
  ------------------
  641|  28.4k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  599|  28.4k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  28.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  28.4k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 28.4k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 28.4k]
  |  |  ------------------
  |  |  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|  28.4k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 28.4k, False: 0]
  |  |  ------------------
  |  |  615|  28.4k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  28.4k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 8.78k, False: 19.6k]
  |  |  ------------------
  |  |  616|  8.78k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  8.78k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 8.78k]
  |  |  ------------------
  |  |  617|  8.78k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  8.78k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  8.78k|			   return -1; \
  |  |  619|  19.6k|		} else { \
  |  |  620|  19.6k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  19.6k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 19.6k]
  |  |  ------------------
  |  |  621|  19.6k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  19.6k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  19.6k|			   return -1; \
  |  |  623|  19.6k|		} \
  |  |  624|  28.4k|		break; \
  |  |  625|  28.4k|	} \
  |  |  626|  28.4k|	break
  ------------------
  642|       |
  643|  28.4k|  	case FILE_QUAD:
  ------------------
  |  |  264|     93|#define				FILE_QUAD		24
  ------------------
  |  Branch (643:4): [True: 93, False: 111k]
  ------------------
  644|  1.34k|  	case FILE_BEQUAD:
  ------------------
  |  |  266|  1.34k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (644:4): [True: 1.25k, False: 110k]
  ------------------
  645|  1.82k|  	case FILE_LEQUAD:
  ------------------
  |  |  265|  1.82k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (645:4): [True: 478, False: 110k]
  ------------------
  646|  1.89k|	case FILE_OFFSET:
  ------------------
  |  |  290|  1.89k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (646:2): [True: 72, False: 111k]
  ------------------
  647|  1.89k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  599|  1.89k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  1.89k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  1.89k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 1.89k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 1.89k]
  |  |  ------------------
  |  |  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.89k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 1.89k, False: 0]
  |  |  ------------------
  |  |  615|  1.89k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  1.89k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 1.67k, False: 220]
  |  |  ------------------
  |  |  616|  1.67k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  1.67k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 1.67k]
  |  |  ------------------
  |  |  617|  1.67k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  1.67k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  1.67k|			   return -1; \
  |  |  619|  1.67k|		} else { \
  |  |  620|    220|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|    220|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 220]
  |  |  ------------------
  |  |  621|    220|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|    220|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|    220|			   return -1; \
  |  |  623|    220|		} \
  |  |  624|  1.89k|		break; \
  |  |  625|  1.89k|	} \
  |  |  626|  1.89k|	break
  ------------------
  648|       |
  649|  39.0k|  	case FILE_STRING:
  ------------------
  |  |  245|  39.0k|#define				FILE_STRING		5
  ------------------
  |  Branch (649:4): [True: 39.0k, False: 72.3k]
  ------------------
  650|  39.7k|  	case FILE_PSTRING:
  ------------------
  |  |  253|  39.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (650:4): [True: 716, False: 110k]
  ------------------
  651|  39.8k|  	case FILE_BESTRING16:
  ------------------
  |  |  258|  39.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (651:4): [True: 126, False: 111k]
  ------------------
  652|  41.0k|  	case FILE_LESTRING16:
  ------------------
  |  |  259|  41.0k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (652:4): [True: 1.16k, False: 110k]
  ------------------
  653|  41.0k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (653:7): [True: 19.8k, False: 21.1k]
  |  Branch (653:25): [True: 482, False: 20.6k]
  ------------------
  654|  20.3k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|  20.3k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (654:8): [True: 0, False: 20.3k]
  ------------------
  655|  20.3k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  656|  20.3k|			    sizeof(m->value.s))) == -1)
  657|      0|				return -1;
  658|  20.3k|		}
  659|  20.6k|		else {
  660|  20.6k|			char *str = p->s;
  661|       |
  662|       |			/* compute t before we mangle the string? */
  663|       |
  664|  20.6k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (664:8): [True: 19.2k, False: 1.35k]
  ------------------
  665|  19.2k|				str[strcspn(str, "\r\n")] = '\0';
  666|       |
  667|  20.6k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  375|  20.6k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  406|  20.6k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  388|  20.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (667:8): [True: 345, False: 20.2k]
  ------------------
  668|    345|				str = file_strtrim(str);
  669|       |
  670|  20.6k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|  20.6k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (670:8): [True: 0, False: 20.6k]
  ------------------
  671|  20.6k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  672|  20.6k|				sizeof(p->s) - (str - p->s))) == -1)
  673|      0|				return -1;
  674|       |
  675|  20.6k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  253|  20.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (675:8): [True: 716, False: 19.9k]
  ------------------
  676|    716|				size_t l = file_pstring_length_size(ms, m);
  677|    716|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|    716|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|    716|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (677:9): [True: 0, False: 716]
  ------------------
  678|      0|					return -1;
  679|    716|			}
  680|  20.6k|		}
  681|  41.0k|		break;
  682|       |
  683|  41.0k|	case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (683:2): [True: 0, False: 111k]
  ------------------
  684|    103|	case FILE_BEDATE:
  ------------------
  |  |  249|    103|#define				FILE_BEDATE		9
  ------------------
  |  Branch (684:2): [True: 103, False: 111k]
  ------------------
  685|    180|	case FILE_LEDATE:
  ------------------
  |  |  252|    180|#define				FILE_LEDATE		12
  ------------------
  |  Branch (685:2): [True: 77, False: 111k]
  ------------------
  686|    214|	case FILE_MEDATE:
  ------------------
  |  |  261|    214|#define				FILE_MEDATE		21
  ------------------
  |  Branch (686:2): [True: 34, False: 111k]
  ------------------
  687|    214|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    214|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (687:7): [True: 0, False: 214]
  ------------------
  688|    214|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  689|      0|			return -1;
  690|    214|		break;
  691|       |
  692|    214|	case FILE_LDATE:
  ------------------
  |  |  254|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (692:2): [True: 0, False: 111k]
  ------------------
  693|    213|	case FILE_BELDATE:
  ------------------
  |  |  255|    213|#define				FILE_BELDATE		15
  ------------------
  |  Branch (693:2): [True: 213, False: 111k]
  ------------------
  694|    213|	case FILE_LELDATE:
  ------------------
  |  |  256|    213|#define				FILE_LELDATE		16
  ------------------
  |  Branch (694:2): [True: 0, False: 111k]
  ------------------
  695|    213|	case FILE_MELDATE:
  ------------------
  |  |  262|    213|#define				FILE_MELDATE		22
  ------------------
  |  Branch (695:2): [True: 0, False: 111k]
  ------------------
  696|    213|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    213|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (696:7): [True: 0, False: 213]
  ------------------
  697|    213|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  528|    213|#define FILE_T_LOCAL	1
  ------------------
  698|    213|			== -1)
  699|      0|			return -1;
  700|    213|		break;
  701|       |
  702|    213|	case FILE_QDATE:
  ------------------
  |  |  267|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (702:2): [True: 0, False: 111k]
  ------------------
  703|    216|	case FILE_BEQDATE:
  ------------------
  |  |  269|    216|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (703:2): [True: 216, False: 111k]
  ------------------
  704|    216|	case FILE_LEQDATE:
  ------------------
  |  |  268|    216|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (704:2): [True: 0, False: 111k]
  ------------------
  705|    216|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    216|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (705:7): [True: 0, False: 216]
  ------------------
  706|    216|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  707|      0|			return -1;
  708|    216|		break;
  709|       |
  710|    216|	case FILE_QLDATE:
  ------------------
  |  |  270|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (710:2): [True: 0, False: 111k]
  ------------------
  711|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (711:2): [True: 0, False: 111k]
  ------------------
  712|     12|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     12|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (712:2): [True: 12, False: 111k]
  ------------------
  713|     12|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     12|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (713:7): [True: 0, False: 12]
  ------------------
  714|     12|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  528|     12|#define FILE_T_LOCAL	1
  ------------------
  715|      0|			return -1;
  716|     12|		break;
  717|       |
  718|    268|	case FILE_QWDATE:
  ------------------
  |  |  282|    268|#define				FILE_QWDATE		42
  ------------------
  |  Branch (718:2): [True: 268, False: 111k]
  ------------------
  719|    268|	case FILE_BEQWDATE:
  ------------------
  |  |  284|    268|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (719:2): [True: 0, False: 111k]
  ------------------
  720|    940|	case FILE_LEQWDATE:
  ------------------
  |  |  283|    940|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (720:2): [True: 672, False: 110k]
  ------------------
  721|    940|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    940|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (721:7): [True: 0, False: 940]
  ------------------
  722|    940|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  529|    940|#define FILE_T_WINDOWS	2
  ------------------
  723|    940|		    == -1)
  724|      0|			return -1;
  725|    940|		break;
  726|       |
  727|    940|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (727:2): [True: 0, False: 111k]
  ------------------
  728|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (728:2): [True: 0, False: 111k]
  ------------------
  729|    444|	case FILE_LEFLOAT:
  ------------------
  |  |  275|    444|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (729:2): [True: 444, False: 110k]
  ------------------
  730|    444|		vf = p->f;
  731|    444|		switch (check_fmt(ms, desc)) {
  732|      0|		case -1:
  ------------------
  |  Branch (732:3): [True: 0, False: 444]
  ------------------
  733|      0|			return -1;
  734|      0|		case 1:
  ------------------
  |  Branch (734:3): [True: 0, False: 444]
  ------------------
  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|    444|		default:
  ------------------
  |  Branch (739:3): [True: 444, False: 0]
  ------------------
  740|    444|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  158|    444|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (740:8): [True: 0, False: 444]
  ------------------
  741|      0|				return -1;
  742|    444|			break;
  743|    444|		}
  744|    444|  		break;
  745|       |
  746|    444|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (746:2): [True: 0, False: 111k]
  ------------------
  747|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (747:2): [True: 0, False: 111k]
  ------------------
  748|     64|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|     64|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (748:2): [True: 64, False: 111k]
  ------------------
  749|     64|		vd = p->d;
  750|     64|		switch (check_fmt(ms, desc)) {
  751|      0|		case -1:
  ------------------
  |  Branch (751:3): [True: 0, False: 64]
  ------------------
  752|      0|			return -1;
  753|      0|		case 1:
  ------------------
  |  Branch (753:3): [True: 0, False: 64]
  ------------------
  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|     64|		default:
  ------------------
  |  Branch (758:3): [True: 64, False: 0]
  ------------------
  759|     64|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  158|     64|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (759:8): [True: 0, False: 64]
  ------------------
  760|      0|				return -1;
  761|     64|			break;
  762|     64|		}
  763|     64|  		break;
  764|       |
  765|    364|	case FILE_SEARCH:
  ------------------
  |  |  260|    364|#define				FILE_SEARCH		20
  ------------------
  |  Branch (765:2): [True: 364, False: 110k]
  ------------------
  766|    499|	case FILE_REGEX: {
  ------------------
  |  |  257|    499|#define				FILE_REGEX		17
  ------------------
  |  Branch (766:2): [True: 135, False: 111k]
  ------------------
  767|    499|		char *cp, *scp;
  768|    499|		int rval;
  769|       |
  770|    499|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  445|    499|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  771|    499|		    ms->search.rm_len);
  772|    499|		if (cp == NULL) {
  ------------------
  |  Branch (772:7): [True: 0, False: 499]
  ------------------
  773|      0|			file_oomem(ms, ms->search.rm_len);
  774|      0|			return -1;
  775|      0|		}
  776|    499|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  375|    499|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  406|    499|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  388|    499|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (776:9): [True: 83, False: 416]
  ------------------
  777|       |
  778|    499|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  158|    499|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  779|    499|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  780|    499|		free(cp);
  781|       |
  782|    499|		if (rval == -1)
  ------------------
  |  Branch (782:7): [True: 0, False: 499]
  ------------------
  783|      0|			return -1;
  784|    499|		break;
  785|    499|	}
  786|       |
  787|    758|	case FILE_DEFAULT:
  ------------------
  |  |  243|    758|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (787:2): [True: 758, False: 110k]
  ------------------
  788|    761|	case FILE_CLEAR:
  ------------------
  |  |  287|    761|#define				FILE_CLEAR		47
  ------------------
  |  Branch (788:2): [True: 3, False: 111k]
  ------------------
  789|    761|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (789:9): [True: 0, False: 761]
  ------------------
  790|      0|			return -1;
  791|    761|		break;
  792|       |
  793|    773|	case FILE_INDIRECT:
  ------------------
  |  |  281|    773|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (793:2): [True: 773, False: 110k]
  ------------------
  794|    773|	case FILE_USE:
  ------------------
  |  |  286|    773|#define				FILE_USE		46
  ------------------
  |  Branch (794:2): [True: 0, False: 111k]
  ------------------
  795|  3.84k|	case FILE_NAME:
  ------------------
  |  |  285|  3.84k|#define				FILE_NAME		45
  ------------------
  |  Branch (795:2): [True: 3.06k, False: 108k]
  ------------------
  796|  3.84k|		break;
  797|    176|	case FILE_DER:
  ------------------
  |  |  288|    176|#define				FILE_DER		48
  ------------------
  |  Branch (797:2): [True: 176, False: 111k]
  ------------------
  798|    176|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    176|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (798:7): [True: 0, False: 176]
  ------------------
  799|    176|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  800|    176|			sizeof(ms->ms_value.s))) == -1)
  801|      0|			return -1;
  802|    176|		break;
  803|    410|	case FILE_GUID:
  ------------------
  |  |  289|    410|#define				FILE_GUID		49
  ------------------
  |  Branch (803:2): [True: 410, False: 110k]
  ------------------
  804|    410|		(void) file_print_guid(buf, sizeof(buf), ms->ms_value.guid);
  805|    410|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|    410|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (805:7): [True: 0, False: 410]
  ------------------
  806|      0|			return -1;
  807|    410|		break;
  808|    410|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|      0|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (808:2): [True: 0, False: 111k]
  ------------------
  809|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|      0|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (809:2): [True: 0, False: 111k]
  ------------------
  810|     20|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|     20|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (810:2): [True: 20, False: 111k]
  ------------------
  811|     20|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     20|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (811:7): [True: 0, False: 20]
  ------------------
  812|     20|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  813|      0|			return -1;
  814|     20|		break;
  815|     20|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|      0|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (815:2): [True: 0, False: 111k]
  ------------------
  816|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|      0|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (816:2): [True: 0, False: 111k]
  ------------------
  817|     20|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|     20|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (817:2): [True: 20, False: 111k]
  ------------------
  818|     20|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     20|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (818:7): [True: 0, False: 20]
  ------------------
  819|     20|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  820|      0|			return -1;
  821|     20|		break;
  822|     20|	case FILE_OCTAL:
  ------------------
  |  |  299|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (822:2): [True: 0, False: 111k]
  ------------------
  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: 111k]
  ------------------
  828|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  829|      0|		return -1;
  830|   111k|	}
  831|   111k|	return 0;
  832|   111k|}
softmagic.c:check_fmt:
  489|  63.0k|{
  490|  63.0k|	file_regex_t rx;
  491|  63.0k|	int rc, rv = -1;
  492|  63.0k|        const char* pat = "%[-0-9\\.]*s";
  493|       |
  494|  63.0k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (494:6): [True: 41.2k, False: 21.7k]
  ------------------
  495|  41.2k|		return 0;
  496|       |
  497|  21.7k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  498|  21.7k|	if (rc == 0) {
  ------------------
  |  Branch (498:6): [True: 21.7k, False: 0]
  ------------------
  499|  21.7k|		rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
  500|  21.7k|		rv = !rc;
  501|  21.7k|	}
  502|  21.7k|	file_regfree(&rx);
  503|  21.7k|	return rv;
  504|  63.0k|}
softmagic.c:moffset:
  837|   539k|{
  838|   539k|	size_t nbytes = b->flen;
  839|   539k|	int32_t o;
  840|       |
  841|   539k|  	switch (m->type) {
  842|   159k|  	case FILE_BYTE:
  ------------------
  |  |  241|   159k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (842:4): [True: 159k, False: 379k]
  ------------------
  843|   159k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  444|   159k|#define CAST(T, b)	((T)(b))
  ------------------
  844|   159k|		break;
  845|       |
  846|  12.6k|  	case FILE_SHORT:
  ------------------
  |  |  242|  12.6k|#define				FILE_SHORT		2
  ------------------
  |  Branch (846:4): [True: 12.6k, False: 526k]
  ------------------
  847|  44.1k|  	case FILE_BESHORT:
  ------------------
  |  |  247|  44.1k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (847:4): [True: 31.4k, False: 507k]
  ------------------
  848|  71.2k|  	case FILE_LESHORT:
  ------------------
  |  |  250|  71.2k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (848:4): [True: 27.0k, False: 512k]
  ------------------
  849|  71.2k|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|  71.2k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (849:2): [True: 0, False: 539k]
  ------------------
  850|  71.2k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  71.2k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (850:2): [True: 20, False: 539k]
  ------------------
  851|  71.2k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  71.2k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (851:2): [True: 0, False: 539k]
  ------------------
  852|  71.2k|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|  71.2k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (852:2): [True: 0, False: 539k]
  ------------------
  853|  71.2k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  71.2k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (853:2): [True: 20, False: 539k]
  ------------------
  854|  71.2k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  71.2k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (854:2): [True: 0, False: 539k]
  ------------------
  855|  71.2k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  444|  71.2k|#define CAST(T, b)	((T)(b))
  ------------------
  856|  71.2k|		break;
  857|       |
  858|  3.20k|  	case FILE_LONG:
  ------------------
  |  |  244|  3.20k|#define				FILE_LONG		4
  ------------------
  |  Branch (858:4): [True: 3.20k, False: 536k]
  ------------------
  859|  66.0k|  	case FILE_BELONG:
  ------------------
  |  |  248|  66.0k|#define				FILE_BELONG		8
  ------------------
  |  Branch (859:4): [True: 62.8k, False: 476k]
  ------------------
  860|  90.1k|  	case FILE_LELONG:
  ------------------
  |  |  251|  90.1k|#define				FILE_LELONG		11
  ------------------
  |  Branch (860:4): [True: 24.1k, False: 515k]
  ------------------
  861|  90.2k|  	case FILE_MELONG:
  ------------------
  |  |  263|  90.2k|#define				FILE_MELONG		23
  ------------------
  |  Branch (861:4): [True: 28, False: 539k]
  ------------------
  862|  90.2k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  444|  90.2k|#define CAST(T, b)	((T)(b))
  ------------------
  863|  90.2k|		break;
  864|       |
  865|  20.6k|  	case FILE_QUAD:
  ------------------
  |  |  264|  20.6k|#define				FILE_QUAD		24
  ------------------
  |  Branch (865:4): [True: 20.6k, False: 518k]
  ------------------
  866|  25.2k|  	case FILE_BEQUAD:
  ------------------
  |  |  266|  25.2k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (866:4): [True: 4.59k, False: 534k]
  ------------------
  867|  26.0k|  	case FILE_LEQUAD:
  ------------------
  |  |  265|  26.0k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (867:4): [True: 758, False: 538k]
  ------------------
  868|  26.0k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  444|  26.0k|#define CAST(T, b)	((T)(b))
  ------------------
  869|  26.0k|		break;
  870|       |
  871|  70.9k|  	case FILE_STRING:
  ------------------
  |  |  245|  70.9k|#define				FILE_STRING		5
  ------------------
  |  Branch (871:4): [True: 70.9k, False: 468k]
  ------------------
  872|  71.6k|  	case FILE_PSTRING:
  ------------------
  |  |  253|  71.6k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (872:4): [True: 720, False: 538k]
  ------------------
  873|  71.7k|  	case FILE_BESTRING16:
  ------------------
  |  |  258|  71.7k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (873:4): [True: 126, False: 539k]
  ------------------
  874|  72.9k|  	case FILE_LESTRING16:
  ------------------
  |  |  259|  72.9k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (874:4): [True: 1.16k, False: 538k]
  ------------------
  875|  72.9k|	case FILE_OCTAL:
  ------------------
  |  |  299|  72.9k|#define				FILE_OCTAL		59
  ------------------
  |  Branch (875:2): [True: 0, False: 539k]
  ------------------
  876|  72.9k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (876:7): [True: 25.5k, False: 47.3k]
  |  Branch (876:25): [True: 1.37k, False: 46.0k]
  ------------------
  877|  26.9k|			o = ms->offset + m->vallen;
  878|  46.0k|		} else {
  879|  46.0k|			union VALUETYPE *p = &ms->ms_value;
  880|       |
  881|  46.0k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (881:8): [True: 40.3k, False: 5.71k]
  ------------------
  882|  40.3k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  883|  46.0k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  444|  46.0k|#define CAST(T, b)	((T)(b))
  ------------------
  884|  46.0k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  253|  46.0k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (884:8): [True: 720, False: 45.2k]
  ------------------
  885|    720|				size_t l = file_pstring_length_size(ms, m);
  886|    720|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|    720|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|    720|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (886:9): [True: 0, False: 720]
  ------------------
  887|      0|					return -1;
  888|    720|				o += CAST(uint32_t, l);
  ------------------
  |  |  444|    720|#define CAST(T, b)	((T)(b))
  ------------------
  889|    720|			}
  890|  46.0k|		}
  891|  72.9k|		break;
  892|       |
  893|  72.9k|	case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (893:2): [True: 0, False: 539k]
  ------------------
  894|    103|	case FILE_BEDATE:
  ------------------
  |  |  249|    103|#define				FILE_BEDATE		9
  ------------------
  |  Branch (894:2): [True: 103, False: 539k]
  ------------------
  895|    180|	case FILE_LEDATE:
  ------------------
  |  |  252|    180|#define				FILE_LEDATE		12
  ------------------
  |  Branch (895:2): [True: 77, False: 539k]
  ------------------
  896|    214|	case FILE_MEDATE:
  ------------------
  |  |  261|    214|#define				FILE_MEDATE		21
  ------------------
  |  Branch (896:2): [True: 34, False: 539k]
  ------------------
  897|    214|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  444|    214|#define CAST(T, b)	((T)(b))
  ------------------
  898|    214|		break;
  899|       |
  900|      0|	case FILE_LDATE:
  ------------------
  |  |  254|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (900:2): [True: 0, False: 539k]
  ------------------
  901|    213|	case FILE_BELDATE:
  ------------------
  |  |  255|    213|#define				FILE_BELDATE		15
  ------------------
  |  Branch (901:2): [True: 213, False: 539k]
  ------------------
  902|    213|	case FILE_LELDATE:
  ------------------
  |  |  256|    213|#define				FILE_LELDATE		16
  ------------------
  |  Branch (902:2): [True: 0, False: 539k]
  ------------------
  903|    213|	case FILE_MELDATE:
  ------------------
  |  |  262|    213|#define				FILE_MELDATE		22
  ------------------
  |  Branch (903:2): [True: 0, False: 539k]
  ------------------
  904|    213|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  444|    213|#define CAST(T, b)	((T)(b))
  ------------------
  905|    213|		break;
  906|       |
  907|      0|	case FILE_QDATE:
  ------------------
  |  |  267|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (907:2): [True: 0, False: 539k]
  ------------------
  908|    216|	case FILE_BEQDATE:
  ------------------
  |  |  269|    216|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (908:2): [True: 216, False: 539k]
  ------------------
  909|    216|	case FILE_LEQDATE:
  ------------------
  |  |  268|    216|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (909:2): [True: 0, False: 539k]
  ------------------
  910|    216|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  444|    216|#define CAST(T, b)	((T)(b))
  ------------------
  911|    216|		break;
  912|       |
  913|      0|	case FILE_QLDATE:
  ------------------
  |  |  270|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (913:2): [True: 0, False: 539k]
  ------------------
  914|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (914:2): [True: 0, False: 539k]
  ------------------
  915|     12|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     12|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (915:2): [True: 12, False: 539k]
  ------------------
  916|     12|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  444|     12|#define CAST(T, b)	((T)(b))
  ------------------
  917|     12|		break;
  918|       |
  919|      0|  	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (919:4): [True: 0, False: 539k]
  ------------------
  920|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (920:4): [True: 0, False: 539k]
  ------------------
  921|    444|  	case FILE_LEFLOAT:
  ------------------
  |  |  275|    444|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (921:4): [True: 444, False: 538k]
  ------------------
  922|    444|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  444|    444|#define CAST(T, b)	((T)(b))
  ------------------
  923|    444|		break;
  924|       |
  925|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (925:4): [True: 0, False: 539k]
  ------------------
  926|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (926:4): [True: 0, False: 539k]
  ------------------
  927|     64|  	case FILE_LEDOUBLE:
  ------------------
  |  |  278|     64|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (927:4): [True: 64, False: 539k]
  ------------------
  928|     64|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  444|     64|#define CAST(T, b)	((T)(b))
  ------------------
  929|     64|		break;
  930|       |
  931|    643|	case FILE_REGEX:
  ------------------
  |  |  257|    643|#define				FILE_REGEX		17
  ------------------
  |  Branch (931:2): [True: 643, False: 538k]
  ------------------
  932|    643|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|    643|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  393|    643|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  388|    643|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (932:7): [True: 23, False: 620]
  ------------------
  933|     23|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  444|     23|#define CAST(T, b)	((T)(b))
  ------------------
  934|    620|		else
  935|    620|			o = CAST(int32_t,
  ------------------
  |  |  444|    620|#define CAST(T, b)	((T)(b))
  ------------------
  936|    643|			    (ms->search.offset + ms->search.rm_len));
  937|    643|		break;
  938|       |
  939|  4.75k|	case FILE_SEARCH:
  ------------------
  |  |  260|  4.75k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (939:2): [True: 4.75k, False: 534k]
  ------------------
  940|  4.75k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  4.75k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  393|  4.75k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  388|  4.75k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (940:7): [True: 84, False: 4.67k]
  ------------------
  941|     84|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  444|     84|#define CAST(T, b)	((T)(b))
  ------------------
  942|  4.67k|		else
  943|  4.67k|			o = CAST(int32_t, (ms->search.offset + m->vallen));
  ------------------
  |  |  444|  4.67k|#define CAST(T, b)	((T)(b))
  ------------------
  944|  4.75k|		break;
  945|       |
  946|    754|	case FILE_CLEAR:
  ------------------
  |  |  287|    754|#define				FILE_CLEAR		47
  ------------------
  |  Branch (946:2): [True: 754, False: 538k]
  ------------------
  947|  6.29k|	case FILE_DEFAULT:
  ------------------
  |  |  243|  6.29k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (947:2): [True: 5.53k, False: 533k]
  ------------------
  948|  16.4k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  16.4k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (948:2): [True: 10.2k, False: 529k]
  ------------------
  949|  16.5k|	case FILE_OFFSET:
  ------------------
  |  |  290|  16.5k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (949:2): [True: 72, False: 539k]
  ------------------
  950|  43.2k|	case FILE_USE:
  ------------------
  |  |  286|  43.2k|#define				FILE_USE		46
  ------------------
  |  Branch (950:2): [True: 26.6k, False: 512k]
  ------------------
  951|  43.2k|		o = ms->offset;
  952|  43.2k|		break;
  953|       |
  954|  23.1k|	case FILE_DER:
  ------------------
  |  |  288|  23.1k|#define				FILE_DER		48
  ------------------
  |  Branch (954:2): [True: 23.1k, False: 516k]
  ------------------
  955|  23.1k|		o = der_offs(ms, m, nbytes);
  956|  23.1k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  444|  23.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (956:7): [True: 0, False: 23.1k]
  |  Branch (956:18): [True: 0, False: 23.1k]
  ------------------
  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|  23.1k|		break;
  966|       |
  967|  23.1k|	case FILE_GUID:
  ------------------
  |  |  289|    410|#define				FILE_GUID		49
  ------------------
  |  Branch (967:2): [True: 410, False: 538k]
  ------------------
  968|    410|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  444|    410|#define CAST(T, b)	((T)(b))
  ------------------
  969|    410|		break;
  970|       |
  971|  45.5k|	default:
  ------------------
  |  Branch (971:2): [True: 45.5k, False: 493k]
  ------------------
  972|  45.5k|		o = 0;
  973|  45.5k|		break;
  974|   539k|	}
  975|       |
  976|   539k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  444|   539k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (976:6): [True: 23.1k, False: 516k]
  ------------------
  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|  23.1k|		return -1;
  982|  23.1k|	}
  983|   516k|	*op = o;
  984|   516k|	return 1;
  985|   539k|}

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

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

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

