// File: /workspace/github_cpp_makefile_star2_O3/bluesky466[P]ResourcesParser/ResourcesParser.cpp
// Function: ResourcesParser::ResourcesParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
ResourcesParser::ResourcesParser(const string& filePath) {
	ifstream resources(filePath, ios::in|ios::binary);

	// resources文件开头是个ResTable_header,记录整个文件的信息
	resources.read((char*)&mResourcesInfo, sizeof(ResTable_header));

	// 紧接着就是全局字符串池
	mGlobalStringPool = parserResStringPool(resources);
	if(mGlobalStringPool == nullptr) {
		return;
	}

	for(int i = 0 ; i < mResourcesInfo.packageCount ; i++) {
		PackageResourcePtr pResource = parserPackageResource(resources);
		if(pResource == nullptr) {
			return;
		}
		mResourceForId[pResource->header.id] = pResource;
		mResourceForPackageName[toUtf8((char16_t*)pResource->header.name)] = pResource;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
leaq 0x20(%rdi), %rax
movq %rax, -0x48(%rbp)
leaq 0x28(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movq %rax, 0x40(%rdi)
movq %rcx, 0x48(%rdi)
leaq 0x50(%rdi), %rax
movq %rax, -0x50(%rbp)
leaq 0x58(%rdi), %rax
movl %ecx, 0x58(%rdi)
movq %rcx, 0x60(%rdi)
movq %rax, 0x68(%rdi)
movq %rax, 0x70(%rdi)
movups %xmm0, 0x78(%rdi)
movups %xmm0, 0x88(%rdi)
leaq -0x2f8(%rbp), %rdi
movl $0xc, %edx
movq %r12, -0x40(%rbp)
callq 0x32d0
leaq -0x2f8(%rbp), %rdi
movl $0xc, %edx
movq %r12, %rsi
callq 0x3240
leaq -0xf0(%rbp), %rdi
leaq -0x2f8(%rbp), %rdx
callq 0x682e
movq -0xf0(%rbp), %rax
movq -0xe8(%rbp), %rcx
movq %rax, 0x10(%r12)
movq 0x18(%r12), %rdi
movq %rcx, 0x18(%r12)
testq %rdi, %rdi
je 0x65c6
leaq 0x10(%r12), %r14
callq 0x3ddc
movq (%r14), %rax
testq %rax, %rax
je 0x6764
cmpl $0x0, 0x8(%r12)
je 0x6764
leaq -0x60(%rbp), %r15
xorl %r14d, %r14d
leaq -0x38(%rbp), %rdi
movq %r12, %rsi
leaq -0x2f8(%rbp), %rdx
callq 0x6a2c
movq -0x38(%rbp), %rsi
testq %rsi, %rsi
je 0x6756
addq $0x8, %rsi
movq -0x50(%rbp), %rdi
callq 0x7530
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x773c
movq -0x38(%rbp), %rdx
leaq 0xc(%rdx), %rsi
movq %r15, -0x70(%rbp)
addq $0xa, %rdx
cmpw $0x0, 0x2(%rdx)
leaq 0x2(%rdx), %rdx
jne 0x6636
movq %r15, %rbx
leaq -0x70(%rbp), %rdi
callq 0x7c66
movq -0x70(%rbp), %r15
movq -0x68(%rbp), %r12
movl $0x20, %edi
callq 0x31f0
xorl %edx, %edx
movl %edx, 0x8(%rax)
movq $0x10ffff, 0x10(%rax)   # imm = 0x10FFFF
movl %edx, 0x18(%rax)
leaq 0x850a(%rip), %rcx      # 0xeb80
movq %rcx, (%rax)
movq %rax, -0xf0(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq %rdx, -0xe0(%rbp)
movb $0x0, -0xd8(%rbp)
leaq -0xb8(%rbp), %rcx
movq %rcx, -0xc8(%rbp)
movq %rdx, -0xc0(%rbp)
movw %dx, -0xb8(%rbp)
movw %dx, 0x40(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
leaq (%r15,%r12,2), %rcx
leaq -0x90(%rbp), %r12
movq %r12, %rdi
leaq -0xf0(%rbp), %r13
movq %r13, %rsi
movq %r15, %rdx
callq 0x77ec
movq %r13, %rdi
callq 0x7786
movq -0x48(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %r15
movq -0x40(%rbp), %r12
callq 0x7598
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x773c
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x672a
callq 0x31c0
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x6738
callq 0x31c0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x6746
callq 0x3ddc
incl %r14d
cmpl 0x8(%r12), %r14d
jb 0x65e2
jmp 0x6764
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x6764
callq 0x3ddc
leaq -0x2f8(%rbp), %rdi
callq 0x3070
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x67de
jmp 0x67de
movq %rax, %r14
jmp 0x67ed
movq %rax, %r14
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x67c0
callq 0x31c0
jmp 0x67c0
jmp 0x67b8
movq %rax, %r14
leaq -0xf0(%rbp), %rdi
callq 0x7786
jmp 0x67c0
movq %rax, %r14
jmp 0x67ce
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0x67ce
callq 0x31c0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x67e1
callq 0x3ddc
jmp 0x67e1
movq %rax, %r14
leaq -0x2f8(%rbp), %rdi
callq 0x3070
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rdi
testq %rdi, %rdi
je 0x6802
callq 0x31c0
movq -0x50(%rbp), %rdi
callq 0x3d76
movq -0x48(%rbp), %rdi
callq 0x3e48
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
testq %rdi, %rdi
je 0x6826
callq 0x3ddc
movq %r14, %rdi
callq 0x3330