// File: /workspace/github_cpp_makefile_star2_O1/bluesky466[P]ResourcesParser/ResourcesParser.cpp
// Function: ResourcesParser::parserResStringPool(std::basic_ifstream<char, std::char_traits<char>>&)
ResourcesParser::ResStringPoolPtr ResourcesParser::parserResStringPool(
		ifstream& resources) {
	ResStringPoolPtr pPool = make_shared<ResStringPool>();
	resources.read((char*)&pPool->header, sizeof(ResStringPool_header));
	if(pPool->header.header.type != RES_STRING_POOL_TYPE) {
		cout<<"parserResStringPool 需要定位到 RES_STRING_POOL_TYPE !"<<endl;
		return nullptr;
	}

	pPool->pOffsets = shared_ptr<uint32_t>(
			new uint32_t[pPool->header.stringCount],
			default_delete<uint32_t[]>()
	);

	const uint32_t offsetSize = sizeof(uint32_t) * pPool->header.stringCount;
	resources.read((char*)pPool->pOffsets.get(), offsetSize);

	// 跳到字符串数组开头位置
	uint32_t seek = pPool->header.stringsStart
		- pPool->header.header.headerSize
		- offsetSize;
	resources.seekg(seek, ios::cur);

	// 载入所有字符串
	const uint32_t strBuffSize = pPool->header.styleCount > 0
		? pPool->header.stylesStart - pPool->header.stringsStart
		: pPool->header.header.size - pPool->header.stringsStart;
	pPool->pStrings = shared_ptr<byte>(
			new byte[strBuffSize],
			default_delete<byte[]>()
	);
	resources.read((char*)pPool->pStrings.get(), strBuffSize);

	// 跳出全局字符串池
	if(pPool->header.styleCount > 0) {
		seek = pPool->header.header.size
			- pPool->header.stringsStart
			- strBuffSize;
		resources.seekg(seek, ios::cur);
	}

	return pPool;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rdi, %r14
movl $0x50, %edi
callq 0x3200
movq %rax, %rbx
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%rbx)
leaq 0x82c1(%rip), %rax      # 0xebb8
movq %rax, (%rbx)
leaq 0x10(%rbx), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movl $0x1c, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x3250
cmpw $0x1, (%r12)
jne 0x6a39
movl 0x18(%rbx), %edi
shlq $0x2, %rdi
callq 0x3030
leaq -0x38(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x82b2
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq 0x38(%rbx), %rdi
movups %xmm0, 0x30(%rbx)
testq %rdi, %rdi
je 0x6966
callq 0x3dfa
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x6974
callq 0x3dfa
movl 0x18(%rbx), %r13d
shll $0x2, %r13d
movq 0x30(%rbx), %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x3250
movl 0x24(%rbx), %esi
movzwl 0x12(%rbx), %eax
addl %eax, %r13d
subl %r13d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x3270
leaq 0x28(%rbx), %rax
movq %rbx, %rcx
addq $0x14, %rcx
cmpl $0x0, 0x1c(%rbx)
cmovneq %rax, %rcx
movl (%rcx), %r13d
subl 0x24(%rbx), %r13d
movq %r13, %rdi
callq 0x3030
leaq -0x38(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x839a
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq 0x48(%rbx), %rdi
movups %xmm0, 0x40(%rbx)
testq %rdi, %rdi
je 0x69f4
callq 0x3dfa
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x6a02
callq 0x3dfa
movq 0x40(%rbx), %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x3250
cmpl $0x0, 0x1c(%rbx)
je 0x6a2e
movl 0x14(%rbx), %esi
addl 0x24(%rbx), %r13d
subl %r13d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x3270
movq %r12, (%r14)
movq %rbx, 0x8(%r14)
xorl %ebx, %ebx
jmp 0x6a86
movq 0x8598(%rip), %r15      # 0xefd8
leaq 0x4862(%rip), %rsi      # 0xb2a9
movl $0x3a, %edx
movq %r15, %rdi
callq 0x3230
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq 0x8566(%rip), %rdi      # 0xefd8
callq 0x3040
movq %rax, %rdi
callq 0x3130
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
testq %rbx, %rbx
je 0x6a93
movq %rbx, %rdi
callq 0x3dfa
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6aaf
jmp 0x6aaf
jmp 0x6aaf
jmp 0x6aaf
jmp 0x6aaf
movq %rax, %r14
movq %rbx, %rdi
callq 0x3dfa
movq %r14, %rdi
callq 0x3340