// File: /workspace/github_cpp_makefile_star2_O3/hey-yahei[P]ConvNet/src/helper.cpp
// Function: LoadFromSparseHuffmanFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char*, TarFile*)
unsigned long LoadFromSparseHuffmanFile(string prefix, char* dst, TarFile* tarfile) {
	string data_path = prefix + ".data";
	string index_path = prefix + ".index";

	vector<unsigned char> index, data;
	LoadFromHuffmanFile(index_path, index, tarfile);
	LoadFromHuffmanFile(data_path, data, tarfile);
	unsigned long size = index.size();
	if (size != data.size()) {
		cerr << "LoadFromSparseHuffmanFile: size not match" << endl;
		exit(1);
	}

	index[0]--;
	for (int i = 0; i < size; i++) {
		dst += index[i];
		*dst = data[i];
	}
	return size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x90(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %r12
movq %r12, %rdi
callq 0x4e84
leaq 0x19e9(%rip), %rsi      # 0x63bf
movq %r12, %rdi
callq 0x2310
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x4e84
leaq 0x19c4(%rip), %rsi      # 0x63c5
leaq -0x80(%rbp), %rdi
callq 0x2310
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
xorl %eax, %eax
movq %rax, -0x30(%rbp)
movq %rax, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
leaq -0xd0(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x4e84
leaq -0xe0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq %r14, %rdx
callq 0x478e
movq -0xe0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4a6f
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x21b0
leaq -0xb0(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x4e84
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movq %r14, %rdx
callq 0x478e
movq -0xc0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4ac5
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x21b0
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %r14
subq %rax, %r14
movq -0x58(%rbp), %rdx
subq -0x60(%rbp), %rdx
cmpq %rdx, %r14
jne 0x4b84
decb (%rax)
movq -0x60(%rbp), %rdi
cmpq %rax, %rcx
je 0x4b19
movq -0x40(%rbp), %rax
cmpq $0x1, %r14
movq %r14, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
movzbl (%rax,%rdx), %esi
movb (%rdi,%rdx), %r8b
movb %r8b, (%rbx,%rsi)
addq %rsi, %rbx
incq %rdx
cmpq %rdx, %rcx
jne 0x4b00
jmp 0x4b1e
testq %rdi, %rdi
je 0x4b2a
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4b3f
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4b54
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21b0
movq -0xa0(%rbp), %rdi
cmpq %r13, %rdi
je 0x4b6f
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %r14, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4465(%rip), %rdi      # 0x8ff0
leaq 0x183a(%rip), %rsi      # 0x63cc
movl $0x29, %edx
callq 0x21e0
movq 0x444d(%rip), %rdi      # 0x8ff0
callq 0x20d0
movl $0x1, %edi
callq 0x2210
jmp 0x4bf8
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4bfb
movq -0xb0(%rbp), %rsi
jmp 0x4be2
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4bfb
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x21b0
jmp 0x4bfb
movq %rax, %rbx
jmp 0x4c25
jmp 0x4bf3
movq %rax, %rbx
jmp 0x4c3a
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x4c10
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4c25
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4c3a
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21b0
movq -0xa0(%rbp), %rdi
cmpq %r13, %rdi
je 0x4c55
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x22e0