// File: /workspace/github_cpp_makefile_star2_O1/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, 0x78ab(%rip)      # 0xa148
jl 0x28b0
leaq 0x47b7(%rip), %rdi      # 0x705d
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2040
testq %rbx, %rbx
je 0x2c8e
testq %rbp, %rbp
je 0x2c8e
cmpb $0x0, (%rbp)
je 0x2c03
leaq 0x8(%rsp), %r14
leaq 0x4ab2(%rip), %r12      # 0x738a
movb (%rbp), %r15b
movsbl %r15b, %r13d
movl %r13d, %edi
callq 0x2060
testl %eax, %eax
je 0x28fe
testb %r15b, %r15b
je 0x2c4d
movb 0x1(%rbp), %r15b
incq %rbp
jmp 0x28dc
leal -0x30(%r13), %eax
cmpl $0x9, %eax
ja 0x2986
movl $0x30, %edi
callq 0x2140
movq %rax, %r15
movq %rbp, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21a0
movb $0x4e, (%r15)
leaq 0x18(%r15), %rcx
movq %rcx, 0x8(%r15)
movq $0x0, 0x10(%r15)
movb $0x0, 0x18(%r15)
movl %eax, 0x28(%r15)
movl $0x18, %edi
callq 0x2140
movq %r15, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq 0x8(%rsp), %r15
movb (%r15), %bpl
movsbl %bpl, %edi
callq 0x21f0
testl %eax, %eax
je 0x2a55
cmpl $0x3, 0x77cd(%rip)      # 0xa148
jge 0x2a6c
jmp 0x2b23
movl %r13d, %edi
callq 0x21f0
cmpb $0x5f, %r15b
je 0x2a31
testl %eax, %eax
jne 0x2a31
movq %rbp, %rdi
leaq 0x4709(%rip), %rsi      # 0x70b3
callq 0x2190
testl %eax, %eax
je 0x2b01
cmpb $0x2f, %r15b
ja 0x2b70
movzbl %r15b, %eax
movabsq $0xac2000000000, %rcx   # imm = 0xAC2000000000
btq %rax, %rcx
jae 0x2b35
movl $0x30, %edi
callq 0x2140
movq %rax, %r15
movb (%rbp), %al
movb %al, (%r15)
leaq 0x18(%r15), %rax
movq %rax, 0x8(%r15)
movq $0x0, 0x10(%r15)
movb $0x0, 0x18(%r15)
movl $0x0, 0x28(%r15)
movl $0x18, %edi
callq 0x2140
movq %r15, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
incq %rbp
movq %rbp, %r15
jmp 0x2b23
movq %r12, %r14
movq %rbp, 0x8(%rsp)
movsbl (%rbp), %r15d
movl %r15d, %edi
callq 0x2160
cmpl $0x5f, %r15d
je 0x2a79
testl %eax, %eax
jne 0x2a79
xorl %r13d, %r13d
jmp 0x2aa3
cmpb $0x5f, %bpl
jne 0x2b23
cmpl $0x2, 0x76e2(%rip)      # 0xa148
jle 0x2b23
movq %r12, %rdi
callq 0x21d0
jmp 0x2b23
leaq 0x1(%rbp), %r12
xorl %r13d, %r13d
leaq (%r12,%r13), %rax
movq %rax, 0x8(%rsp)
movsbl (%r12,%r13), %r15d
movl %r15d, %edi
callq 0x2160
incq %r13
cmpl $0x5f, %r15d
je 0x2a80
testl %eax, %eax
jne 0x2a80
movl $0x30, %edi
callq 0x2140
movq %rax, %r15
movb $0x49, (%rax)
leaq 0x8(%rax), %rdi
addq $0x18, %rax
movq %rax, 0x8(%r15)
addq %rbp, %r13
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3bda
movl $0x0, 0x28(%r15)
movl $0x18, %edi
callq 0x2140
movq %r15, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq 0x8(%rsp), %r15
movq %r14, %r12
leaq 0x8(%rsp), %r14
jmp 0x2b23
cmpl $0x9, 0x7640(%rip)      # 0xa148
jl 0x2b16
leaq 0x486b(%rip), %rdi      # 0x737c
callq 0x21d0
leaq 0x1(%rbp), %r15
cmpb $0x0, 0x1(%rbp)
movq %r15, %rbp
jne 0x2b16
cmpb $0x0, (%r15)
movq %r15, %rbp
jne 0x28d8
jmp 0x2c03
cmpq $0x22, %rax
jne 0x2b70
incq %rbp
xorl %esi, %esi
leaq (%rsi,%rbp), %rax
movq %rax, 0x8(%rsp)
movzbl (%rbp,%rsi), %eax
cmpl $0x22, %eax
je 0x2b5c
testl %eax, %eax
jne 0x2b6b
jmp 0x2c5c
cmpb $0x5c, -0x1(%rbp,%rsi)
jne 0x2b93
testb %al, %al
je 0x2c5c
incq %rsi
jmp 0x2b40
cmpl $0x3, 0x75d1(%rip)      # 0xa148
jl 0x2a26
leaq 0x455a(%rip), %rdi      # 0x70de
movl %r13d, %esi
xorl %eax, %eax
callq 0x2040
jmp 0x2a26
movq %rbp, %rdi
callq 0x2dee
movq %rax, %r13
movl $0x30, %edi
callq 0x2140
movq %rax, %r15
movb $0x53, (%rax)
leaq 0x8(%rax), %rdi
movq %r13, %rsi
leaq 0x17(%rsp), %rdx
callq 0x3c6a
movl $0x0, 0x28(%r15)
movl $0x18, %edi
callq 0x2140
movq %r15, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
testq %r13, %r13
je 0x2bf6
movl $0x1, %esi
movq %r13, %rdi
callq 0x2150
movq 0x8(%rsp), %r15
incq %r15
jmp 0x2b23
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 0x4446(%rip), %rsi      # 0x70b6
movq %rax, %rdi
callq 0x21b0
movq 0x7361(%rip), %rsi      # 0x9fe0
movq 0x734a(%rip), %rdx      # 0x9fd0
movq %r14, %rdi
callq 0x2220
leaq 0x43d7(%rip), %rdi      # 0x706c
leaq 0x472e(%rip), %rsi      # 0x73ca
leaq 0x43d8(%rip), %rcx      # 0x707b
movl $0x45, %edx
callq 0x2100
jmp 0x2caf
movq %rax, %rbx
movl $0x30, %esi
movq %r15, %rdi
callq 0x2150
jmp 0x2ccc
movq %rax, %rbx
movq %r14, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2240