// File: /workspace/github_cpp_makefile_star2_O3/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 $0xc8, %rsp
movl %r9d, 0x18(%rsp)
movq %r8, %r15
movq %rcx, %r12
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
movslq %edx, %r13
leaq 0xb0(%rsp), %rdi
leaq 0x58(%rsp), %rdx
movq %r13, %rsi
callq 0x4f9e
leaq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %r13, %rsi
callq 0x7074
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %r13, %rsi
callq 0x7074
movq 0x58(%rsp), %rcx
movq $0x0, (%rcx)
movl %r14d, %ebp
cmpl $0x1, %r14d
movq %r14, 0x8(%rsp)
jle 0x6bfa
movq %rbx, %rax
xorl %edx, %edx
divq %r13
movl $0x1, %esi
movabsq $0x2000000100003e01, %rdx # imm = 0x2000000100003E01
movq %rax, %rdi
imulq %rsi, %rdi
movq %rdi, (%rcx,%rsi,8)
cmpq %rbx, %rdi
ja 0x6b9a
movq 0x10(%rsp), %r8
movzbl (%r8,%rdi), %r8d
cmpq $0x3d, %r8
ja 0x6b85
btq %r8, %rdx
jb 0x6b96
cmpl $0x7d, %r8d
je 0x6b96
cmpl $0x7b, %r8d
je 0x6b96
incq %rdi
jmp 0x6b6a
movq %rdi, (%rcx,%rsi,8)
incq %rsi
cmpq %rbp, %rsi
jne 0x6b5f
leal -0x1(%r14), %eax
movq %r14, %rsi
movq 0x40(%rsp), %r14
cmpl $0x2, %esi
jl 0x6c03
movl %eax, %esi
xorl %edi, %edi
movq 0x8(%rcx,%rdi,8), %r8
movq %r8, (%r14,%rdi,8)
cmpq %rbx, %r8
ja 0x6bf0
movq 0x10(%rsp), %r9
movzbl (%r9,%r8), %r9d
cmpq $0x3d, %r9
ja 0x6bdb
btq %r9, %rdx
jb 0x6bec
cmpl $0x7d, %r9d
je 0x6bec
cmpl $0x7b, %r9d
je 0x6bec
incq %r8
jmp 0x6bc0
movq %r8, (%r14,%rdi,8)
incq %rdi
cmpq %rsi, %rdi
jne 0x6bb7
jmp 0x6c03
leal -0x1(%r14), %eax
movq 0x40(%rsp), %r14
leaq 0x1(%rbx), %rcx
cltq
movq %rcx, (%r14,%rax,8)
shrq $0x3d, %rcx
leaq 0x8(,%rbx,8), %rax
xorl %edi, %edi
negq %rcx
sbbq %rdi, %rdi
orq %rax, %rdi
callq 0x2040
movq %r12, 0x98(%rsp)
movq %r15, 0xa0(%rsp)
movq %rax, 0x28(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %r13, %rsi
callq 0x7074
callq 0x2230
movq 0x8(%rsp), %r14
testl %r14d, %r14d
jle 0x6dae
movq %r13, %r15
leaq (,%rbp,8), %r14
xorl %r13d, %r13d
leaq 0x78(%rsp), %r12
leaq 0x70(%rsp), %rbx
cmpb $0x0, 0x18(%rsp)
je 0x6cf0
movq 0x58(%rsp), %rcx
movq (%rcx,%r13), %rax
addq %r13, %rcx
movq 0x10(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x38(%rsp)
movq 0x40(%rsp), %rdx
movq (%rdx,%r13), %rdx
subq %rax, %rdx
movq %rdx, 0x78(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rax
addq %r13, %rax
movq %rax, 0x30(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x424(%rip), %rsi       # 0x7102
leaq 0x38(%rsp), %rdx
movq %r12, %r8
movq %rbx, %r9
callq 0x7566
jmp 0x6d59
movq 0x58(%rsp), %rcx
movq (%rcx,%r13), %rax
addq %r13, %rcx
movq 0x10(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x38(%rsp)
movq 0x40(%rsp), %rdx
movq (%rdx,%r13), %rdx
subq %rax, %rdx
movq %rdx, 0x78(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rax
addq %r13, %rax
movq %rax, 0x30(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x8cb(%rip), %rsi       # 0x7614
leaq 0x38(%rsp), %rdx
movq %r12, %r8
movq %rbx, %r9
callq 0x7566
movq 0xb0(%rsp), %rax
cmpq $0x0, (%rax,%r13)
jne 0x6ff1
movq 0x20(%rsp), %rcx
movq %rcx, (%rax,%r13)
addq $0x8, %r13
cmpq %r13, %r14
jne 0x6c7e
movq 0x8(%rsp), %r14
testl %r14d, %r14d
movq %r15, %r13
jle 0x6dae
shlq $0x3, %rbp
xorl %ebx, %ebx
movq 0xb0(%rsp), %rdi
addq %rbx, %rdi
callq 0x22a0
addq $0x8, %rbx
cmpq %rbx, %rbp
jne 0x6d95
callq 0x2230
testl %r14d, %r14d
je 0x6f65
movq 0x80(%rsp), %rcx
movq 0x58(%rsp), %rdx
movq $-0x4, %rsi
movq $-0x5, 0x18(%rsp)
movq 0x28(%rsp), %r8
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %eax, %eax
xorl %ebx, %ebx
movq %r13, 0xa8(%rsp)
movq %rcx, 0x8(%rsp)
cmpq $0x0, (%rcx,%r12,8)
je 0x6f4b
xorl %r13d, %r13d
movq (%rdx,%r12,8), %rbp
addq %r13, %rbp
movq (%r8,%rbp,8), %r10
testb $0x1, %r10b
jne 0x6e26
testl %eax, %eax
jne 0x6e26
movq %r10, (%r8,%rbx,8)
incq %rbx
xorl %ebp, %ebp
jmp 0x6f3a
movq %rdx, %rcx
testl %eax, %eax
sete %r9b
movq %r10, %r15
shrq $0x20, %r15
movq 0x10(%rsp), %rdx
movb (%rdx,%r15), %r11b
andb %r10b, %r9b
cmpb $0x22, %r11b
sete %dl
testb %dl, %r9b
movl $0x1, %edi
cmovnel %edi, %r14d
cmovneq %rbp, %rsi
cmpb $0x23, %r11b
movl %r14d, %ebp
movl $0x2, %edi
cmovel %edi, %ebp
testb %r9b, %r9b
cmovel %r14d, %ebp
cmpl $0x1, %eax
sete %r9b
andb %r10b, %r9b
cmpb $0x5c, %r11b
sete %r14b
testb %r14b, %r9b
movl $0x3, %edi
cmovnel %edi, %ebp
movq 0x18(%rsp), %rdi
cmovneq %r15, %rdi
movq %rdi, 0x18(%rsp)
andb %dl, %r9b
movl $0x0, %edx
cmovnel %edx, %ebp
cmpb $0x1, %r9b
jne 0x6edd
movq %rsi, %rdi
movq (%r8,%rsi,8), %rdx
movq %rdx, %r9
shrq $0x20, %r9
movq %r15, %r14
subq %r9, %r14
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
andq %rsi, %rdx
leaq (%rdx,%r14,8), %rdx
addq $0x8, %rdx
movq %rdx, (%r8,%rbx,8)
incq %rbx
jmp 0x6ee0
movq %rsi, %rdi
cmpl $0x3, %eax
sete %dl
andb %r10b, %dl
movq 0x18(%rsp), %rsi
leaq 0x1(%rsi), %r9
cmpq %r9, %r15
setne %r9b
andb %dl, %r9b
movzbl %r9b, %r9d
subq %r9, %r13
testb %dl, %dl
movl $0x1, %edx
cmovnel %edx, %ebp
testb $0x1, %r10b
je 0x6f2c
cmpl $0x2, %eax
jne 0x6f2c
movzbl %r11b, %eax
xorl %r14d, %r14d
testl %eax, %eax
je 0x6f28
cmpl $0xa, %eax
jne 0x6f2c
xorl %ebp, %ebp
jmp 0x6f2f
movl %ebp, %r14d
movq %rcx, %rdx
movq 0x8(%rsp), %rcx
movq %rdi, %rsi
incq %r13
movl %ebp, %eax
cmpq (%rcx,%r12,8), %r13
jb 0x6e03
jmp 0x6f4d
movl %eax, %ebp
incq %r12
movl %ebp, %eax
movq 0xa8(%rsp), %r13
cmpq %r13, %r12
jne 0x6df5
jmp 0x6f67
xorl %ebx, %ebx
callq 0x2230
movq 0x28(%rsp), %rax
movq 0x98(%rsp), %rcx
movq %rax, (%rcx)
movq 0xa0(%rsp), %rax
movq %rbx, (%rax)
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x6fa4
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x6fbb
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x6fd2
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0xb0(%rsp), %rdi
callq 0x62ce
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2070
movq %rax, %rbx
jmp 0x702e
movq %rax, %rbx
jmp 0x7038
movq %rax, %rbx
jmp 0x7048
movq %rax, %rbx
jmp 0x705f
jmp 0x700e
jmp 0x700e
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x702e
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x40(%rsp), %r14
testq %r14, %r14
je 0x7048
movq 0x50(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x21a0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x705f
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0xb0(%rsp), %rdi
callq 0x62ce
movq %rbx, %rdi
callq 0x22c0