// File: /workspace/github_c_makefile_star2_O0/0x3f00[P]PhotonCpp/PhotonCpp.cpp
// Function: main
int main(int argc, char * argv[])
{
	if (argc != 3)
	{
		std::cerr << "\nUsage: PngToPhoton <input-1440x2560.png> <output.photon>\n"
		"To read data from STDIN use '-' as filename.\n"
		"To write data to STDOUT use '-' as filename.\n\n"
		"White and transparent areas of the image are treated as voids.\n"
		"Check with Photon File Validator after conversion. Use output at your own risk.\n";
		return -1;
	}

#ifdef WIN32
	_setmode(_fileno(stdout), _O_BINARY);
	_setmode(_fileno(stdin), _O_BINARY);
#endif // WIN32

	std::string bufferModel = getModel();

	PhotonFileHeader photonFileHeader(bufferModel);
	PhotonFilePreview previewOne(photonFileHeader.getPreviewOneOffsetAddress(), bufferModel);
	PhotonFilePreview previewTwo(photonFileHeader.getPreviewTwoOffsetAddress(), bufferModel);
	
	PhotonFilePrintParameters photonFilePrintParameters;
	if (photonFileHeader.getVersion() > 1) 
	{
		PhotonFilePrintParameters dummy(photonFileHeader.getPrintParametersOffsetAddress(), bufferModel);
		photonFilePrintParameters = std::move(dummy);
	}

	int margin = 0;
	
	std::vector<PhotonFileLayer> layers = PhotonFileLayer::readLayers(photonFileHeader, bufferModel, margin);

//	PhotonFileLayer::calculateLayers(photonFileHeader,layers, 0);

	// load png
	std::string bufferPng;
	
	if (std::string("-") == argv[1])
	{
		std::string tmp(std::istreambuf_iterator<char>(std::cin), {});
		bufferPng = std::move(tmp);
	}
	else
	{
		std::ifstream ifPng(argv[1], std::ios_base::binary);

		if (ifPng.fail())
		{
			std::cerr << "Error opening input file.\n";
			return -1;
		}

		ifPng.seekg(0, std::ios::end);
		std::streamoff size = 0;
		size = ifPng.tellg();
		bufferPng.resize((unsigned int)size);
		ifPng.seekg(0);
		ifPng.read(&bufferPng[0], size);
		ifPng.close();
	}

	std::pair<std::string, PhotonLayer> rle = png2layer(bufferPng);
	if (!rle.first.empty())
	{
		std::cerr << rle.first << "\n";
		return -1;
	}

	PhotonLayer & layerPng = rle.second;
	int antiAliasLevel = 1;
	if (photonFileHeader.getVersion() > 1) {
		antiAliasLevel = photonFileHeader.getAntiAliasingLevel();
	}

	for (int i = 0; i < photonFileHeader.getNumberOfLayers(); i++) {
		PhotonFileLayer & layer = layers.at(i);
		layer.saveLayer(layerPng);
		if (antiAliasLevel > 1) {
			for (int a = 0; a < (antiAliasLevel - 1); a++) {
				layer.getAntiAlias(a).saveLayer(layerPng);
			}
		}
	}




	// writing is here:
	int headerPos = 0;
	int previewOnePos = headerPos + photonFileHeader.getByteSize();
	int previewTwoPos = previewOnePos + previewOne.getByteSize();
	int layerDefinitionPos = previewTwoPos + previewTwo.getByteSize();

	int parametersPos = 0;
	if (photonFileHeader.getVersion() > 1) {
		parametersPos = layerDefinitionPos;
		layerDefinitionPos = parametersPos + photonFilePrintParameters.getByteSize();
	}

	int dataPosition = layerDefinitionPos + (PhotonFileLayer::getByteSize() * photonFileHeader.getNumberOfLayers() * antiAliasLevel);


	std::ofstream ofs;
	if (std::string("-") != argv[2])
	{
		ofs.open(argv[2], std::ios_base::binary);
		if (ofs.fail())
		{
			std::cerr << "Error opening output file.\n";
			return -1;
		}
	}

	PhotonOutputStream os( std::string("-") != argv[2] ? ofs : std::cout);
	photonFileHeader.save(os, previewOnePos, previewTwoPos, layerDefinitionPos, parametersPos);
	previewOne.save(os, previewOnePos);
	previewTwo.save(os, previewTwoPos);

	if (photonFileHeader.getVersion() > 1) {
		photonFilePrintParameters.save(os);
	}

	// Optimize order for speed read on photon
	for (int i = 0; i < photonFileHeader.getNumberOfLayers(); i++) {
		PhotonFileLayer & layer = layers.at(i);
		dataPosition = layer.savePos(dataPosition);
		if (antiAliasLevel > 1) {
			for (int a = 0; a < (antiAliasLevel - 1); a++) {
				dataPosition = layer.getAntiAlias(a).savePos(dataPosition);
			}
		}
	}

	// Order for backward compatibility with photon/cbddlp version 1
	for (int i = 0; i < photonFileHeader.getNumberOfLayers(); i++) {
		layers.at(i).save(os);
	}

	if (antiAliasLevel > 1) {
		for (int a = 0; a < (antiAliasLevel - 1); a++) {
			for (int i = 0; i < photonFileHeader.getNumberOfLayers(); i++) {
				layers.at(i).getAntiAlias(a).save(os);
			}
		}
	}

	// Optimize order for speed read on photon
	for (int i = 0; i < photonFileHeader.getNumberOfLayers(); i++) {
		PhotonFileLayer & layer = layers.at(i);
		layer.saveData(os);
		if (antiAliasLevel > 1) {
			for (int a = 0; a < (antiAliasLevel - 1); a++) {
				layer.getAntiAlias(a).saveData(os);
			}
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x980, %rsp            # imm = 0x980
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
je 0x502e
movq 0x21fda(%rip), %rdi     # 0x26ff0
leaq 0x16a8c(%rip), %rsi     # 0x1baa9
callq 0x32e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5f4e
leaq -0x30(%rbp), %rdi
movq %rdi, -0x840(%rbp)
callq 0x4ed0
movq -0x840(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xc1c0
jmp 0x5053
leaq -0xa0(%rbp), %rdi
callq 0xc6c0
movl %eax, -0x844(%rbp)
jmp 0x5067
movl -0x844(%rbp), %esi
leaq -0x100(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xc6e0
jmp 0x507f
leaq -0xa0(%rbp), %rdi
callq 0xca40
movl %eax, -0x848(%rbp)
jmp 0x5093
movl -0x848(%rbp), %esi
leaq -0x150(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xc6e0
jmp 0x50ab
leaq -0x18c(%rbp), %rdi
callq 0xca60
leaq -0xa0(%rbp), %rdi
callq 0xcae0
movl %eax, -0x84c(%rbp)
jmp 0x50cb
movl -0x84c(%rbp), %eax
cmpl $0x1, %eax
jle 0x5165
leaq -0xa0(%rbp), %rdi
callq 0xcb00
movl %eax, -0x850(%rbp)
jmp 0x50ee
movl -0x850(%rbp), %esi
leaq -0x1c8(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xcb20
jmp 0x5106
leaq -0x18c(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
movl $0x3c, %edx
callq 0x3260
jmp 0x5165
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5f43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5f37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5f2b
movl $0x0, -0x1cc(%rbp)
movl -0x1cc(%rbp), %ecx
leaq -0x1e8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xcf10
jmp 0x518e
leaq -0x208(%rbp), %rdi
callq 0x3420
leaq -0x229(%rbp), %rdi
movq %rdi, -0x858(%rbp)
callq 0x3580
movq -0x858(%rbp), %rdx
leaq 0x16a13(%rip), %rsi     # 0x1bbce
leaq -0x228(%rbp), %rdi
callq 0x3400
jmp 0x51c9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x228(%rbp), %rdi
callq 0xd510
movb %al, -0x859(%rbp)
jmp 0x51e5
leaq -0x228(%rbp), %rdi
callq 0x31b0
leaq -0x229(%rbp), %rdi
callq 0x3330
movb -0x859(%rbp), %al
testb $0x1, %al
jne 0x520c
jmp 0x5304
movq 0x21dc5(%rip), %rsi     # 0x26fd8
leaq -0x260(%rbp), %rdi
callq 0xd540
leaq -0x270(%rbp), %rdi
callq 0xd5a0
leaq -0x271(%rbp), %rdi
movq %rdi, -0x868(%rbp)
callq 0x3580
movq -0x868(%rbp), %r9
movq -0x260(%rbp), %rsi
movl -0x258(%rbp), %edx
movq -0x270(%rbp), %rcx
movl -0x268(%rbp), %r8d
leaq -0x250(%rbp), %rdi
callq 0xd5d0
jmp 0x526e
leaq -0x271(%rbp), %rdi
callq 0x3330
leaq -0x208(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x3380
leaq -0x250(%rbp), %rdi
callq 0x31b0
jmp 0x54dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x52d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x31b0
leaq -0x229(%rbp), %rdi
callq 0x3330
jmp 0x5f13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x271(%rbp), %rdi
callq 0x3330
jmp 0x5f13
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x480(%rbp), %rdi
movl $0x4, %edx
callq 0x35a0
jmp 0x531f
movq -0x480(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x480(%rbp,%rax), %rdi
callq 0x3040
movb %al, -0x869(%rbp)
jmp 0x533f
movb -0x869(%rbp), %al
testb $0x1, %al
jne 0x534b
jmp 0x53b0
movq 0x21c9e(%rip), %rdi     # 0x26ff0
leaq 0x16877(%rip), %rsi     # 0x1bbd0
callq 0x32e0
jmp 0x5360
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x484(%rbp)
jmp 0x54be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5f13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x30e0
jmp 0x5f13
xorl %eax, %eax
movl %eax, %esi
leaq -0x480(%rbp), %rdi
movl $0x2, %edx
callq 0x33f0
jmp 0x53c7
movq $0x0, -0x490(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x3550
movq %rdx, -0x880(%rbp)
movq %rax, -0x878(%rbp)
jmp 0x53ee
movq -0x880(%rbp), %rax
movq -0x878(%rbp), %rcx
movq %rcx, -0x4a0(%rbp)
movq %rax, -0x498(%rbp)
leaq -0x4a0(%rbp), %rdi
callq 0xd660
movq %rax, -0x888(%rbp)
jmp 0x541f
movq -0x888(%rbp), %rax
movq %rax, -0x490(%rbp)
movl -0x490(%rbp), %eax
movl %eax, %esi
leaq -0x208(%rbp), %rdi
callq 0x3410
jmp 0x5443
xorl %eax, %eax
movl %eax, %esi
leaq -0x4b0(%rbp), %rdi
callq 0xd680
jmp 0x5455
movq -0x4b0(%rbp), %rsi
movq -0x4a8(%rbp), %rdx
leaq -0x480(%rbp), %rdi
callq 0x33b0
jmp 0x5471
xorl %eax, %eax
movl %eax, %esi
leaq -0x208(%rbp), %rdi
callq 0x3600
movq %rax, -0x890(%rbp)
jmp 0x548a
movq -0x890(%rbp), %rsi
movq -0x490(%rbp), %rdx
leaq -0x480(%rbp), %rdi
callq 0x33a0
jmp 0x54a6
leaq -0x480(%rbp), %rdi
callq 0x30c0
jmp 0x54b4
movl $0x0, -0x484(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x30e0
movl -0x484(%rbp), %eax
testl %eax, %eax
jne 0x5ed8
jmp 0x54da
jmp 0x54dc
leaq -0x558(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x4ac0
jmp 0x54f1
leaq -0x558(%rbp), %rdi
callq 0x3530
testb $0x1, %al
jne 0x555f
movq 0x21ae8(%rip), %rdi     # 0x26ff0
leaq -0x558(%rbp), %rsi
callq 0x32a0
movq %rax, -0x898(%rbp)
jmp 0x551d
movq -0x898(%rbp), %rdi
leaq 0x166be(%rip), %rsi     # 0x1bbe9
callq 0x32e0
jmp 0x5532
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x484(%rbp)
jmp 0x5ebc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5eca
leaq -0x538(%rbp), %rax
movq %rax, -0x560(%rbp)
movl $0x1, -0x564(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xcae0
movl %eax, -0x89c(%rbp)
jmp 0x558b
movl -0x89c(%rbp), %eax
cmpl $0x1, %eax
jle 0x55b6
leaq -0xa0(%rbp), %rdi
callq 0xd6c0
movl %eax, -0x8a0(%rbp)
jmp 0x55aa
movl -0x8a0(%rbp), %eax
movl %eax, -0x564(%rbp)
movl $0x0, -0x568(%rbp)
movl -0x568(%rbp), %eax
movl %eax, -0x8a8(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x8a4(%rbp)
jmp 0x55e0
movl -0x8a8(%rbp), %eax
movl -0x8a4(%rbp), %ecx
cmpl %ecx, %eax
jge 0x56b4
movslq -0x568(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0xd700
movq %rax, -0x8b0(%rbp)
jmp 0x5610
movq -0x8b0(%rbp), %rax
movq %rax, -0x570(%rbp)
movq -0x570(%rbp), %rdi
movq -0x560(%rbp), %rsi
callq 0xd740
jmp 0x5633
cmpl $0x1, -0x564(%rbp)
jle 0x569e
movl $0x0, -0x574(%rbp)
movl -0x574(%rbp), %eax
movl -0x564(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x569c
movq -0x570(%rbp), %rdi
movl -0x574(%rbp), %esi
callq 0xd7f0
movq %rax, -0x8b8(%rbp)
jmp 0x5674
movq -0x8b8(%rbp), %rdi
movq -0x560(%rbp), %rsi
callq 0xd740
jmp 0x5689
jmp 0x568b
movl -0x574(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x574(%rbp)
jmp 0x5646
jmp 0x569e
jmp 0x56a0
movl -0x568(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x568(%rbp)
jmp 0x55c0
movl $0x0, -0x578(%rbp)
movl -0x578(%rbp), %eax
movl %eax, -0x8c0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd820
movl %eax, -0x8bc(%rbp)
jmp 0x56de
movl -0x8bc(%rbp), %ecx
movl -0x8c0(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x57c(%rbp)
movl -0x57c(%rbp), %eax
movl %eax, -0x8c8(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xd850
movl %eax, -0x8c4(%rbp)
jmp 0x5712
movl -0x8c4(%rbp), %ecx
movl -0x8c8(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x580(%rbp)
movl -0x580(%rbp), %eax
movl %eax, -0x8d0(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xd850
movl %eax, -0x8cc(%rbp)
jmp 0x5746
movl -0x8cc(%rbp), %ecx
movl -0x8d0(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x584(%rbp)
movl $0x0, -0x588(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xcae0
movl %eax, -0x8d4(%rbp)
jmp 0x5778
movl -0x8d4(%rbp), %eax
cmpl $0x1, %eax
jle 0x57c3
movl -0x584(%rbp), %eax
movl %eax, -0x588(%rbp)
movl -0x588(%rbp), %eax
movl %eax, -0x8dc(%rbp)
leaq -0x18c(%rbp), %rdi
callq 0xd870
movl %eax, -0x8d8(%rbp)
jmp 0x57af
movl -0x8d8(%rbp), %ecx
movl -0x8dc(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x584(%rbp)
movl -0x584(%rbp), %eax
movl %eax, -0x8e4(%rbp)
callq 0xd880
movl %eax, -0x8e0(%rbp)
jmp 0x57dc
leaq -0xa0(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x8e8(%rbp)
jmp 0x57f0
movl -0x8e4(%rbp), %eax
movl -0x8e8(%rbp), %edx
movl -0x8e0(%rbp), %ecx
imull %edx, %ecx
movl -0x564(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x58c(%rbp)
leaq -0x790(%rbp), %rdi
callq 0x3540
jmp 0x5824
leaq -0x7b1(%rbp), %rdi
movq %rdi, -0x8f0(%rbp)
callq 0x3580
movq -0x8f0(%rbp), %rdx
leaq 0x16389(%rip), %rsi     # 0x1bbce
leaq -0x7b0(%rbp), %rdi
callq 0x3400
jmp 0x5853
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x7b0(%rbp), %rdi
callq 0xd890
movb %al, -0x8f1(%rbp)
jmp 0x586f
leaq -0x7b0(%rbp), %rdi
callq 0x31b0
leaq -0x7b1(%rbp), %rdi
callq 0x3330
movb -0x8f1(%rbp), %al
testb $0x1, %al
jne 0x5896
jmp 0x5967
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x790(%rbp), %rdi
movl $0x4, %edx
callq 0x3080
jmp 0x58b1
movq -0x790(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x790(%rbp,%rax), %rdi
callq 0x3040
movb %al, -0x8f2(%rbp)
jmp 0x58d1
movb -0x8f2(%rbp), %al
testb $0x1, %al
jne 0x58e0
jmp 0x5965
movq 0x21709(%rip), %rdi     # 0x26ff0
leaq 0x162fd(%rip), %rsi     # 0x1bbeb
callq 0x32e0
jmp 0x58f5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x484(%rbp)
jmp 0x5ea0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x593d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x7b0(%rbp), %rdi
callq 0x31b0
leaq -0x7b1(%rbp), %rdi
callq 0x3330
jmp 0x5eae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5eae
jmp 0x5967
leaq -0x7e1(%rbp), %rdi
movq %rdi, -0x900(%rbp)
callq 0x3580
movq -0x900(%rbp), %rdx
leaq 0x16246(%rip), %rsi     # 0x1bbce
leaq -0x7e0(%rbp), %rdi
callq 0x3400
jmp 0x5996
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x7e0(%rbp), %rdi
callq 0xd890
movb %al, -0x901(%rbp)
jmp 0x59b2
movb -0x901(%rbp), %al
testb $0x1, %al
jne 0x59be
jmp 0x59ce
leaq -0x790(%rbp), %rax
movq %rax, -0x910(%rbp)
jmp 0x59de
movq 0x215f3(%rip), %rax     # 0x26fc8
movq %rax, -0x910(%rbp)
jmp 0x59de
movq -0x910(%rbp), %rsi
leaq -0x7c0(%rbp), %rdi
callq 0xd8c0
jmp 0x59f3
leaq -0x7e0(%rbp), %rdi
callq 0x31b0
leaq -0x7e1(%rbp), %rdi
callq 0x3330
movq -0x7c0(%rbp), %rax
movq %rax, -0x7f0(%rbp)
movl -0x57c(%rbp), %edx
movl -0x580(%rbp), %ecx
movl -0x584(%rbp), %r8d
movl -0x588(%rbp), %r9d
movq -0x7f0(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xd8e0
jmp 0x5a48
movq -0x7c0(%rbp), %rax
movq %rax, -0x7f8(%rbp)
movl -0x57c(%rbp), %edx
movq -0x7f8(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0xdb10
jmp 0x5a71
movq -0x7c0(%rbp), %rax
movq %rax, -0x800(%rbp)
movl -0x580(%rbp), %edx
movq -0x800(%rbp), %rsi
leaq -0x150(%rbp), %rdi
callq 0xdb10
jmp 0x5a9a
leaq -0xa0(%rbp), %rdi
callq 0xcae0
movl %eax, -0x914(%rbp)
jmp 0x5aae
movl -0x914(%rbp), %eax
cmpl $0x1, %eax
jle 0x5b13
leaq -0x18c(%rbp), %rdi
leaq -0x7c0(%rbp), %rsi
callq 0xdc10
jmp 0x5ace
jmp 0x5b13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x5b02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x7e0(%rbp), %rdi
callq 0x31b0
leaq -0x7e1(%rbp), %rdi
callq 0x3330
jmp 0x5eae
movl $0x0, -0x804(%rbp)
movl -0x804(%rbp), %eax
movl %eax, -0x91c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x918(%rbp)
jmp 0x5b3d
movl -0x91c(%rbp), %eax
movl -0x918(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5c31
movslq -0x804(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0xd700
movq %rax, -0x928(%rbp)
jmp 0x5b6d
movq -0x928(%rbp), %rax
movq %rax, -0x810(%rbp)
movq -0x810(%rbp), %rdi
movl -0x58c(%rbp), %esi
callq 0xdd30
movl %eax, -0x92c(%rbp)
jmp 0x5b95
movl -0x92c(%rbp), %eax
movl %eax, -0x58c(%rbp)
cmpl $0x1, -0x564(%rbp)
jle 0x5c1b
movl $0x0, -0x814(%rbp)
movl -0x814(%rbp), %eax
movl -0x564(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5c19
movq -0x810(%rbp), %rdi
movl -0x814(%rbp), %esi
callq 0xd7f0
movq %rax, -0x938(%rbp)
jmp 0x5be2
movq -0x938(%rbp), %rdi
movl -0x58c(%rbp), %esi
callq 0xdd30
movl %eax, -0x93c(%rbp)
jmp 0x5bfc
movl -0x93c(%rbp), %eax
movl %eax, -0x58c(%rbp)
movl -0x814(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x814(%rbp)
jmp 0x5bb4
jmp 0x5c1b
jmp 0x5c1d
movl -0x804(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x804(%rbp)
jmp 0x5b1d
movl $0x0, -0x818(%rbp)
movl -0x818(%rbp), %eax
movl %eax, -0x944(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x940(%rbp)
jmp 0x5c5b
movl -0x944(%rbp), %eax
movl -0x940(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5caf
movslq -0x818(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0xd700
movq %rax, -0x950(%rbp)
jmp 0x5c87
movq -0x950(%rbp), %rdi
leaq -0x7c0(%rbp), %rsi
callq 0xdd50
jmp 0x5c9c
jmp 0x5c9e
movl -0x818(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x818(%rbp)
jmp 0x5c3b
cmpl $0x1, -0x564(%rbp)
jle 0x5d91
movl $0x0, -0x81c(%rbp)
movl -0x81c(%rbp), %eax
movl -0x564(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5d8f
movl $0x0, -0x820(%rbp)
movl -0x820(%rbp), %eax
movl %eax, -0x958(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x954(%rbp)
jmp 0x5d07
movl -0x958(%rbp), %eax
movl -0x954(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5d79
movslq -0x820(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0xd700
movq %rax, -0x960(%rbp)
jmp 0x5d33
movq -0x960(%rbp), %rdi
movl -0x81c(%rbp), %esi
callq 0xd7f0
movq %rax, -0x968(%rbp)
jmp 0x5d4e
movq -0x968(%rbp), %rdi
leaq -0x7c0(%rbp), %rsi
callq 0xdd50
jmp 0x5d63
jmp 0x5d65
movl -0x820(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x820(%rbp)
jmp 0x5ce7
jmp 0x5d7b
movl -0x81c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x81c(%rbp)
jmp 0x5cc6
jmp 0x5d91
movl $0x0, -0x824(%rbp)
movl -0x824(%rbp), %eax
movl %eax, -0x970(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x96c(%rbp)
jmp 0x5dbb
movl -0x970(%rbp), %eax
movl -0x96c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5e8f
movslq -0x824(%rbp), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0xd700
movq %rax, -0x978(%rbp)
jmp 0x5deb
movq -0x978(%rbp), %rax
movq %rax, -0x830(%rbp)
movq -0x830(%rbp), %rdi
leaq -0x7c0(%rbp), %rsi
callq 0xde00
jmp 0x5e0e
cmpl $0x1, -0x564(%rbp)
jle 0x5e79
movl $0x0, -0x834(%rbp)
movl -0x834(%rbp), %eax
movl -0x564(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5e77
movq -0x830(%rbp), %rdi
movl -0x834(%rbp), %esi
callq 0xd7f0
movq %rax, -0x980(%rbp)
jmp 0x5e4f
movq -0x980(%rbp), %rdi
leaq -0x7c0(%rbp), %rsi
callq 0xde00
jmp 0x5e64
jmp 0x5e66
movl -0x834(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x834(%rbp)
jmp 0x5e21
jmp 0x5e79
jmp 0x5e7b
movl -0x824(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x824(%rbp)
jmp 0x5d9b
movl $0x0, -0x4(%rbp)
movl $0x1, -0x484(%rbp)
leaq -0x790(%rbp), %rdi
callq 0x3450
jmp 0x5ebc
leaq -0x790(%rbp), %rdi
callq 0x3450
jmp 0x5eca
leaq -0x558(%rbp), %rdi
callq 0xde80
jmp 0x5ed8
leaq -0x558(%rbp), %rdi
callq 0xde80
jmp 0x5f13
leaq -0x208(%rbp), %rdi
callq 0x31b0
leaq -0x1e8(%rbp), %rdi
callq 0xdeb0
leaq -0x150(%rbp), %rdi
callq 0xdf10
leaq -0x100(%rbp), %rdi
callq 0xdf10
leaq -0x30(%rbp), %rdi
callq 0x31b0
jmp 0x5f4e
leaq -0x208(%rbp), %rdi
callq 0x31b0
leaq -0x1e8(%rbp), %rdi
callq 0xdeb0
leaq -0x150(%rbp), %rdi
callq 0xdf10
leaq -0x100(%rbp), %rdi
callq 0xdf10
leaq -0x30(%rbp), %rdi
callq 0x31b0
jmp 0x5f5a
movl -0x4(%rbp), %eax
addq $0x980, %rsp            # imm = 0x980
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x3570
nopw %cs:(%rax,%rax)