// File: /workspace/github_c_makefile_star2_O0/anuwu[P]ERPLAG-Compiler/lexer.c
// Function: nextChar
char nextChar (twinBuffer *twinBuf)
{
	char ch ;
	ch = *twinBuf->forward ;
 
	if (ch == EOF)
		return EOF ;
 
	if (ch == '\n')
		twinBuf->lineNumber++ ;
 
	twinBuf->forward++ ;
 
	if (twinBuf->where_forward == TWIN_ONE && *twinBuf->forward == EOF)
	{
		// If the forward pointer is in the first buffer and the fwd pointer is on EOF
 
		if (twinBuf->forward - twinBuf->buf1 == bufSize)
		{
			/* If the expected fwd pointer is EOF and end of buffer, then it's most like true that
			   there is more data. Bgn pointer is expected to be near the end of the first buffer 
			   and fwd pointer is set to start of buf2.
 
			   Even if there actually isn't any data, buf2[0] = ACTUAL EOF and this is what the 
			   fwd poiner is set to. Bgn pointer is again expected to be near the end of the first buffer.
			*/
 
			twinBuf->forward = twinBuf->buf2 ;
			twinBuf->where_forward = TWIN_TWO ;
		}
		/* If the above condition fails, the fwd pointer is on the ACTUAL EOF. 
		   Bgn pointer is expected to be just before the EOF
		   Any subsequent call to nextChar() will actually fill ch with EOF.
		*/
	}
	else if (twinBuf->where_forward == TWIN_TWO && *twinBuf->forward == EOF)
	{
		// If the fwd pointer is on the second buffer and fwd pointer is on EOF
		int buf2_read ;
 
		if (twinBuf->where_begin == TWIN_TWO && twinBuf->forward - twinBuf->buf2 == bufSize)
		{
			/* If the expected fwd pointer is EOF and at end of second buffer, then it's most likely
			   true that there is more data. Bgn pointer is expected to be near the end of the second 
			   buffer. Buf2 is shifted buf1. Bgn pointer is at the same relative location. Fwd pointer
			   is set to start of buf2.
				
			   Even if there isn't actually any data, buf2[0] = ACTUAL EOF and this is what the fwd pointer
			   is set to. Bgn pointer is again expected to be near the end of the first buffer.
			*/
 
			char *xchg_buf ;
			xchg_buf = twinBuf->buf1 ;
			twinBuf->buf1 = twinBuf->buf2 ;
			twinBuf->buf2 = xchg_buf ;
 
			buf2_read = fread (twinBuf->buf2, sizeof(char) , bufSize, twinBuf->fp) ;
			twinBuf->buf2[buf2_read] = EOF ;
			twinBuf->forward = twinBuf->buf2 ;
 
			twinBuf->where_begin = TWIN_ONE ;
		}
		/* If the above condition fails, the fwd pointer is on the ACTUAL EOF.
		   Bgn pointer is expected to be just before the EOF on the second buffer.
		   Any subsequent call to nextChar() will actually fill ch with EOF.
		*/
 
	}
	return ch ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movb (%rax), %al
movb %al, -0x11(%rbp)
movsbl -0x11(%rbp), %eax
cmpl $-0x1, %eax
jne 0xa52b
movb $-0x1, -0x1(%rbp)
jmp 0xa66f
movsbl -0x11(%rbp), %eax
cmpl $0xa, %eax
jne 0xa541
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jne 0xa5a6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbl (%rax), %eax
cmpl $-0x1, %eax
jne 0xa5a6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
cmpq $0x80, %rax
jne 0xa5a1
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x2c(%rax)
jmp 0xa669
movq -0x10(%rbp), %rax
cmpl $0x1, 0x2c(%rax)
jne 0xa667
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbl (%rax), %eax
cmpl $-0x1, %eax
jne 0xa667
movq -0x10(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0xa665
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
cmpq $0x80, %rax
jne 0xa665
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x1, %esi
movl $0x80, %edx
callq 0x1060
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movb $-0x1, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x28(%rax)
jmp 0xa667
jmp 0xa669
movb -0x11(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)