// File: /workspace/github_c_makefile_star2_O0/Yamsman[P]scc/src/ppd.c
// Function: ppd_include
void ppd_include(lexer *lx) {
	char cur = lex_cur(lx);
	s_pos *loc = &lx->tgt->loc;
	while (cur == ' ') cur = lex_advc(lx);

	//Get include type
	char type = cur;
	if (type != '<' && type != '"')
		c_error(loc, "#include expects <fname> or \"fname\"\n");
	cur = lex_advc(lx);

	//Get filename
	int fnlen = 0;
	int bsize = 256;
	char *fname = malloc(bsize);
	char endc = (type == '"') ? '"' : '>';
	while (cur != endc) {
		if (cur == '\n') {
			c_error(loc, "Expected '%c' before end of line\n", endc);
			return;
		} else if (cur == '\0') {
			c_error(loc, "Expected '%c' before end of file\n", endc);
			return;
		}
		fname[fnlen++] = cur;
		cur = lex_advc(lx);
	}
	fname[fnlen] = '\0';
	lex_advc(lx);

	//Attempt to locate and open the included file
	FILE *input_f = NULL;
	char *fdir = malloc(fnlen + sizeof("/usr/include/") + 1);
	fdir[0] = '\0';
	if (type == '"') {
		char *slash = strrchr(fname, '/');
		if (!slash) {
			strcpy(fdir, "./");
			strcat(fdir, fname);
		} else {
			memcpy(fdir, fname, slash - fname);
			fdir[slash-fname] = '\0';
			strcat(fdir, slash);
		}
		if (lex_open_file(lx, fdir)) goto done;
	}
	fdir[0] = '\0';

	//Attempt system include directory
	strcpy(fdir, "/usr/include/");
	strcat(fdir, fname);
	if (!lex_open_file(lx, fdir)) {
		c_error(loc, "Unable to open file '%s': ", fname);
		fflush(stdout);
		perror(NULL);
		free(fdir);
	}
done:	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x81b0
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
addq $0x28, %rax
movq %rax, -0x18(%rbp)
movsbl -0x9(%rbp), %eax
cmpl $0x20, %eax
jne 0xebae
movq -0x8(%rbp), %rdi
callq 0x81f0
movb %al, -0x9(%rbp)
jmp 0xeb97
movb -0x9(%rbp), %al
movb %al, -0x19(%rbp)
movsbl -0x19(%rbp), %eax
cmpl $0x3c, %eax
je 0xebd8
movsbl -0x19(%rbp), %eax
cmpl $0x22, %eax
je 0xebd8
movq -0x18(%rbp), %rdi
leaq 0x47dc(%rip), %rsi      # 0x133ad
movb $0x0, %al
callq 0x3880
movq -0x8(%rbp), %rdi
callq 0x81f0
movb %al, -0x9(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x100, -0x24(%rbp)     # imm = 0x100
movslq -0x24(%rbp), %rdi
callq 0x3190
movq %rax, -0x30(%rbp)
movsbl -0x19(%rbp), %edx
movl $0x3e, %eax
movl $0x22, %ecx
cmpl $0x22, %edx
cmovel %ecx, %eax
movb %al, -0x31(%rbp)
movsbl -0x9(%rbp), %eax
movsbl -0x31(%rbp), %ecx
cmpl %ecx, %eax
je 0xec92
movsbl -0x9(%rbp), %eax
cmpl $0xa, %eax
jne 0xec46
movq -0x18(%rbp), %rdi
movsbl -0x31(%rbp), %edx
leaq 0x4798(%rip), %rsi      # 0x133d2
movb $0x0, %al
callq 0x3880
jmp 0xedcf
movsbl -0x9(%rbp), %eax
cmpl $0x0, %eax
jne 0xec6a
movq -0x18(%rbp), %rdi
movsbl -0x31(%rbp), %edx
leaq 0x4796(%rip), %rsi      # 0x133f4
movb $0x0, %al
callq 0x3880
jmp 0xedcf
jmp 0xec6c
movb -0x9(%rbp), %dl
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rdi
callq 0x81f0
movb %al, -0x9(%rbp)
jmp 0xec16
movq -0x30(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rdi
callq 0x81f0
movq $0x0, -0x40(%rbp)
movslq -0x20(%rbp), %rdi
addq $0xe, %rdi
addq $0x1, %rdi
callq 0x3190
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movsbl -0x19(%rbp), %eax
cmpl $0x22, %eax
jne 0xed5e
movq -0x30(%rbp), %rdi
movl $0x2f, %esi
callq 0x30e0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xed10
movq -0x48(%rbp), %rdi
leaq 0x471a(%rip), %rsi      # 0x13416
callq 0x3060
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x3230
jmp 0xed48
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rax
subq %rax, %rdx
callq 0x3160
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rdx
subq %rdx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x3230
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x6e70
cmpl $0x0, %eax
je 0xed5c
jmp 0xedcd
jmp 0xed5e
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rdi
leaq 0x46a9(%rip), %rsi      # 0x13419
callq 0x3060
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x3230
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x6e70
cmpl $0x0, %eax
jne 0xedcb
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x3139(%rip), %rsi      # 0x11edc
movb $0x0, %al
callq 0x3880
movq 0x820f(%rip), %rax      # 0x16fc0
movq (%rax), %rdi
callq 0x31a0
xorl %eax, %eax
movl %eax, %edi
callq 0x31f0
movq -0x48(%rbp), %rdi
callq 0x3030
jmp 0xedcd
jmp 0xedcf
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)