// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/Lexer.cpp
// Function: lexString(std::shared_ptr<SourceFile>, std::vector<std::shared_ptr<TokenData>, std::allocator<std::shared_ptr<TokenData>>>&)
void lexString(shared_ptr<SourceFile> file, vector<Token>& tokens)
{
	string tokenTxt;
	int line=1;
	int charPos=1;
	
	TokenData::Type type=TokenData::WHITESPACE;
	
	for (int i=0; i<file->size(); i++)
	{
		CharClassifier::Type charType=charClassifier.get(file, i);
		TokenData::Type newType=CharClassifier::getTokenType(charType, type);
		
		if (newType!=type)
		{
			if (!tokenTxt.empty())
			{
				if (type==TokenData::OPERATOR)
				{
					vector<Operator> opMatches;
					ops->get(tokenTxt, opMatches);
					
					for (auto op: opMatches)
					{
						tokens.push_back(makeToken(op->getText(), file, line, charPos-tokenTxt.size(), type, op));
					}
				}
				else if (type==TokenData::LINE_COMMENT || type==TokenData::BLOCK_COMMENT)
				{
					// do nothing
				}
				else
				{
					Token token=makeToken(tokenTxt, file, line, charPos-tokenTxt.size(), type);
					
					if (type==TokenData::UNKNOWN)
					{
						PhplusError("invalid token '"+tokenTxt+"'", SOURCE_ERROR, token).log();
					}
					else
					{
						tokens.push_back(token);
					}
				}
			}
			tokenTxt="";
		}
		
		if (newType!=TokenData::WHITESPACE && newType!=TokenData::LINE_END)
		{
			if (newType==TokenData::STRING_LITERAL && (*file)[i]=='\\')
			{
				i++;
				if ((*file)[i]=='n')
					tokenTxt+='\n';
				else if ((*file)[i]=='"')
					tokenTxt+='"';
				else if ((*file)[i]=='t')
					tokenTxt+='\t';
				else if ((*file)[i]=='\\')
					tokenTxt+='\\';
				else
					throw PhplusError(string()+"invalid escape character '\\"+(*file)[i]+"'", SOURCE_ERROR, makeToken(tokenTxt+(*file)[i], file, line, charPos-tokenTxt.size(), type));
			}
			else
			{
				tokenTxt+=(*file)[i];
			}
		}
		
		type=newType;
		
		if ((*file)[i]=='\n')
		{
			line++;
			charPos=1;
		}
		else
		{
			charPos++;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rsi, 0x58(%rsp)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x158(%rsp), %r14
movq %rdi, 0x18(%rsp)
movq (%rdi), %rax
pushq $0x1
popq %rcx
xorl %r13d, %r13d
leaq 0x1c8(%rsp), %rbx
xorl %r12d, %r12d
movl %ecx, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
cmpl 0x28(%rax), %r13d
jge 0x1a5cd
movl %r12d, 0x24(%rsp)
leaq 0x150(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
callq 0x19fe6
leaq 0x600eb(%rip), %rdi     # 0x7a300
movq %r15, %rsi
movq %r13, 0x28(%rsp)
movl %r13d, %edx
callq 0x1a8ca
movl %eax, %r15d
movq %r14, %rdi
callq 0xc984
movl %r15d, %edi
movl 0x24(%rsp), %ebp
movl %ebp, %esi
callq 0x1a98a
leaq 0x1e8(%rsp), %r12
cmpl %ebp, %eax
je 0x1a516
movl %eax, 0x34(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x1a501
cmpl $0x5, %ebp
jne 0x1a3a7
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
andq $0x0, 0xd0(%rsp)
leaq 0x6006e(%rip), %rax     # 0x7a2f0
movq (%rax), %r15
leaq 0x228(%rsp), %r14
movq %r14, %rdi
leaq 0x38(%rsp), %rsi
callq 0xa3b0
movq %r15, %rdi
movq %r14, %rsi
leaq 0xc0(%rsp), %rdx
callq 0xc6a6
movq %r14, %rdi
callq 0xa558
movq 0xc0(%rsp), %r15
movq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rsp)
cmpq 0xb8(%rsp), %r15
je 0x1a4c9
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xc950
movq 0x80(%rsp), %rsi
leaq 0x208(%rsp), %rbx
movq %rbx, %rdi
callq 0xa3b0
leaq 0x140(%rsp), %r13
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0x19fe6
movl 0x10(%rsp), %ebp
subl 0x40(%rsp), %ebp
leaq 0x130(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0xc950
movq %r14, (%rsp)
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl 0x14(%rsp), %ecx
movl %ebp, %r8d
pushq $0x5
popq %r9
callq 0x3ce00
movq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x1b002
leaq 0x68(%rsp), %rdi
callq 0xc984
leaq 0x138(%rsp), %rdi
callq 0xc984
leaq 0x148(%rsp), %rdi
callq 0xc984
movq %rbx, %rdi
callq 0xa558
leaq 0x88(%rsp), %rdi
callq 0xc984
addq $0x10, %r15
jmp 0x1a2cd
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x6, %eax
je 0x1a501
movq %rbx, %rdi
leaq 0x38(%rsp), %rsi
callq 0xa3b0
leaq 0x120(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
callq 0x19fe6
movl 0x10(%rsp), %r8d
subl 0x40(%rsp), %r8d
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, (%rsp)
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl 0x14(%rsp), %ecx
movl %ebp, %r9d
callq 0x3ce00
leaq 0xa8(%rsp), %rdi
callq 0xc984
leaq 0x128(%rsp), %rdi
callq 0xc984
movq %rbx, %rdi
callq 0xa558
cmpl $0xb, %ebp
jne 0x1a4e8
leaq 0x80(%rsp), %r15
movq %r15, %rdi
leaq 0x3a109(%rip), %rsi     # 0x54555
leaq 0x38(%rsp), %rdx
callq 0xc8a1
movq %r12, %rdi
movq %r15, %rsi
leaq 0x3edef(%rip), %rdx     # 0x59252
callq 0xc882
leaq 0x110(%rsp), %r13
movq %r13, %rdi
leaq 0x60(%rsp), %rsi
callq 0x12e2e
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0x19f06
movq %r15, %rdi
callq 0x19f60
movq %r15, %rdi
callq 0x11692
leaq 0x118(%rsp), %rdi
callq 0xc984
movq %r12, %rdi
callq 0xa558
leaq 0x80(%rsp), %rdi
callq 0xa558
jmp 0x1a4f7
leaq 0xc0(%rsp), %rdi
callq 0x1aa7c
leaq 0x158(%rsp), %r14
leaq 0x1c8(%rsp), %rbx
jmp 0x1a501
movq 0x58(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1aa9e
leaq 0x68(%rsp), %rdi
callq 0xc984
leaq 0x38(%rsp), %rdi
leaq 0x3a512(%rip), %rsi     # 0x54a1f
callq 0xa530
movl 0x34(%rsp), %eax
cmpl $0x2, %eax
movl %eax, %ebp
jb 0x1a590
movq 0x18(%rsp), %rax
movq (%rax), %rax
movslq 0x28(%rsp), %r15
cmpl $0x4, %ebp
jne 0x1a561
movq 0x20(%rax), %rcx
movb (%rcx,%r15), %al
cmpb $0x5c, %al
jne 0x1a569
movzbl 0x1(%rcx,%r15), %eax
incq %r15
cmpl $0x74, %eax
je 0x1a578
cmpl $0x5c, %eax
je 0x1a57c
movb $0xa, %cl
cmpl $0x6e, %eax
je 0x1a57e
movl %eax, %ecx
cmpl $0x22, %eax
je 0x1a57e
jmp 0x1a5e9
movq 0x20(%rax), %rax
movb (%rax,%r15), %al
movsbl %al, %esi
leaq 0x38(%rsp), %rdi
callq 0xa270
jmp 0x1a590
movb $0x9, %cl
jmp 0x1a57e
movl %eax, %ecx
movsbl %cl, %esi
leaq 0x38(%rsp), %rdi
callq 0xa270
movq %r15, 0x28(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %r13
movslq %r13d, %r13
movq 0x20(%rax), %rcx
movl 0x10(%rsp), %esi
incl %esi
xorl %edx, %edx
cmpb $0xa, (%rcx,%r13)
pushq $0x1
popq %rcx
cmovel %ecx, %esi
movl %esi, 0x10(%rsp)
sete %dl
addl %edx, 0x14(%rsp)
incl %r13d
movl %ebp, %r12d
jmp 0x1a1ea
leaq 0x38(%rsp), %rdi
callq 0xa558
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x38
popq %rdi
callq 0xa1b0
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x3abc4(%rip), %rdx     # 0x551d0
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xc882
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movsbl (%rax,%r15), %edx
leaq 0xc0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x1aaca
leaq 0x3ec07(%rip), %rdx     # 0x59252
leaq 0x1a8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xc882
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movsbl (%rax,%r15), %edx
leaq 0x188(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1aaec
leaq 0x178(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
callq 0x19fe6
movl 0x10(%rsp), %r8d
subl 0x40(%rsp), %r8d
xorps %xmm0, %xmm0
leaq 0x160(%rsp), %rax
movaps %xmm0, (%rax)
movq %rax, (%rsp)
leaq 0x100(%rsp), %rdi
leaq 0x188(%rsp), %rsi
movq %r15, %rdx
movl 0x14(%rsp), %ecx
movl 0x24(%rsp), %r9d
callq 0x3ce00
movb $0x1, %bpl
leaq 0x1a8(%rsp), %rsi
leaq 0x100(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x19f06
xorl %ebp, %ebp
leaq 0x5ce9d(%rip), %rsi     # 0x77598
leaq -0x9070(%rip), %rdx     # 0x11692
movq %r14, %rdi
callq 0xa4e0
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0xc984
jmp 0x1a722
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x168(%rsp), %rdi
callq 0xc984
leaq 0x180(%rsp), %rdi
callq 0xc984
leaq 0x188(%rsp), %rdi
callq 0xa558
jmp 0x1a751
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x1a8(%rsp), %rdi
callq 0xa558
jmp 0x1a766
movq %rax, %rbx
movb $0x1, %bpl
leaq 0xc0(%rsp), %rdi
callq 0xa558
jmp 0x1a77b
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x80(%rsp), %rdi
callq 0xa558
jmp 0x1a790
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x60(%rsp), %rdi
callq 0xa558
testb %bpl, %bpl
je 0x1a8b1
movq %r14, %rdi
callq 0xa230
jmp 0x1a8b1
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x11692
jmp 0x1a7d1
jmp 0x1a7c4
movq %rax, %rbx
jmp 0x1a7f8
movq %rax, %rbx
jmp 0x1a7eb
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0xc984
leaq 0x1e8(%rsp), %rdi
callq 0xa558
leaq 0x80(%rsp), %rdi
callq 0xa558
leaq 0x68(%rsp), %rdi
jmp 0x1a84d
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xc984
leaq 0x128(%rsp), %rdi
callq 0xc984
leaq 0x1c8(%rsp), %rdi
callq 0xa558
jmp 0x1a8b1
jmp 0x1a854
movq %rax, %rbx
jmp 0x1a8a4
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
callq 0xa558
jmp 0x1a8a4
movq %rax, %rbx
movq %r14, %rdi
callq 0xc984
jmp 0x1a8b1
movq %rax, %rbx
jmp 0x1a8b1
movq %rax, %rbx
jmp 0x1a86b
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xc984
leaq 0x138(%rsp), %rdi
callq 0xc984
leaq 0x148(%rsp), %rdi
callq 0xc984
leaq 0x208(%rsp), %rdi
callq 0xa558
jmp 0x1a897
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xc984
leaq 0xc0(%rsp), %rdi
callq 0x1aa7c
leaq 0x38(%rsp), %rdi
callq 0xa558
movq %rbx, %rdi
callq 0xa500
nop