// File: /workspace/github_cpp_makefile_star2_O2/ClauParser[P]ClauParser/./include/clau_parser.h
// Function: clau_parser::InFileReserver::ScanningNew(char*, unsigned long, int, long*&, unsigned long&, bool)
static void ScanningNew(char* text, const size_t length, const int thr_num,
			int64_t*& _token_arr, size_t& _token_arr_size, bool use_simd)
		{
			std::vector<std::thread> thr(thr_num);
			std::vector<size_t> start(thr_num);
			std::vector<size_t> last(thr_num);

			{
				start[0] = 0;

				for (int i = 1; i < thr_num; ++i) {
					start[i] = length / thr_num * i;

					for (size_t x = start[i]; x <= length; ++x) {
						if (Utility::isWhitespace(text[x]) || '\0' == text[x] ||
							LoadDataOption::Left == text[x] || LoadDataOption::Right == text[x] || LoadDataOption::Assignment == text[x]) {
							start[i] = x;
							break;
						}
					}
				}
				for (int i = 0; i < thr_num - 1; ++i) {
					last[i] = start[i + 1];
					for (size_t x = last[i]; x <= length; ++x) {
						if (Utility::isWhitespace(text[x]) || '\0' == text[x] ||
							LoadDataOption::Left == text[x] || LoadDataOption::Right == text[x] || LoadDataOption::Assignment == text[x]) {
							last[i] = x;
							break;
						}
					}
				}
				last[thr_num - 1] = length + 1;
			}
			size_t real_token_arr_count = 0;

			int64_t* tokens = new int64_t[length + 1];


			std::vector<size_t> token_arr_size(thr_num);
			auto a = std::chrono::steady_clock::now();
			for (int i = 0; i < thr_num; ++i) {
				if (use_simd) {
					thr[i] = std::thread(_ScanningWithSimd, text + start[i], start[i], last[i] - start[i], std::ref(tokens), std::ref(token_arr_size[i]));
				}
				else {
					thr[i] = std::thread(_Scanning, text + start[i], start[i], last[i] - start[i], std::ref(tokens), std::ref(token_arr_size[i]));
				}
			}

			for (int i = 0; i < thr_num; ++i) {
				thr[i].join();
			}
			auto b = std::chrono::steady_clock::now();
			int state = 0;
			int new_state = state;

			int64_t qouted_start = -4;
			int64_t slush_start = -5;

			for (size_t t = 0; t < thr_num; ++t) {
				for (size_t j = 0; j < token_arr_size[t]; ++j) {
					const int64_t i = start[t] + j;

					////std::cout << tokens[i] << "\n";
					//Utility::PrintToken(text, tokens[i]);
					//

					const bool isToken2 = Utility::IsToken2(tokens[i]);


					if (!isToken2 && state == 0) {
						tokens[real_token_arr_count] = tokens[i];
						real_token_arr_count++;
					}
					else {
						const char ch = text[Utility::GetIdx(tokens[i])];
						const int64_t idx = Utility::GetIdx(tokens[i]);

						//if (isToken2) {
						new_state = (isToken2 && 0 == state && '\"' == ch) ? 1 : new_state;
						qouted_start = (isToken2 && 0 == state && '\"' == ch) ? i : qouted_start;

						/*if (0 == state && '\"' == ch) {
							state = 1;
							qouted_start = i;
						}
						else
						if (0 == state && LoadDataOption::LineComment == ch) {
							state = 2;
						}
						else if (1 == state && '\\' == ch) {
							state = 3;
							slush_start = idx;
						}
						else if (1 == state && '\"' == ch) {
							state = 0;

							{
								int64_t idx = Utility::GetIdx(tokens[qouted_start]);
								int64_t len = Utility::GetLength(tokens[qouted_start]);

								len = Utility::GetIdx(tokens[i]) - idx + 1;

								tokens[real_token_arr_count] = Utility::Get(idx, len, text[idx]);

								//	Utility::PrintToken(text, tokens[real_token_arr_count]);


								real_token_arr_count++;
							}
						}
						else if (3 == state) {
							if (idx != slush_start + 1) {
								--j; // --i;
							}
							state = 1;
						}
						else if (2 == state && ('\n' == ch || '\0' == ch)) {
							state = 0;
						}}
					else if (0 == state) { //
						tokens[real_token_arr_count] = tokens[i];

						//	Utility::PrintToken(text, tokens[real_token_arr_count]);

						real_token_arr_count++;
					}
						*/
						new_state = (isToken2 && 0 == state && LoadDataOption::LineComment == ch) ? 2 : new_state;

						new_state = (isToken2 && 1 == state && '\\' == ch) ? 3 : new_state;

						slush_start = (isToken2 && 1 == state && '\\' == ch) ? idx : slush_start;

						new_state = (isToken2 && 1 == state && '\"' == ch) ? 0 : new_state;
						{
							int64_t idx = (isToken2 && 1 == state && '\"' == ch) ? Utility::GetIdx(tokens[qouted_start]) : -1;
							int64_t len = (isToken2 && 1 == state && '\"' == ch) ? Utility::GetLength(tokens[qouted_start]) : -1;
							len = (isToken2 && 1 == state && '\"' == ch) ? Utility::GetIdx(tokens[i]) - idx + 1 : -1;

							if (isToken2 && 1 == state && '\"' == ch) {
								tokens[real_token_arr_count] = Utility::Get2(idx, len);
								real_token_arr_count++;
							}
						}
						j = (isToken2 && 3 == state && idx != slush_start + 1) ? j - 1 : j;

						new_state = (isToken2 && 3 == state) ? 1 : new_state;

						new_state = (isToken2 && 2 == state && ('\n' == ch || '\0' == ch)) ? 0 : new_state;
						state = new_state;
					}
				}
			}
			auto c = std::chrono::steady_clock::now();
			auto dur = std::chrono::duration_cast<std::chrono::milliseconds>(b - a);
			auto dur2 = std::chrono::duration_cast<std::chrono::milliseconds>(c - b);

			//std::cout << dur.count() << "ms\n";
			//std::cout << dur2.count() << "ms\n";

			{
				if (0 != state) {
					//std::cout << "[ERROR] state [" << state << "] is not zero \n";
				}
			}


			{
				_token_arr = tokens;
				_token_arr_size = real_token_arr_count;
			}
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, %r15d
movq %r8, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movl %edx, %r13d
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
movslq %edx, %r14
leaq 0xc0(%rsp), %rdi
leaq 0x78(%rsp), %rdx
movq %r14, %rsi
callq 0x4756
leaq 0x78(%rsp), %rdi
leaq 0x60(%rsp), %rdx
movq %r14, %rsi
callq 0x60ac
leaq 0x60(%rsp), %rdi
leaq 0x90(%rsp), %rdx
movq %r14, %rsi
callq 0x60ac
movq 0x78(%rsp), %rcx
andq $0x0, (%rcx)
pushq $0x1
popq %rdi
movabsq $0x2000000100003e01, %rsi # imm = 0x2000000100003E01
cmpq %r14, %rdi
jge 0x5bc3
movq %rbx, %rax
xorl %edx, %edx
divq %r14
imulq %rdi, %rax
movq %rax, (%rcx,%rdi,8)
cmpq %rbx, %rax
ja 0x5bbe
movq 0x10(%rsp), %rdx
movzbl (%rdx,%rax), %edx
cmpq $0x3d, %rdx
ja 0x5bab
btq %rdx, %rsi
jb 0x5bba
cmpl $0x7d, %edx
je 0x5bba
cmpl $0x7b, %edx
je 0x5bba
incq %rax
jmp 0x5b91
movq %rax, (%rcx,%rdi,8)
incq %rdi
jmp 0x5b7c
leal -0x1(%r13), %eax
movq 0x60(%rsp), %rdx
xorl %r8d, %r8d
testl %eax, %eax
movl $0x0, %edi
cmovgl %eax, %edi
cmpq %rdi, %r8
je 0x5c20
leaq 0x1(%r8), %r9
movq 0x8(%rcx,%r8,8), %r10
movq %r10, (%rdx,%r8,8)
cmpq %rbx, %r10
ja 0x5c1b
movq 0x10(%rsp), %r11
movzbl (%r11,%r10), %r11d
cmpq $0x3d, %r11
ja 0x5c06
btq %r11, %rsi
jb 0x5c17
cmpl $0x7d, %r11d
je 0x5c17
cmpl $0x7b, %r11d
je 0x5c17
incq %r10
jmp 0x5beb
movq %r10, (%rdx,%r8,8)
movq %r9, %r8
jmp 0x5bd9
leaq 0x1(%rbx), %rcx
cltq
movq 0x60(%rsp), %rdx
movq %rcx, (%rdx,%rax,8)
shrq $0x3d, %rcx
leaq 0x8(,%rbx,8), %rax
xorl %edi, %edi
negq %rcx
sbbq %rdi, %rdi
orq %rax, %rdi
callq 0x2040
movq %rax, 0x18(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
movq %r14, 0x48(%rsp)
movq %r14, %rsi
callq 0x60ac
callq 0x2260
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
shlq $0x3, %r13
leaq 0xb8(%rsp), %r14
leaq 0x58(%rsp), %rbp
leaq 0x50(%rsp), %rbx
cmpq %r12, %r13
je 0x5d94
testb %r15b, %r15b
je 0x5d09
movq 0x78(%rsp), %rcx
movq (%rcx,%r12), %rax
addq %r12, %rcx
movq 0x10(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x40(%rsp)
movq 0x60(%rsp), %rdx
movq (%rdx,%r12), %rdx
subq %rax, %rdx
movq %rdx, 0x58(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x90(%rsp), %rax
addq %r12, %rax
movq %rax, 0x38(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
leaq 0x407(%rip), %rsi       # 0x60fe
leaq 0x40(%rsp), %rdx
movq %rbp, %r8
movq %rbx, %r9
callq 0x6434
jmp 0x5d70
movq 0x78(%rsp), %rcx
movq (%rcx,%r12), %rax
addq %r12, %rcx
movq 0x10(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x40(%rsp)
movq 0x60(%rsp), %rdx
movq (%rdx,%r12), %rdx
subq %rax, %rdx
movq %rdx, 0x58(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x90(%rsp), %rax
addq %r12, %rax
movq %rax, 0x38(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
leaq 0x77c(%rip), %rsi       # 0x64dc
leaq 0x40(%rsp), %rdx
movq %rbp, %r8
movq %rbx, %r9
callq 0x6434
movq 0xc0(%rsp), %rdi
addq %r12, %rdi
movq %r14, %rsi
callq 0x52d0
movq %r14, %rdi
callq 0x52ea
addq $0x8, %r12
jmp 0x5c92
xorl %ebx, %ebx
movq 0x48(%rsp), %r14
cmpq %rbx, %r13
je 0x5db6
movq 0xc0(%rsp), %rdi
addq %rbx, %rdi
callq 0x22e0
addq $0x8, %rbx
jmp 0x5d9b
callq 0x2260
pushq $-0x5
popq %rax
pushq $-0x4
popq %rcx
movq 0x90(%rsp), %rsi
xorl %ebx, %ebx
xorl %edx, %edx
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq %r14, %r11
je 0x5f59
movq %rax, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
movq 0x78(%rsp), %rax
movq 0x18(%rsp), %r13
xorl %ebp, %ebp
movq %rax, 0x20(%rsp)
cmpq (%rsi,%r11,8), %rbp
jae 0x5f42
movq (%rax,%r11,8), %r12
addq %rbp, %r12
movq (%r13,%r12,8), %r8
testb $0x1, %r8b
jne 0x5e27
testl %edx, %edx
jne 0x5e27
movq %r8, (%r13,%rbx,8)
incq %rbx
xorl %r12d, %r12d
jmp 0x5f37
movq %rsi, %r14
testl %edx, %edx
sete %dil
movq %r8, %r15
shrq $0x20, %r15
movq 0x10(%rsp), %rsi
movb (%rsi,%r15), %r9b
andb %r8b, %dil
cmpb $0x22, %r9b
sete %sil
testb %sil, %dil
pushq $0x1
popq %rcx
cmovnel %ecx, %r10d
movq 0x30(%rsp), %rcx
cmovneq %r12, %rcx
cmpb $0x23, %r9b
movl %r10d, %r12d
pushq $0x2
popq %rax
cmovel %eax, %r12d
testb %dil, %dil
cmovel %r10d, %r12d
cmpl $0x1, %edx
sete %dil
andb %r8b, %dil
cmpb $0x5c, %r9b
sete %r10b
testb %r10b, %dil
pushq $0x3
popq %rax
cmovnel %eax, %r12d
movq 0x28(%rsp), %rax
cmovneq %r15, %rax
andb %sil, %dil
movl $0x0, %esi
cmovnel %esi, %r12d
cmpb $0x1, %dil
movq %rcx, 0x30(%rsp)
jne 0x5ede
movq (%r13,%rcx,8), %rsi
movq %rsi, %rdi
shrq $0x20, %rdi
movq %r15, %r10
subq %rdi, %r10
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
andq %rcx, %rsi
leaq (%rsi,%r10,8), %rsi
addq $0x8, %rsi
movq %rsi, (%r13,%rbx,8)
incq %rbx
cmpl $0x3, %edx
sete %sil
andb %r8b, %sil
leaq 0x1(%rax), %rdi
cmpq %rdi, %r15
setne %dil
andb %sil, %dil
movzbl %dil, %edi
subq %rdi, %rbp
testb %sil, %sil
pushq $0x1
popq %rcx
cmovnel %ecx, %r12d
testb $0x1, %r8b
movq %rax, 0x28(%rsp)
je 0x5f2c
cmpl $0x2, %edx
jne 0x5f2c
movzbl %r9b, %edx
xorl %r10d, %r10d
testl %edx, %edx
je 0x5f27
cmpl $0xa, %edx
jne 0x5f2c
xorl %r12d, %r12d
jmp 0x5f2f
movl %r12d, %r10d
movq %r14, %rsi
movq 0x20(%rsp), %rax
incq %rbp
movl %r12d, %edx
jmp 0x5df7
incq %r11
movq 0x48(%rsp), %r14
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %rax
jmp 0x5dd3
callq 0x2260
movq 0x18(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq %rax, (%rcx)
movq 0xb0(%rsp), %rax
movq %rbx, (%rax)
leaq 0x90(%rsp), %rdi
callq 0x6888
leaq 0x60(%rsp), %rdi
callq 0x6888
leaq 0x78(%rsp), %rdi
callq 0x6888
leaq 0xc0(%rsp), %rdi
callq 0x5580
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5fbb
movq %rax, %rbx
jmp 0x5fde
movq %rax, %rbx
jmp 0x5fe8
movq %rax, %rbx
jmp 0x5ff2
jmp 0x5fce
jmp 0x5fce
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x6888
leaq 0x60(%rsp), %rdi
callq 0x6888
leaq 0x78(%rsp), %rdi
callq 0x6888
leaq 0xc0(%rsp), %rdi
callq 0x5580
movq %rbx, %rdi
callq 0x2300
nop