// File: /workspace/github_c_makefile_star2_O0/Yamsman[P]scc/src/lex.c
// Function: lex_prcc
char lex_prcc(lexer *lx, char **cpos, char *cch, s_pos *cloc) {
	char *pos;
	char nchar;
	s_pos loc;
	if (cpos == NULL || cch == NULL || cloc == NULL) return '\0';

	/*
	 * Move to the next character
	 * If the current column is 0, the lexer is at the beginning of a file context
	 */
	int is_reset = (cloc->col == 0);
	pos = (is_reset) ? *cpos : *(cpos)+1;
	nchar = *pos;
	loc = *cloc;

	//Update location
	if (*cch == '\n') {
		loc.col = (is_reset) ? 1 : 0;
		loc.line++;
	}
	loc.col++;

	/*
	 * Perform trigraph conversion/newline splicing if needed
	 */
	for (;;) {
		//Process trigraphs
		if (*pos == '?' && *(pos+1) == '?') {
			int conv = 1;
			switch (*(pos+2)) {
				case '=': nchar = '#';  break;
				case '(': nchar = '[';  break;
				case '/': nchar = '\\'; break;
				case ')': nchar = ']';  break;
				case '\'': nchar = '^'; break;
				case '<': nchar = '{';  break;
				case '!': nchar = '|';  break;
				case '>': nchar = '}';  break;
				case '-': nchar = '~';  break;
				default: conv = 0; break;
			}

			//A conversion only takes place if the trigram was valid
			if (conv) {
				pos += 2;
				loc.col += 2;
			}
		}

		//Process newline splicing
		if (nchar == '\\' && *(pos+1) == '\n') {
			pos += 2;
			nchar = *pos;
			loc.col = 1;
			loc.line++;
		} else {
			//Stop looping if a line was not spliced
			break;
		}
	}

	*cpos = pos;
	*cch = nchar;
	*cloc = loc;
	return nchar;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x71c9
cmpq $0x0, -0x20(%rbp)
je 0x71c9
cmpq $0x0, -0x28(%rbp)
jne 0x71d2
movb $0x0, -0x1(%rbp)
jmp 0x7389
movq -0x28(%rbp), %rax
cmpl $0x0, 0x4(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x71f8
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x7207
movq -0x18(%rbp), %rax
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb (%rax), %al
movb %al, -0x31(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x725b
movl -0x54(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3f, %eax
jne 0x7310
movq -0x30(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3f, %eax
jne 0x7310
movl $0x1, -0x58(%rbp)
movq -0x30(%rbp), %rax
movsbl 0x2(%rax), %eax
addl $-0x21, %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0x1d, %eax
ja 0x72ec
movq -0x68(%rbp), %rax
leaq 0xa5af(%rip), %rcx      # 0x1185c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x23, -0x31(%rbp)
jmp 0x72f3
movb $0x5b, -0x31(%rbp)
jmp 0x72f3
movb $0x5c, -0x31(%rbp)
jmp 0x72f3
movb $0x5d, -0x31(%rbp)
jmp 0x72f3
movb $0x5e, -0x31(%rbp)
jmp 0x72f3
movb $0x7b, -0x31(%rbp)
jmp 0x72f3
movb $0x7c, -0x31(%rbp)
jmp 0x72f3
movb $0x7d, -0x31(%rbp)
jmp 0x72f3
movb $0x7e, -0x31(%rbp)
jmp 0x72f3
movl $0x0, -0x58(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x730e
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x4c(%rbp)
jmp 0x7310
movsbl -0x31(%rbp), %eax
cmpl $0x5c, %eax
jne 0x734d
movq -0x30(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0xa, %eax
jne 0x734d
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb (%rax), %al
movb %al, -0x31(%rbp)
movl $0x1, -0x4c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x734f
jmp 0x7354
jmp 0x7264
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movb -0x31(%rbp), %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rcx
movq %rcx, 0x10(%rax)
movb -0x31(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
popq %rbp
retq
nop