// File: /workspace/github_cpp_makefile_star2_O2/ClauParser[P]ClauParser/./include/clau_parser.h
// Function: clau_parser::LoadData::_LoadData(clau_parser::InFileReserver&, clau_parser::UserType&, int, int)
static bool _LoadData(InFileReserver& reserver, UserType& global, const int lex_thr_num, const int parse_num) // first, strVec.empty() must be true!!
		{
			const int pivot_num = parse_num - 1;
			char* buffer = nullptr;
			int64_t* token_arr = nullptr;
			size_t buffer_total_len;
			size_t token_arr_len = 0;

			{

				auto a = std::chrono::steady_clock::now();

				bool success = reserver(lex_thr_num, buffer, &buffer_total_len, token_arr, &token_arr_len);


				auto b = std::chrono::steady_clock::now();
				auto dur = std::chrono::duration_cast<std::chrono::milliseconds>(b - a);
				//std::cout << "scan " << dur.count() << "ms\n";

				//	{
				//		for (int64_t i = 0; i < token_arr_len; ++i) {
				//			std::string(buffer + Utility::GetIdx(token_arr[i]), Utility::GetLength(token_arr[i]));
			//				if (0 == Utility::GetIdx(token_arr[i])) {
				//				//std::cout << "chk";
				//			}
				//		}
				//	}

				if (!success) {
					return false;
				}
				if (token_arr_len <= 0) {
					if (buffer) {
						delete[] buffer;
					}
					if (token_arr) {
						delete[] token_arr;
					}
					return true;
				}
			}

			UserType* before_next = nullptr;
			UserType _global;

			{
				std::set<int64_t> _pivots;
				std::vector<int64_t> pivots;
				const int64_t num = token_arr_len; //

				if (pivot_num > 0) {
					std::vector<int64_t> pivot;
					pivots.reserve(pivot_num);
					pivot.reserve(pivot_num);

					for (int i = 0; i < pivot_num; ++i) {
						pivot.push_back(FindDivisionPlace(buffer, token_arr, (num / (pivot_num + 1)) * (i), (num / (pivot_num + 1)) * (i + 1) - 1));
					}

					for (size_t i = 0; i < pivot.size(); ++i) {
						if (pivot[i] != -1) {
							_pivots.insert(pivot[i]);
						}
					}

					for (auto& x : _pivots) {
						pivots.push_back(x);
					}
				}

				std::vector<UserType*> next(pivots.size() + 1, nullptr);

				{
					std::vector<UserType> __global(pivots.size() + 1);

					std::vector<std::thread> thr(pivots.size() + 1);
					std::vector<int> err(pivots.size() + 1, 0);
					{
						int64_t idx = pivots.empty() ? num - 1 : pivots[0];
						int64_t _token_arr_len = idx - 0 + 1;

						thr[0] = std::thread(__LoadData, buffer, token_arr, _token_arr_len, &__global[0], 0, 0, &next[0], &err[0]);
					}

					for (size_t i = 1; i < pivots.size(); ++i) {
						int64_t _token_arr_len = pivots[i] - (pivots[i - 1] + 1) + 1;

						thr[i] = std::thread(__LoadData, buffer, token_arr + pivots[i - 1] + 1, _token_arr_len, &__global[i], 0, 0, &next[i], &err[i]);

					}

					if (pivots.size() >= 1) {
						int64_t _token_arr_len = num - 1 - (pivots.back() + 1) + 1;

						thr[pivots.size()] = std::thread(__LoadData, buffer, token_arr + pivots.back() + 1, _token_arr_len, &__global[pivots.size()],
							0, 0, &next[pivots.size()], &err[pivots.size()]);
					}


					//	auto a = std::chrono::steady_clock::now();

						// wait
					for (size_t i = 0; i < thr.size(); ++i) {
						thr[i].join();
					}


					//	auto b = std::chrono::steady_clock::now();
					//	auto dur = std::chrono::duration_cast<std::chrono::milliseconds>(b - a);
						////std::cout << "parse1 " << dur.count() << "ms\n";

					for (size_t i = 0; i < err.size(); ++i) {
						switch (err[i]) {
						case 0:
							break;
						case -1:
						case -4:
							//std::cout << "Syntax Error\n";
							break;
						case -2:
							//std::cout << "error final state is not last_state!\n";
							break;
						case -3:
							//std::cout << "error x > buffer + buffer_len:\n";
							break;
						default:
							//std::cout << "unknown parser error\n";
							break;
						}
					}

					// Merge
					try {
						if (__global[0].GetUserTypeListSize() > 0 && __global[0].GetUserTypeList(0)->GetName() == "#") {
							//std::cout << "not valid file1\n";
							throw 1;
						}
						if (next.back()->GetParent() != nullptr) {
							//std::cout << "not valid file2\n";
							throw 2;
						}

						int err = Merge(&_global, &__global[0], &next[0]);
						if (-1 == err || (pivots.size() == 0 && 1 == err)) {
							//std::cout << "not valid file3\n";
							throw 3;
						}

						for (size_t i = 1; i < pivots.size() + 1; ++i) {
							// linearly merge and error check...
							int err = Merge(next[i - 1], &__global[i], &next[i]);
							if (-1 == err) {
								//std::cout << "not valid file4\n";
								throw 4;
							}
							else if (i == pivots.size() && 1 == err) {
								//std::cout << "not valid file5\n";
								throw 5;
							}
						}
					}
					catch (...) {
						if (reserver.use_file()) {
							delete[] buffer;
						}
						delete[] token_arr;
						buffer = nullptr;
						throw "in Merge, error";
					}

					before_next = next.back();

					//auto c = std::chrono::steady_clock::now();
					//auto dur2 = std::chrono::duration_cast<std::chrono::nanoseconds>(c - b);
					////std::cout << "parse2 " << dur2.count() << "ns\n";
				}
			}

			if (reserver.use_file()) {
				delete[] buffer;
			}
			delete[] token_arr;

			global = std::move(_global);
			//	chk(&global);
			return true;
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movl %ecx, %r12d
movl %edx, %ebx
movq %rsi, 0xe8(%rsp)
movq %rdi, %rbp
leaq 0x8(%rsp), %r14
andq $0x0, (%r14)
leaq 0x30(%rsp), %r15
andq $0x0, (%r15)
leaq 0xc8(%rsp), %r13
andq $0x0, (%r13)
callq 0x2260
leaq 0x120(%rsp), %rcx
movq %rbp, %rdi
movl %ebx, %esi
movq %r14, %rdx
movq %r15, %r8
movq %r13, %r9
callq 0x454a
movl %eax, %ebx
callq 0x2260
testb %bl, %bl
je 0x437f
cmpq $0x0, 0xc8(%rsp)
je 0x3dd0
leaq 0x53ee(%rip), %rsi      # 0x90b7
leaq 0xf0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x2a64
leaq 0x128(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x2f24
leaq 0xf0(%rsp), %rdi
callq 0x20d0
leaq 0xf8(%rsp), %r13
andl $0x0, (%r13)
andq $0x0, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
andq $0x0, 0x20(%r13)
andq $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x78(%rsp)
cmpl $0x2, %r12d
movq %rbp, 0xc0(%rsp)
movb %bl, 0x3(%rsp)
jl 0x3df7
leal -0x1(%r12), %eax
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x45ae
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x45ae
movl %r12d, %r12d
xorl %ebp, %ebp
leaq 0x40(%rsp), %r14
leaq 0x90(%rsp), %r15
cmpq %rbp, %rbx
je 0x3dff
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x78(%rsp), %rax
cqto
idivq %r12
movq %rax, %rdx
imulq %rbp, %rdx
incq %rbp
imulq %rbp, %rax
leaq -0x1(%rax), %rcx
callq 0x4644
movq %rax, 0x90(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6a62
jmp 0x3d8b
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3ddf
callq 0x2240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x437f
callq 0x2240
jmp 0x437f
pushq $0x1
popq %rsi
jmp 0x3e84
xorl %r14d, %r14d
leaq 0xf0(%rsp), %rbx
xorl %r15d, %r15d
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rax
subq %rsi, %rax
sarq $0x3, %rax
cmpq %rax, %r15
jae 0x3e3e
cmpq $-0x1, (%rsi,%r14)
je 0x3e35
addq %r14, %rsi
movq %rbx, %rdi
callq 0x6ba0
incq %r15
addq $0x8, %r14
jmp 0x3e0d
movq 0x108(%rsp), %r14
leaq 0x10(%rsp), %rbx
cmpq %r13, %r14
je 0x3e69
leaq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0x468e
movq %r14, %rdi
callq 0x2200
movq %rax, %r14
jmp 0x3e4b
leaq 0x40(%rsp), %rdi
callq 0x6dbe
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x90(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x40(%rsp), %rdi
leaq 0xa8(%rsp), %rcx
callq 0x46ae
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x90(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x4704
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0xa8(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x4756
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x70(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0xd0(%rsp), %rdi
leaq 0x68(%rsp), %rcx
callq 0x47a8
movq 0x10(%rsp), %rcx
movq 0x78(%rsp), %rax
cmpq 0x18(%rsp), %rcx
je 0x3f30
movq (%rcx), %rax
incq %rax
leaq 0x70(%rsp), %r8
movq %rax, (%r8)
movq 0x90(%rsp), %rax
leaq 0x58(%rsp), %rbx
andl $0x0, (%rbx)
leaq 0x4(%rsp), %r11
andl $0x0, (%r11)
leaq 0x88(%rsp), %r9
movq %rax, (%r9)
movq 0x40(%rsp), %rax
leaq 0x80(%rsp), %r10
movq %rax, (%r10)
movq 0xd0(%rsp), %rax
leaq 0x60(%rsp), %r14
movq %rax, (%r14)
leaq 0x87b(%rip), %rsi       # 0x47fe
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x30(%rsp), %rcx
pushq %r14
pushq %r10
pushq %r11
pushq %rbx
callq 0x5214
addq $0x20, %rsp
movq 0xa8(%rsp), %rdi
leaq 0x68(%rsp), %r12
movq %r12, %rsi
callq 0x52d0
movq %r12, %rdi
callq 0x52ea
pushq $0x1
popq %r14
leaq 0x88(%rsp), %rbx
leaq 0x70(%rsp), %rbp
leaq 0x80(%rsp), %r15
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
subq %rsi, %rdx
movq %rdx, %rax
sarq $0x3, %rax
cmpq %rax, %r14
jae 0x40c7
movq (%rsi,%r14,8), %rax
subq -0x8(%rsi,%r14,8), %rax
movq %rax, 0x70(%rsp)
movq 0x30(%rsp), %rax
movq -0x8(%rsi,%r14,8), %rcx
leaq (%rax,%rcx,8), %rax
addq $0x8, %rax
imulq $0xb0, %r14, %rcx
addq 0x90(%rsp), %rcx
leaq (,%r14,8), %r13
andl $0x0, 0x4(%rsp)
movq %rax, 0x88(%rsp)
andl $0x0, 0x3c(%rsp)
movq %rcx, 0x80(%rsp)
movq 0x40(%rsp), %rax
addq %r13, %rax
movq %rax, 0x60(%rsp)
leaq (,%r14,4), %rax
addq 0xd0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq %r12, %rdi
leaq 0x789(%rip), %rsi       # 0x47fe
leaq 0x8(%rsp), %rdx
movq %rbx, %rcx
movq %rbp, %r8
movq %r15, %r9
leaq 0x58(%rsp), %rax
pushq %rax
leaq 0x68(%rsp), %rax
pushq %rax
leaq 0x4c(%rsp), %rax
pushq %rax
leaq 0x1c(%rsp), %rax
pushq %rax
callq 0x52f8
addq $0x20, %rsp
addq 0xa8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x52d0
movq %r12, %rdi
callq 0x52ea
incq %r14
jmp 0x3fd8
cmpq %rsi, %rcx
je 0x419b
movq -0x8(%rcx), %rsi
notq %rsi
movq 0x78(%rsp), %rdi
addq %rsi, %rdi
leaq 0x70(%rsp), %r8
movq %rdi, (%r8)
movq 0x30(%rsp), %rsi
movq -0x8(%rcx), %rcx
leaq (%rsi,%rcx,8), %rsi
addq $0x8, %rsi
leaq 0x88(%rsp), %rcx
imulq $0xb0, %rax, %rdi
addq 0x90(%rsp), %rdi
movq %rsi, (%rcx)
andl $0x0, 0x4(%rsp)
leaq 0x80(%rsp), %r9
andl $0x0, 0x3c(%rsp)
movq %rdi, (%r9)
addq 0x40(%rsp), %rdx
movq %rdx, 0x60(%rsp)
shlq $0x2, %rax
addq 0xd0(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x6b5(%rip), %rsi       # 0x47fe
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x58(%rsp), %rax
pushq %rax
leaq 0x68(%rsp), %rax
pushq %rax
leaq 0x4c(%rsp), %rax
pushq %rax
leaq 0x1c(%rsp), %rax
pushq %rax
callq 0x52f8
addq $0x20, %rsp
movq 0x18(%rsp), %rdi
subq 0x10(%rsp), %rdi
addq 0xa8(%rsp), %rdi
leaq 0x68(%rsp), %rbx
movq %rbx, %rsi
callq 0x52d0
movq %rbx, %rdi
callq 0x52ea
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rax
subq %rdi, %rax
sarq $0x3, %rax
cmpq %rax, %r14
jae 0x41cd
addq %rbx, %rdi
callq 0x22e0
incq %r14
addq $0x8, %rbx
jmp 0x41a0
movq 0x90(%rsp), %rcx
movq 0x60(%rcx), %rax
cmpq %rax, 0x68(%rcx)
je 0x41fa
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x4f1c(%rip), %rsi      # 0x9109
callq 0x3c36
testb %al, %al
jne 0x43bb
movq 0x48(%rsp), %rax
movq -0x8(%rax), %rax
cmpq $0x0, 0x28(%rax)
jne 0x43b7
movq 0x90(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x128(%rsp), %rdi
xorl %ecx, %ecx
callq 0x53b4
cmpl $-0x1, %eax
je 0x4393
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
cmpq %rdx, %rcx
sete %sil
cmpl $0x1, %eax
sete %al
testb %sil, %al
jne 0x4393
pushq $0x8
popq %r14
pushq $0x1
popq %rsi
movl $0xb0, %r15d
pushq $0x4
popq %rbx
pushq $0x5
popq %rbp
subq %rdx, %rcx
sarq $0x3, %rcx
incq %rcx
cmpq %rcx, %rsi
jae 0x42e7
movq %rsi, %r12
movq 0x40(%rsp), %rdx
movq -0x8(%rdx,%r14), %rdi
addq %r14, %rdx
movq 0x90(%rsp), %rsi
addq %r15, %rsi
xorl %ecx, %ecx
callq 0x53b4
cmpl $-0x1, %eax
je 0x42cc
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
leaq 0x1(%r12), %rsi
addq $0x8, %r14
addq $0xb0, %r15
cmpl $0x1, %eax
jne 0x4266
movq %rcx, %rax
subq %rdx, %rax
sarq $0x3, %rax
cmpq %rax, %r12
jne 0x4266
movl %ebp, %ebx
pushq $0x4
popq %rdi
callq 0x20f0
movl %ebx, (%rax)
movq 0x9cd3(%rip), %rsi      # 0xdfb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x22f0
leaq 0xd0(%rsp), %rdi
callq 0x3b42
leaq 0xa8(%rsp), %rdi
callq 0x5580
leaq 0x90(%rsp), %rdi
callq 0x55a2
leaq 0x40(%rsp), %rdi
callq 0x338e
leaq 0x10(%rsp), %rdi
callq 0x6dbe
leaq 0xf0(%rsp), %rdi
callq 0x8ad6
movq 0xc0(%rsp), %rax
cmpq $0x0, (%rax)
je 0x434c
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x434c
callq 0x2240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x435b
callq 0x2240
leaq 0x128(%rsp), %rbx
movq 0xe8(%rsp), %rdi
movq %rbx, %rsi
callq 0x450a
movq %rbx, %rdi
callq 0x31a2
movb 0x3(%rsp), %bl
movl %ebx, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
popq %rdi
callq 0x20f0
movl $0x3, (%rax)
movq 0x9c08(%rip), %rsi      # 0xdfb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x22f0
jmp 0x449c
pushq $0x2
jmp 0x43bd
pushq $0x1
popq %rbx
pushq $0x4
popq %rdi
callq 0x20f0
movl %ebx, (%rax)
movq 0x9be1(%rip), %rsi      # 0xdfb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x22f0
jmp 0x4428
jmp 0x4428
movq %rax, %rbx
jmp 0x44b1
movq %rax, %rbx
jmp 0x44be
movq %rax, %rbx
jmp 0x44cb
movq %rax, %rbx
jmp 0x44d5
jmp 0x442d
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x20d0
jmp 0x44f9
movq %rax, %rbx
jmp 0x44f9
jmp 0x443f
jmp 0x443f
jmp 0x442d
jmp 0x442d
jmp 0x443f
jmp 0x4428
movq %rax, %rbx
jmp 0x44a4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x6dbe
jmp 0x44d5
movq %rax, %rdi
callq 0x20a0
movq 0xc0(%rsp), %rax
cmpq $0x0, (%rax)
je 0x4464
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4464
callq 0x2240
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4473
callq 0x2240
andq $0x0, 0x8(%rsp)
pushq $0x8
popq %rdi
callq 0x20f0
leaq 0x4cd1(%rip), %rcx      # 0x9159
movq %rcx, (%rax)
movq 0x9b2e(%rip), %rsi      # 0xdfc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x22f0
movq %rax, %rbx
callq 0x22d0
leaq 0xd0(%rsp), %rdi
callq 0x3b42
leaq 0xa8(%rsp), %rdi
callq 0x5580
leaq 0x90(%rsp), %rdi
callq 0x55a2
leaq 0x40(%rsp), %rdi
callq 0x338e
leaq 0x10(%rsp), %rdi
callq 0x6dbe
leaq 0xf0(%rsp), %rdi
callq 0x8ad6
leaq 0x128(%rsp), %rdi
callq 0x31a2
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0x3353
nop