// File: /workspace/github_c_makefile_star2_O1/nimble-code[P]Modex/Src/modex_pp.c
// Function: strip_sys_includes
void
strip_sys_includes(char *z, char *f, char *m)
{	FILE	*fd, *fo;
	char	buf[1024];
	char	*p;
	char	*match_what = NULL;
	char	*curfile    = NULL;
	int	first_directive = 1;

	*z = 'I';

	if ((fo = fopen(f, MFLAGS)) == NULL)	/* .I intermediate */
	{	fprintf(stderr, "modex: cannot create %s\n", f);
		goto clean;
	}
if (debug_io) fprintf(stderr, "fopen %s -> %p\n", f, fo);
	fprintf(fo, "#define pthread_t	int\n");
	fprintf(fo, "#define thread_t	int\n");
	fprintf(fo, "#define pthread_mutex_t	int\n");
	fprintf(fo, "#define pthread_cond_t	int\n");
	fprintf(fo, "#define mutex_t	int\n");
	fprintf(fo, "#define key_t	int\n");

	if ((fd = fopen(m, "r")) != NULL)	/* .dfn file -- if any */
	{	fprintf(fo, "#define UnoType	typedef int\n");
if (debug_io) fprintf(stderr, "fopen %s -> %p\n", m, fd);
		while (fgets(buf, 1024, fd))
			fprintf(fo, "%s", buf);
if (debug_io) fprintf(stderr, "close xx %p\n", fd);
		Fclose(fd);
	}
	fprintf(fo, "typedef int __builtin_va_list;\n"); /* gcc-ism */
	fprintf(fo, "typedef int __w64;\n");		 /* cl-ism */
	fprintf(fo, "typedef int _Bool;\n");		 /* c99 */
	fprintf(fo, "#define __restrict\n");		 /* gcc-ism */

	if (master_dfn)
	if ((fd = fopen(master_dfn, "r")) != NULL)	/* possible master .dfn file */
	{
if (debug_io) fprintf(stderr, "fopen %s -> %p\n", master_dfn, fd);
		while (fgets(buf, 1024, fd))
			fprintf(fo, "%s", buf);
if (debug_io) fprintf(stderr, "close yy %p\n", fd);
		Fclose(fd);
	}

	*z = 'c';
	if ((fd = fopen(f, "r")) == NULL)	/* .c file */
	{	fprintf(stderr, "%s: cannot open %s\n", progname, f);
		*z = 'I';	/* remove .I intermediate */
		unlink(f);
clean:		unlink("_modex_.run");
		exit(1);
	}
if (debug_io) fprintf(stderr, "--fopen %s -> %p\n", f, fd);

	fprintf(fo, "#line 1 \"%s\"\n", f);	/* restore linenumber and filename */

	while (fgets(buf, 1024, fd))
	{	if (buf[0] == '#')
		{	char *op;
			p = &buf[1];
			while (*p == ' ' || *p == '\t')
			{	p++;
			}
			op = p;

			/* eliminat output from external preprocessing
			   of system include files -- pan.c
			   will include the necessary files separately
			 */
			if (isdigit((int) *p)
			||  strncmp(p, "line", strlen("line")) == 0)	/* it is preprocessor output */
			{	char *q;
				q = p = strchr(p, '"');
				if (p)
				{	p++; q++;
					q = strchr(q, '"');
					if (q)
					{	*q = '\0';
						if (first_directive)
						{	match_what = (char *) e_malloc(strlen(p)+1);
							/* remember original filename: */
							strcpy(match_what, p);
							first_directive = 0;
						}
						curfile = (char *) e_malloc(strlen(p)+1);
						strcpy(curfile, p);
						continue;
				}	}
				p = op;
			}

			if (strncmp(p, "include", strlen("include")) == 0)
			{	p += strlen("include");
				while (*p == ' ' || *p == '\t')
					p++;
				if (sysoverride == 0
				&&  *p == '<')			/* system header file */
				{	fprintf(fo, "\n");	/* maintain linecount */
					continue;		/* skip it */
		}	}	}

		if (match_what
		&&  curfile
		&&  strcmp(match_what, curfile) != 0)
		{	continue;		/* preprocessed headers */
		}

		avoid_name_clash(buf, "empty");	/* empty -> Empty */
		avoid_name_clash(buf, "full");	/* full  -> Full */
		avoid_name_clash(buf, "init");	/* init  -> Init */
		avoid_name_clash(buf, "len");	/* len   -> Len */
		avoid_name_clash(buf, "skip");	/* skip  -> Skip */

		fprintf(fo, "%s", buf);
	}

if (debug_io) fprintf(stderr, "close 2x %p %p\n", fd, fo);

	Fclose(fd);
	Fclose(fo);
	fo = NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movb $0x49, (%rdi)
leaq 0x932b(%rip), %rsi      # 0x2a8df
movq %r15, %rdi
callq 0x4260
testq %rax, %rax
je 0x21a58
movq %rax, %rbx
leaq 0x18439(%rip), %rbp     # 0x39a08
cmpl $0x0, (%rbp)
jne 0x21a75
leaq 0xd373(%rip), %rdi      # 0x2e953
movl $0x16, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd371(%rip), %rdi      # 0x2e96a
movl $0x15, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd36e(%rip), %rdi      # 0x2e980
movl $0x1c, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd372(%rip), %rdi      # 0x2e99d
movl $0x1b, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd375(%rip), %rdi      # 0x2e9b9
movl $0x14, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd371(%rip), %rdi      # 0x2e9ce
movl $0x12, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0x4725(%rip), %rsi      # 0x25d9b
movq %r14, %rdi
callq 0x4260
testq %rax, %rax
je 0x216f7
movq %rax, %r13
leaq 0xd354(%rip), %rdi      # 0x2e9e1
movl $0x1c, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
cmpl $0x0, (%rbp)
jne 0x21aff
leaq 0x20(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r13, %rdx
callq 0x41a0
testq %rax, %rax
je 0x216e5
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4170
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r13, %rdx
callq 0x41a0
testq %rax, %rax
jne 0x216c5
cmpl $0x0, (%rbp)
jne 0x21b22
movq %r13, %rdi
callq 0x793c
leaq 0xd30d(%rip), %rdi      # 0x2ea0b
movl $0x1f, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd314(%rip), %rdi      # 0x2ea2b
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd30f(%rip), %rdi      # 0x2ea3f
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0xd30a(%rip), %rdi      # 0x2ea53
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x42b0
leaq 0x182de(%rip), %rax     # 0x39a40
movq (%rax), %rdi
testq %rdi, %rdi
je 0x217d6
leaq 0x462a(%rip), %rsi      # 0x25d9b
callq 0x4260
testq %rax, %rax
je 0x217d6
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x21b42
leaq 0x20(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x41a0
testq %rax, %rax
je 0x217c4
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4170
movq %r13, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x41a0
testq %rax, %rax
jne 0x217a4
cmpl $0x0, (%rbp)
jne 0x21b4f
movq %r14, %rdi
callq 0x793c
movb $0x63, (%r12)
leaq 0x45b9(%rip), %rsi      # 0x25d9b
movq %r15, %rdi
callq 0x4260
testq %rax, %rax
je 0x21a98
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x21ab9
leaq 0xd293(%rip), %rsi      # 0x2ea9a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x41c0
leaq 0x20(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x41a0
testq %rax, %rax
je 0x21a26
movl $0x1, 0xc(%rsp)
xorl %r13d, %r13d
leaq 0x20(%rsp), %rbp
xorl %r12d, %r12d
movq %rbx, 0x10(%rsp)
movq %r14, 0x18(%rsp)
cmpb $0x23, 0x20(%rsp)
jne 0x2199e
leaq 0x21(%rsp), %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x2186a
cmpl $0x9, %eax
jne 0x2186f
incq %r15
jmp 0x2185c
movsbq %al, %rbx
callq 0x42d0
movq (%rax), %rax
testb $0x8, 0x1(%rax,%rbx,2)
jne 0x2189e
movl $0x4, %edx
movq %r15, %rdi
leaq 0x2a2b(%rip), %rsi      # 0x242bc
callq 0x40a0
testl %eax, %eax
jne 0x21940
movq %r13, %rbp
movq %r15, %rdi
movl $0x22, %esi
callq 0x4130
xorl %ebx, %ebx
movb $0x1, %r13b
testq %rax, %rax
je 0x21928
movq %rax, %r14
incq %r14
movq %r14, %rdi
movl $0x22, %esi
callq 0x4130
testq %rax, %rax
je 0x21928
movb $0x0, (%rax)
cmpl $0x0, 0xc(%rsp)
je 0x218f8
movq %r14, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
movq %r14, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, %rbp
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
movl $0x7, %ebx
movl $0x0, 0xc(%rsp)
xorl %r13d, %r13d
jmp 0x2192b
movq %r15, %r14
movq %r14, %r15
testb %r13b, %r13b
movq 0x18(%rsp), %r14
movq %rbp, %r13
leaq 0x20(%rsp), %rbp
je 0x21995
movl $0x7, %edx
movq %r15, %rdi
leaq 0xd159(%rip), %rsi      # 0x2eaa8
callq 0x40a0
xorl %ebx, %ebx
testl %eax, %eax
jne 0x21995
addq $0x7, %r15
jmp 0x21963
incq %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x21960
cmpl $0x9, %eax
je 0x21960
cmpb $0x3c, %al
jne 0x21995
leaq 0x180b4(%rip), %rax     # 0x39a30
cmpl $0x0, (%rax)
jne 0x21995
movl $0xa, %edi
movq 0x10(%rsp), %rsi
callq 0x4190
movl $0x7, %ebx
testl %ebx, %ebx
movq 0x10(%rsp), %rbx
jne 0x21a0d
testq %r12, %r12
je 0x219b7
testq %r13, %r13
je 0x219b7
movq %r12, %rdi
movq %r13, %rsi
callq 0x41b0
testl %eax, %eax
jne 0x21a0d
movq %rbp, %rdi
leaq 0xd0ef(%rip), %rsi      # 0x2eab0
callq 0x21b6f
movq %rbp, %rdi
leaq 0xd0e6(%rip), %rsi      # 0x2eab6
callq 0x21b6f
movq %rbp, %rdi
leaq 0x517d(%rip), %rsi      # 0x26b5c
callq 0x21b6f
movq %rbp, %rdi
leaq 0xd0cd(%rip), %rsi      # 0x2eabb
callq 0x21b6f
movq %rbp, %rdi
leaq 0xd0c2(%rip), %rsi      # 0x2eabf
callq 0x21b6f
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4170
movq %rbp, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x41a0
testq %rax, %rax
jne 0x2184c
leaq 0x17fdb(%rip), %rax     # 0x39a08
cmpl $0x0, (%rax)
jne 0x21adc
movq %r14, %rdi
callq 0x793c
movq %rbx, %rdi
callq 0x793c
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x15599(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xced1(%rip), %rsi      # 0x2e93a
movq %r15, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0x21aa3
movq 0x1557c(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xd004(%rip), %rsi      # 0x2ea8a
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0x215d9
movq %r15, %rdi
movq %r12, %rsi
callq 0x5e80
leaq 0x310a(%rip), %rdi      # 0x24bb4
callq 0x4080
movl $0x1, %edi
callq 0x42a0
movq 0x15538(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xcfbe(%rip), %rsi      # 0x2ea88
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0x21800
movq 0x15515(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xcfd7(%rip), %rsi      # 0x2eac4
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0x21a36
movq 0x154f2(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xcf7a(%rip), %rsi      # 0x2ea8a
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0x216a9
movq 0x154cf(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xcecb(%rip), %rsi      # 0x2e9fe
movq %r13, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0x216ef
movq %r14, %rdi
callq 0x5e55
jmp 0x21788
movq 0x154a2(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0xcf07(%rip), %rsi      # 0x2ea67
movq %r14, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0x217ce