// File: ksabry[P]bfbrute/src/ProgramSearch.h
// Function: ProgramSearch<ProgramIterator<400ul, 32ul, 12ul, 32ul>, DataCache<32ul, 12ul>>::LoadFindStringProgress()
bool LoadFindStringProgress()
	{
		std::cout << "Attempting to load progress file" << std::endl;

		lock.lock();

		std::string filename = Filename();
		std::ifstream file(filename);

		if (!file.good())
		{
			std::cout << "No progress file found; starting from size " << SIZE_START << std::endl;
			file.close();
			lock.unlock();
			return false;
		}

		int64_t elapsed;

		file >> programSize;
		file >> elapsed;
		sizeStart = std::chrono::system_clock::now() - std::chrono::seconds(elapsed);

		std::cout << "Progress file found; resuming size " << programSize << " (0/" << THREAD_COUNT << " loaded)\r" << std::flush;

		for (uint_fast32_t thread_idx = 0; thread_idx < THREAD_COUNT; thread_idx++)
		{
			if (!iterators[thread_idx].Deserialize(file))
			{
				std::cout << "Failed to load progress file; starting from size " << SIZE_START << std::endl;
				file.close();
				lock.unlock();
				return false;
			}
			std::cout << "Progress file found; resuming size " << programSize << " (" << thread_idx + 1 << "/" << THREAD_COUNT << " loaded)\r" << std::flush;
		}

		std::cout << std::endl;
		file.close();
		lock.unlock();
		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x280(%rbp)
movq 0x1062f(%rip), %rdi     # 0x1bfd0
leaq 0x783a(%rip), %rsi      # 0x131e2
callq 0x32a0
movq %rax, %rdi
movq 0x10601(%rip), %rsi     # 0x1bfb8
callq 0x32d0
leaq 0x1091d(%rip), %rdi     # 0x1c2e0
callq 0xc060
movq -0x280(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0xc090
movq -0x278(%rbp), %rsi
leaq -0x238(%rbp), %rdi
movl $0x8, %edx
callq 0x3460
jmp 0xb9f9
movq -0x238(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x238(%rbp,%rax), %rdi
callq 0x34a0
movb %al, -0x281(%rbp)
jmp 0xba19
movb -0x281(%rbp), %al
testb $0x1, %al
jne 0xbadd
jmp 0xba29
movq 0x105a0(%rip), %rdi     # 0x1bfd0
leaq 0x77cc(%rip), %rsi      # 0x13203
callq 0x32a0
movq %rax, -0x290(%rbp)
jmp 0xba45
movq -0x290(%rbp), %rdi
movl $0x10, %esi
callq 0x34c0
movq %rax, -0x298(%rbp)
jmp 0xba5f
movq -0x298(%rbp), %rdi
movq 0x1054b(%rip), %rsi     # 0x1bfb8
callq 0x32d0
jmp 0xba74
leaq -0x238(%rbp), %rdi
callq 0x3050
jmp 0xba82
leaq 0x10857(%rip), %rdi     # 0x1c2e0
callq 0xc7f0
jmp 0xba90
movb $0x0, -0x1(%rbp)
movl $0x1, -0x248(%rbp)
jmp 0xbe1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0xbe40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x3080
jmp 0xbe40
movq -0x280(%rbp), %rsi
addq $0x85a20, %rsi          # imm = 0x85A20
leaq -0x238(%rbp), %rdi
callq 0x33b0
jmp 0xbaf9
leaq -0x238(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x3140
jmp 0xbb0e
callq 0x3030
movq %rax, -0x260(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0xc860
jmp 0xbb2f
leaq -0x260(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0xc810
movq %rax, -0x2a0(%rbp)
jmp 0xbb4b
movq -0x280(%rbp), %rax
movq -0x2a0(%rbp), %rcx
movq %rcx, -0x258(%rbp)
movq -0x258(%rbp), %rcx
movq %rcx, 0x85a30(%rax)
movq 0x1045b(%rip), %rdi     # 0x1bfd0
leaq 0x76b3(%rip), %rsi      # 0x1322f
callq 0x32a0
movq %rax, -0x2a8(%rbp)
jmp 0xbb8a
movq -0x2a8(%rbp), %rdi
movq -0x280(%rbp), %rax
movq 0x85a20(%rax), %rsi
callq 0x3060
movq %rax, -0x2b0(%rbp)
jmp 0xbbad
movq -0x2b0(%rbp), %rdi
leaq 0x7698(%rip), %rsi      # 0x13253
callq 0x32a0
movq %rax, -0x2b8(%rbp)
jmp 0xbbc9
movq -0x2b8(%rbp), %rdi
movl $0x10, %esi
callq 0x34c0
movq %rax, -0x2c0(%rbp)
jmp 0xbbe3
movq -0x2c0(%rbp), %rdi
leaq 0x7667(%rip), %rsi      # 0x13258
callq 0x32a0
movq %rax, -0x2c8(%rbp)
jmp 0xbbff
movq -0x2c8(%rbp), %rdi
movq 0x103cb(%rip), %rsi     # 0x1bfd8
callq 0x32d0
jmp 0xbc14
movq $0x0, -0x270(%rbp)
cmpq $0x10, -0x270(%rbp)
jae 0xbdde
movq -0x280(%rbp), %rax
movq -0x270(%rbp), %rcx
imulq $0x4578, %rcx, %rcx     # imm = 0x4578
leaq 0x401f8(%rax,%rcx), %rdi
leaq -0x238(%rbp), %rsi
callq 0xc880
movb %al, -0x2c9(%rbp)
jmp 0xbc5e
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0xbce4
jmp 0xbc6a
movq 0x1035f(%rip), %rdi     # 0x1bfd0
leaq 0x75ea(%rip), %rsi      # 0x13262
callq 0x32a0
movq %rax, -0x2d8(%rbp)
jmp 0xbc86
movq -0x2d8(%rbp), %rdi
movl $0x10, %esi
callq 0x34c0
movq %rax, -0x2e0(%rbp)
jmp 0xbca0
movq -0x2e0(%rbp), %rdi
movq 0x1030a(%rip), %rsi     # 0x1bfb8
callq 0x32d0
jmp 0xbcb5
leaq -0x238(%rbp), %rdi
callq 0x3050
jmp 0xbcc3
leaq 0x10616(%rip), %rdi     # 0x1c2e0
callq 0xc7f0
jmp 0xbcd1
movb $0x0, -0x1(%rbp)
movl $0x1, -0x248(%rbp)
jmp 0xbe1d
movq 0x102e5(%rip), %rdi     # 0x1bfd0
leaq 0x753d(%rip), %rsi      # 0x1322f
callq 0x32a0
movq %rax, -0x2e8(%rbp)
jmp 0xbd00
movq -0x2e8(%rbp), %rdi
movq -0x280(%rbp), %rax
movq 0x85a20(%rax), %rsi
callq 0x3060
movq %rax, -0x2f0(%rbp)
jmp 0xbd23
movq -0x2f0(%rbp), %rdi
leaq 0x7563(%rip), %rsi      # 0x13294
callq 0x32a0
movq %rax, -0x2f8(%rbp)
jmp 0xbd3f
movq -0x2f8(%rbp), %rdi
movq -0x270(%rbp), %rsi
incq %rsi
callq 0x3060
movq %rax, -0x300(%rbp)
jmp 0xbd5e
movq -0x300(%rbp), %rdi
leaq 0x74ea(%rip), %rsi      # 0x13256
callq 0x32a0
movq %rax, -0x308(%rbp)
jmp 0xbd7a
movq -0x308(%rbp), %rdi
movl $0x10, %esi
callq 0x34c0
movq %rax, -0x310(%rbp)
jmp 0xbd94
movq -0x310(%rbp), %rdi
leaq 0x74b6(%rip), %rsi      # 0x13258
callq 0x32a0
movq %rax, -0x318(%rbp)
jmp 0xbdb0
movq -0x318(%rbp), %rdi
movq 0x1021a(%rip), %rsi     # 0x1bfd8
callq 0x32d0
jmp 0xbdc5
jmp 0xbdc7
movq -0x270(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x270(%rbp)
jmp 0xbc1f
movq 0x101eb(%rip), %rdi     # 0x1bfd0
movq 0x101cc(%rip), %rsi     # 0x1bfb8
callq 0x32d0
jmp 0xbdf3
leaq -0x238(%rbp), %rdi
callq 0x3050
jmp 0xbe01
leaq 0x104d8(%rip), %rdi     # 0x1c2e0
callq 0xc7f0
jmp 0xbe0f
movb $0x1, -0x1(%rbp)
movl $0x1, -0x248(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x3080
leaq -0x30(%rbp), %rdi
callq 0x3160
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x3160
movq -0x240(%rbp), %rdi
callq 0x34d0
nopw %cs:(%rax,%rax)
nop