// File: 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
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpl $0x9, 0xbab2(%rip)      # 0xe1d0
jl 0x2732
movq -0x18(%rbp), %rsi
leaq 0x7a62(%rip), %rdi      # 0xa18d
movb $0x0, %al
callq 0x2040
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x69(%rbp)
je 0x2749
cmpq $0x0, -0x18(%rbp)
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x2752
jmp 0x2754
jmp 0x2773
leaq 0x7a41(%rip), %rdi      # 0xa19c
leaq 0x7d9a(%rip), %rsi      # 0xa4fc
movl $0x45, %edx
leaq 0x7a3d(%rip), %rcx      # 0xa1ab
callq 0x2140
jmp 0x2775
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2c59
jmp 0x2787
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0x2060
cmpl $0x0, %eax
je 0x27b9
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x27a9
jmp 0x2ca2
jmp 0x27ab
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2787
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0x21b0
cmpl $0x0, %eax
je 0x2888
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x30, %edi
callq 0x21c0
movq %rax, -0x78(%rbp)
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x22a0
movq -0x78(%rbp), %rdi
movl %eax, %edx
movl $0x4e, %esi
callq 0x42d0
jmp 0x280c
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x4290
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0x22d0
cmpl $0x0, %eax
jne 0x2849
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
jne 0x2883
cmpl $0x3, 0xb980(%rip)      # 0xe1d0
jl 0x2881
leaq 0x798a(%rip), %rdi      # 0xa1e3
movb $0x0, %al
callq 0x2040
jmp 0x2881
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x30, %esi
callq 0x21d0
jmp 0x2cc8
jmp 0x2883
jmp 0x2c54
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0x22d0
cmpl $0x0, %eax
jne 0x28a9
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
jne 0x298a
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
callq 0x21f0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x89(%rbp)
jne 0x28e6
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
sete %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x28f2
jmp 0x290b
jmp 0x28f4
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x28b8
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl $0x30, %edi
callq 0x21c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl $0x49, %esi
callq 0x4310
jmp 0x2940
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rsi
callq 0x4290
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x2c52
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x30, %esi
callq 0x21d0
jmp 0x2cc8
movq -0x18(%rbp), %rdi
leaq 0x786f(%rip), %rsi      # 0xa204
callq 0x2290
cmpl $0x0, %eax
jne 0x29d7
cmpl $0x9, 0xb82a(%rip)      # 0xe1d0
jl 0x29b6
leaq 0x7858(%rip), %rdi      # 0xa207
movb $0x0, %al
callq 0x2040
jmp 0x29b8
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x29d2
jmp 0x29b8
jmp 0x2c50
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0x2a13
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x2a13
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
je 0x2a13
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x2a13
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
jne 0x2a91
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl $0x30, %edi
callq 0x21c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
callq 0x43b0
jmp 0x2a43
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x4290
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2c4e
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x30, %esi
callq 0x21d0
jmp 0x2cc8
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x2c22
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x22, %ecx
movb %al, -0xb1(%rbp)
jne 0x2adc
movq -0x28(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x5c, %eax
sete %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x2aeb
jmp 0x2b6f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2b53
movl $0x10, %edi
callq 0x2120
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
leaq 0x7701(%rip), %rsi      # 0xa216
callq 0x22b0
jmp 0x2b1c
movq -0xc0(%rbp), %rdi
movq 0xb4b6(%rip), %rsi      # 0xdfe0
movq 0xb49f(%rip), %rdx      # 0xdfd0
callq 0x2310
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x2170
jmp 0x2cc8
jmp 0x2b55
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2ab4
movq -0x18(%rbp), %rdi
incq %rdi
movslq -0x1c(%rbp), %rsi
callq 0x2e50
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl $0x30, %edi
callq 0x21c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
movq -0x58(%rbp), %rdx
movl $0x53, %esi
callq 0x43f0
jmp 0x2bb5
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x4290
movq -0x58(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, %rax
je 0x2bf2
movq -0xd8(%rbp), %rdi
movl $0x1, %esi
callq 0x21d0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2c4c
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x30, %esi
callq 0x21d0
jmp 0x2cc8
cmpl $0x3, 0xb5a7(%rip)      # 0xe1d0
jl 0x2c40
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
leaq 0x7605(%rip), %rdi      # 0xa23e
movb $0x0, %al
callq 0x2040
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2c4e
jmp 0x2c50
jmp 0x2c52
jmp 0x2c54
jmp 0x2775
movq -0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl $0x30, %edi
callq 0x21c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movl $0x24, %esi
callq 0x43b0
jmp 0x2c87
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rsi
callq 0x4290
addq $0xf0, %rsp
popq %rbp
retq
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x30, %esi
callq 0x21d0
movq -0x38(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)