// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq -0x28(%rbp), %r15
movq %r15, %rdi
callq 0x636b
movq (%r15), %rsi
pushq $0x1c
popq %rdx
movq %r14, %rdi
callq 0x3230
movq -0x28(%rbp), %rax
cmpw $0x1, (%rax)
jne 0x5a22
movl 0x8(%rax), %edi
shlq $0x2, %rdi
callq 0x3030
leaq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x72fe
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7482
leaq -0x30(%rbp), %rdi
callq 0x3ac4
movq -0x28(%rbp), %rax
movl 0x8(%rax), %r15d
shll $0x2, %r15d
movq 0x20(%rax), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x3230
movq -0x28(%rbp), %rax
movl 0x14(%rax), %esi
movzwl 0x2(%rax), %eax
addl %eax, %r15d
subl %r15d, %esi
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x3260
movq -0x28(%rbp), %rax
leaq 0x18(%rax), %rcx
leaq 0x4(%rax), %rdx
cmpl $0x0, 0xc(%rax)
cmoveq %rdx, %rcx
movl (%rcx), %r15d
subl 0x14(%rax), %r15d
movq %r15, %rdi
callq 0x3030
leaq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x74bc
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7646
leaq -0x30(%rbp), %rdi
callq 0x3ac4
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x3230
movq -0x28(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x5a0b
movl 0x4(%rax), %esi
addl 0x14(%rax), %r15d
subl %r15d, %esi
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x3260
movq -0x28(%rbp), %rax
movq %rax, (%rbx)
movq -0x20(%rbp), %rax
andq $0x0, -0x20(%rbp)
movq %rax, 0x8(%rbx)
andq $0x0, -0x28(%rbp)
jmp 0x5a43
movq 0x95af(%rip), %rdi      # 0xefd8
leaq 0x4841(%rip), %rsi      # 0xa271
callq 0x31e0
movq %rax, %rdi
callq 0x30d0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq -0x20(%rbp), %rdi
callq 0x3ac4
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5a64
jmp 0x5a64
jmp 0x5a64
jmp 0x5a64
jmp 0x5a64
movq %rax, %rbx
leaq -0x20(%rbp), %rdi
callq 0x3ac4
movq %rbx, %rdi
callq 0x3340