// File: /workspace/github_cpp_makefile_star2_O3/yukioc[P]tscrpt/tscrpt.cpp
// Function: tscrpt_t::scan(std::__cxx11::list<obj_t*, std::allocator<obj_t*>>*, char const*)
void tscrpt_t::scan(std::list<obj_t*>* olist, const char* s)
{
	int i;
	const char *e;
	verbose(VTRACE,"scan: text=%s\n", s);
	assert(olist!=0&&s!=0);
	while(*s!=0){
		for(;isspace(*s);s++) if(*s=='\0') return; //skip space
		if(isdigit(*s)){ //number, [0-9]+ 0[0-7]+ 0x[0-9a-fA-F]+
			olist->push_back(new obj_t('N',strtol(s,(char**)&e,0)));
			s=e;
			if (isalpha(*s)||*s=='_') verbose(VERR,"Error: wrong trailing character\n");
		}else if(isalpha(*s)||*s=='_'){ //symbol, [_a-zA-Z][_a-zA-Z0-9]+
			for(i=0,e=s;isalnum(*e)||*e=='_';i++,e++);
			olist->push_back(new obj_t('I',s,i));
			s=e;
		}else if(strcmp(s,"//")==0){ //line comment
			verbose(VTRACE,"scan: comment\n");
			while(*++s!='\0');
		}else if(*s=='+'||*s=='-'||*s=='*'||*s=='/'||*s=='%'){ //operator
			olist->push_back(new obj_t(*s));
			++s;
		}else if(*s=='\"'){ //string
			for(i=0,e=s+1;*e!='\"'||*(e-1)=='\\';i++,e++)
				if(*e=='\0') throw std::logic_error("scan: string terminator(\") is not found");
			const char* t=estrndup(s+1,i);
			olist->push_back(new obj_t('S',t));
			delete t;
			s=e+1;
		}else{
			verbose(VERR,"scan: Error: unknown leading character - %c\n", *s);
			++s;
		}
	}
	olist->push_back(new obj_t('$'));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbp
movq %rsi, %rbx
cmpl $0x9, 0x78b5(%rip)      # 0xa148
jl 0x28a6
leaq 0x47c1(%rip), %rdi      # 0x705d
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2040
testq %rbx, %rbx
je 0x2c77
testq %rbp, %rbp
je 0x2c77
movb (%rbp), %r13b
testb %r13b, %r13b
je 0x2bec
leaq 0x10(%rsp), %r14
movsbl %r13b, %r12d
movl %r12d, %edi
callq 0x2060
testl %eax, %eax
je 0x28fd
movb $0x1, %r13b
testb %r13b, %r13b
je 0x2c36
movb 0x1(%rbp), %r13b
incq %rbp
movsbl %r13b, %r12d
movl %r12d, %edi
callq 0x2060
testl %eax, %eax
jne 0x28dd
leal -0x30(%r12), %eax
cmpl $0x9, %eax
ja 0x2991
movl $0x30, %edi
callq 0x2140
movq %rax, %r12
movq %rbp, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21a0
movb $0x4e, (%r12)
leaq 0x18(%r12), %rcx
movq %rcx, 0x8(%r12)
movq $0x0, 0x10(%r12)
movb $0x0, 0x18(%r12)
movl %eax, 0x28(%r12)
movl $0x18, %edi
callq 0x2140
movq %r12, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq 0x10(%rsp), %rbp
movb (%rbp), %r15b
movsbl %r15b, %edi
callq 0x21f0
testl %eax, %eax
je 0x2a45
cmpl $0x3, 0x77c2(%rip)      # 0xa148
jge 0x2a5c
jmp 0x2ae8
movl %r12d, %edi
callq 0x21f0
cmpb $0x5f, %r13b
je 0x2a24
testl %eax, %eax
jne 0x2a24
cmpb $0x2f, %r13b
ja 0x2b1f
movzbl %r13b, %eax
movabsq $0x2c2000000000, %rcx   # imm = 0x2C2000000000
btq %rax, %rcx
jae 0x2afa
movl $0x30, %edi
callq 0x2140
movq %rax, %r12
movb (%rbp), %al
movb %al, (%r12)
leaq 0x18(%r12), %rax
movq %rax, 0x8(%r12)
movq $0x0, 0x10(%r12)
movb $0x0, 0x18(%r12)
movl $0x0, 0x28(%r12)
movl $0x18, %edi
callq 0x2140
movq %r12, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
incq %rbp
jmp 0x2ae8
movq %rbp, 0x10(%rsp)
movsbl (%rbp), %r12d
movl %r12d, %edi
callq 0x2160
cmpl $0x5f, %r12d
je 0x2a6a
testl %eax, %eax
jne 0x2a6a
xorl %r12d, %r12d
jmp 0x2a94
cmpb $0x5f, %r15b
jne 0x2ae8
cmpl $0x2, 0x76f2(%rip)      # 0xa148
jle 0x2ae8
leaq 0x4924(%rip), %rdi      # 0x7387
callq 0x21d0
jmp 0x2ae8
leaq 0x1(%rbp), %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rax
movq %rax, 0x10(%rsp)
movsbl (%r15,%r12), %r13d
movl %r13d, %edi
callq 0x2160
incq %r12
cmpl $0x5f, %r13d
je 0x2a71
testl %eax, %eax
jne 0x2a71
movl $0x30, %edi
callq 0x2140
movq %rax, %r13
movb $0x49, (%rax)
leaq 0x8(%rax), %rdi
addq $0x18, %rax
movq %rax, 0x8(%r13)
addq %rbp, %r12
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3bb2
movl $0x0, 0x28(%r13)
movl $0x18, %edi
callq 0x2140
movq %r13, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq 0x10(%rsp), %rbp
movb (%rbp), %r13b
testb %r13b, %r13b
jne 0x28ca
jmp 0x2bec
cmpq $0x22, %rax
je 0x2b42
cmpq $0x2f, %rax
jne 0x2b1f
cmpb $0x2f, 0x1(%rbp)
jne 0x29c9
cmpb $0x0, 0x2(%rbp)
jne 0x29c9
jmp 0x2bd7
cmpl $0x3, 0x7622(%rip)      # 0xa148
jl 0x2a1c
leaq 0x45a8(%rip), %rdi      # 0x70db
movl %r12d, %esi
xorl %eax, %eax
callq 0x2040
jmp 0x2a1c
incq %rbp
xorl %esi, %esi
leaq (%rsi,%rbp), %rax
movq %rax, 0x10(%rsp)
movzbl (%rbp,%rsi), %eax
cmpl $0x22, %eax
je 0x2b63
testl %eax, %eax
jne 0x2b6a
jmp 0x2c45
cmpb $0x5c, -0x1(%rbp,%rsi)
jne 0x2b6f
incq %rsi
jmp 0x2b47
movq %rbp, %rdi
callq 0x2dda
movq %rax, %r12
movl $0x30, %edi
callq 0x2140
movq %rax, %r13
movb $0x53, (%rax)
leaq 0x8(%rax), %rdi
movq %r12, %rsi
leaq 0xf(%rsp), %rdx
callq 0x3c48
movl $0x0, 0x28(%r13)
movl $0x18, %edi
callq 0x2140
movq %r13, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movl $0x1, %esi
movq %r12, %rdi
callq 0x2150
movq 0x10(%rsp), %rbp
jmp 0x2a1c
cmpl $0x9, 0x756a(%rip)      # 0xa148
jl 0x2bec
leaq 0x4792(%rip), %rdi      # 0x7379
callq 0x21d0
movl $0x30, %edi
callq 0x2140
movq %rax, %r14
movb $0x24, (%rax)
addq $0x18, %rax
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
movb $0x0, 0x18(%r14)
movl $0x0, 0x28(%r14)
movl $0x18, %edi
callq 0x2140
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x445a(%rip), %rsi      # 0x70b3
movq %rax, %rdi
callq 0x21b0
movq 0x7378(%rip), %rsi      # 0x9fe0
movq 0x7361(%rip), %rdx      # 0x9fd0
movq %r14, %rdi
callq 0x2220
leaq 0x43ee(%rip), %rdi      # 0x706c
leaq 0x4742(%rip), %rsi      # 0x73c7
leaq 0x43ef(%rip), %rcx      # 0x707b
movl $0x45, %edx
callq 0x2100
jmp 0x2c98
movq %rax, %rbx
movl $0x30, %esi
movq %r13, %rdi
callq 0x2150
jmp 0x2cb5
movq %rax, %rbx
movq %r14, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2240
nop