// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/lexer.c
// Function: extract_lexeme
char* extract_lexeme (twinBuffer *twinBuf)
/*
Given the location of forward and begin pointer, it extracts the characters
into a lexeme 
*/
{
	char *word , *ptr ;
	int i , len ;
 
	if (*twinBuf->forward == EOF)
	{
		if (twinBuf->where_begin == twinBuf->where_forward)
		{
 
			ptr = twinBuf->begin ;
			if (*ptr == EOF)
				return NULL ;
 
			while (*ptr != EOF)
				ptr++ ;
			word = (char *) malloc (sizeof(char) * (ptr - twinBuf->begin + 1)) ;
			ptr = twinBuf->begin ;
			for (i = 0 ; *ptr != EOF ; i++)
			{
				word[i] = *ptr ;
				ptr++ ;
			}
 
			word[i] = '\0' ;
			return word ;
		}
		else
		{
			int j ;
 
			len = (twinBuf->forward - twinBuf->buf2 + 1) + (twinBuf->buf1 + bufSize - twinBuf->begin) ;
			word = (char *) malloc (sizeof(char) * (len + 1)) ;
 
			ptr = twinBuf->begin ;
			if (*ptr == EOF)
				return NULL ;
			for (i = 0 ; *ptr != EOF ; i++)
			{
				word[i] = *ptr ;
				ptr++ ;
			}
 
			ptr = twinBuf->buf2 ;
			for ( ; i < len ; i++)
			{
				word[i] = *ptr ;
				ptr++ ;
			}
 
			word[len] = '\0' ;
		}
	}
	else if ((twinBuf->where_begin == TWIN_ONE && twinBuf->where_forward == TWIN_ONE) || (twinBuf->where_begin == TWIN_TWO && twinBuf->where_forward == TWIN_TWO))
	{
		len = twinBuf->forward - twinBuf->begin + 1 ;
		word = (char *) malloc (sizeof(char) * (len + 1)) ;
 
		ptr = twinBuf->begin ;
		for (i = 0 ; i < len ; i++)
		{
			word[i] = *ptr ;
			ptr++ ;
		}
 
		word[len] = '\0' ;
	}
	else if (twinBuf->where_begin == TWIN_ONE && twinBuf->where_forward == TWIN_TWO)
	{
		int j ;
 
		len = (twinBuf->forward - twinBuf->buf2 + 1) + (twinBuf->buf1 + bufSize - twinBuf->begin) ;
		word = (char *) malloc (sizeof(char) * (len + 1)) ;
 
		ptr = twinBuf->begin ;
		for (i = 0 ; *ptr != EOF ; i++)
		{
			word[i] = *ptr ;
			ptr++ ;
		}
 
		ptr = twinBuf->buf2 ;
		for ( ; i < len ; i++)
		{
			word[i] = *ptr ;
			ptr++ ;
		}
 
		word[len] = '\0' ;
	}
 
	return word ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x20(%rdi), %r12
cmpb $-0x1, (%r12)
movl 0x28(%rdi), %eax
je 0x8631
cmpl $0x1, %eax
je 0x867b
testl %eax, %eax
jne 0x878d
movl 0x2c(%rdi), %eax
testl %eax, %eax
je 0x8685
cmpl $0x1, %eax
jne 0x878d
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %r14
movq 0x18(%rdi), %r13
subq %r13, %rax
subq %r14, %r12
addq %rax, %r12
addq $0x81, %r12
movq %r12, %r15
shlq $0x20, %r15
movabsq $0x100000000, %rdi      # imm = 0x100000000
addq %r15, %rdi
sarq $0x20, %rdi
callq 0x1120
movq %rax, %rbx
movb (%r13), %al
xorl %edx, %edx
cmpb $-0x1, %al
je 0x8766
movb %al, (%rbx,%rdx)
movb 0x1(%r13,%rdx), %al
incq %rdx
jmp 0x861c
cmpl 0x2c(%rdi), %eax
jne 0x86c6
movq 0x18(%rdi), %r14
movb (%r14), %r15b
cmpb $-0x1, %r15b
je 0x8762
movl $0x1, %edi
cmpb $-0x1, (%r14,%rdi)
leaq 0x1(%rdi), %rdi
jne 0x8650
callq 0x1120
movq %rax, %rbx
xorl %eax, %eax
movb %r15b, (%rbx,%rax)
movb 0x1(%r14,%rax), %r15b
incq %rax
cmpb $-0x1, %r15b
jne 0x8665
movl %eax, %ecx
jmp 0x86bb
cmpl $0x1, 0x2c(%rdi)
jne 0x878d
movq 0x18(%rdi), %r14
subl %r14d, %r12d
leal 0x1(%r12), %r15d
leal 0x2(%r12), %eax
movslq %eax, %rdi
callq 0x1120
movq %rax, %rbx
cmpl $0x7ffffffe, %r12d      # imm = 0x7FFFFFFE
ja 0x86b8
movl %r15d, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1110
movslq %r15d, %rcx
movq %rbx, %rax
addq %rcx, %rax
jmp 0x878a
movabsq $0x100000000, %r14      # imm = 0x100000000
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
movq 0x18(%rdi), %r15
movq %rax, -0x30(%rbp)
subq %r15, %rax
movq %r12, %rcx
movq %rdx, -0x38(%rbp)
subq %rdx, %rcx
leaq (%rax,%rcx), %r13
addq $0x81, %r13
movq %r13, -0x40(%rbp)
shlq $0x20, %r13
leaq (%r14,%r13), %rdi
sarq $0x20, %rdi
callq 0x1120
movb (%r15), %cl
cmpb $-0x1, %cl
je 0x8762
movq %rax, %rbx
xorl %eax, %eax
movb %cl, (%rbx,%rax)
movb 0x1(%r15,%rax), %cl
incq %rax
cmpb $-0x1, %cl
jne 0x871a
cmpl -0x40(%rbp), %eax
jge 0x8756
leaq (%rbx,%rax), %rdi
addl -0x30(%rbp), %r12d
addl %r12d, %r14d
movq -0x38(%rbp), %rsi
subl %esi, %r14d
subl %r15d, %r14d
subl %eax, %r14d
subl $-0x80, %r14d
incq %r14
movq %r14, %rdx
callq 0x1110
sarq $0x20, %r13
movq %rbx, %rax
addq %r13, %rax
jmp 0x878a
xorl %ebx, %ebx
jmp 0x878d
cmpl %r12d, %edx
jge 0x8780
movl %edx, %edi
addq %rbx, %rdi
notl %edx
addl %r12d, %edx
incq %rdx
movq %r14, %rsi
callq 0x1110
sarq $0x20, %r15
movq %rbx, %rax
addq %r15, %rax
movb $0x0, (%rax)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop