// File: /workspace/github_cpp_makefile_star2_O2/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, %r13
movq %rsi, %rbx
cmpl $0x9, 0x7c23(%rip)      # 0xa168
jl 0x2558
leaq 0x4b0f(%rip), %rdi      # 0x705d
movq %r13, %rsi
xorl %eax, %eax
callq 0x2040
testq %rbx, %rbx
je 0x2860
testq %r13, %r13
je 0x2860
leaq 0x8(%rsp), %r12
movb (%r13), %r14b
testb %r14b, %r14b
je 0x27f1
incq %r13
movsbl %r14b, %r15d
movl %r15d, %edi
callq 0x2060
testl %eax, %eax
je 0x259e
testb %r14b, %r14b
je 0x2821
movb (%r13), %r14b
jmp 0x257c
leal -0x30(%r15), %eax
leaq -0x1(%r13), %rbp
cmpl $0x9, %eax
ja 0x261b
pushq $0x30
popq %rdi
callq 0x2150
movq %rax, %r15
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x21d0
movb $0x4e, (%r15)
leaq 0x18(%r15), %rcx
movq %rcx, 0x8(%r15)
andq $0x0, 0x10(%r15)
movb $0x0, 0x18(%r15)
movl %eax, 0x28(%r15)
movq %r15, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x35fa
movq 0x10(%rsp), %r13
movb (%r13), %bpl
movsbl %bpl, %edi
callq 0x2220
testl %eax, %eax
je 0x26e5
cmpl $0x3, 0x7b58(%rip)      # 0xa168
jl 0x256f
jmp 0x26fc
movl %r15d, %edi
callq 0x2220
cmpb $0x5f, %r14b
je 0x2686
testl %eax, %eax
jne 0x2686
cmpb $0x2f, %r14b
ja 0x2756
movzbl %r14b, %eax
movabsq $0x2c2000000000, %rcx   # imm = 0x2C2000000000
btq %rax, %rcx
jae 0x270d
pushq $0x30
popq %rdi
callq 0x2150
movb (%rbp), %cl
movb %cl, (%rax)
leaq 0x18(%rax), %rcx
movq %rcx, 0x8(%rax)
andq $0x0, 0x10(%rax)
movb $0x0, 0x18(%rax)
andl $0x0, 0x28(%rax)
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x35fa
jmp 0x256f
xorl %r15d, %r15d
movq %rbp, %r14
movq %r14, 0x10(%rsp)
movsbl (%r14), %r13d
movl %r13d, %edi
callq 0x2170
cmpl $0x5f, %r13d
je 0x26a7
testl %eax, %eax
je 0x26af
incl %r15d
incq %r14
jmp 0x268c
pushq $0x30
popq %rdi
callq 0x2150
movq %rax, %r13
movq %rax, %rdi
pushq $0x49
popq %rsi
movq %rbp, %rdx
movl %r15d, %ecx
callq 0x3606
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x35fa
movq 0x10(%rsp), %r13
jmp 0x256f
cmpb $0x5f, %bpl
jne 0x256f
cmpl $0x2, 0x7a72(%rip)      # 0xa168
jle 0x256f
leaq 0x4c84(%rip), %rdi      # 0x7387
callq 0x2200
jmp 0x256f
cmpq $0x22, %rax
je 0x2779
cmpq $0x2f, %rax
jne 0x2756
cmpb $0x2f, (%r13)
jne 0x264f
cmpb $0x0, 0x1(%r13)
jne 0x264f
cmpl $0x9, 0x7a32(%rip)      # 0xa168
jl 0x2744
leaq 0x4c3a(%rip), %rdi      # 0x7379
callq 0x2200
leaq 0x1(%rbp), %r13
cmpb $0x0, 0x1(%rbp)
movq %r13, %rbp
jne 0x2744
jmp 0x256f
cmpl $0x3, 0x7a0b(%rip)      # 0xa168
jl 0x256f
leaq 0x4971(%rip), %rdi      # 0x70db
movl %r15d, %esi
xorl %eax, %eax
callq 0x2040
jmp 0x256f
xorl %esi, %esi
leaq (%rsi,%r13), %rax
movq %rax, 0x10(%rsp)
movzbl (%r13,%rsi), %eax
cmpl $0x22, %eax
je 0x2798
testl %eax, %eax
jne 0x27a0
jmp 0x2830
cmpb $0x5c, -0x1(%r13,%rsi)
jne 0x27a5
incq %rsi
jmp 0x277b
movq %r13, %rdi
callq 0x299d
movq %rax, %r15
pushq $0x30
popq %rdi
callq 0x2150
movq %rax, %r13
movq %rax, %rdi
pushq $0x53
popq %rsi
movq %r15, %rdx
callq 0x3630
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x35fa
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x2160
movq 0x10(%rsp), %r13
incq %r13
jmp 0x256f
pushq $0x30
popq %rdi
callq 0x2150
movb $0x24, (%rax)
leaq 0x18(%rax), %rcx
movq %rcx, 0x8(%rax)
andq $0x0, 0x10(%rax)
movb $0x0, 0x18(%rax)
andl $0x0, 0x28(%rax)
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x35fa
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x20f0
movq %rax, %r14
leaq 0x4871(%rip), %rsi      # 0x70b3
movq %rax, %rdi
callq 0x21e0
movq 0x778f(%rip), %rsi      # 0x9fe0
movq 0x7778(%rip), %rdx      # 0x9fd0
movq %r14, %rdi
callq 0x2260
leaq 0x4805(%rip), %rdi      # 0x706c
leaq 0x4b59(%rip), %rsi      # 0x73c7
leaq 0x4806(%rip), %rcx      # 0x707b
pushq $0x45
popq %rdx
callq 0x2100
jmp 0x287f
movq %rax, %rbx
pushq $0x30
popq %rsi
movq %r13, %rdi
callq 0x2160
jmp 0x289a
movq %rax, %rbx
movq %r14, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2280