// File: /workspace/github_c_makefile_star2_O0/0x3f00[P]PhotonCpp/./PhotonFileLayer.h
// Function: PhotonFileLayer::readLayers(PhotonFileHeader const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
static std::vector<PhotonFileLayer> readLayers(const PhotonFileHeader & photonFileHeader_, const std::string & fileContent, int margin/*, IPhotonProgress & iPhotonProgress*/) {
        PhotonLayer photonLayer(photonFileHeader_.getResolutionX(), photonFileHeader_.getResolutionY());

		std::vector<PhotonFileLayer> layers;

        int antiAliasLevel = 1;
        if (photonFileHeader_.getVersion() > 1) {
            antiAliasLevel = photonFileHeader_.getAntiAliasingLevel();
        }

        int layerCount = photonFileHeader_.getNumberOfLayers();

		std::string data(fileContent.begin() + photonFileHeader_.getLayersDefinitionOffsetAddress(), fileContent.end());
		std::stringstream ss(data);
		PhotonInputStream ds(ss);
		
		{
            std::map<int, PhotonFileLayer> layerMap;
            for (int i = 0; i < layerCount; i++) {

                //iPhotonProgress.showInfo("Reading photon file layer " + (i + 1) + "/" + photonFileHeader_.getNumberOfLayers());

                PhotonFileLayer layer(ds, photonFileHeader_.getResolutionX(), photonFileHeader_.getResolutionY());
                layer.imageData_.assign(fileContent.begin() + layer.dataAddress_, fileContent.begin() + layer.dataAddress_ + layer.dataSize_);
                layers.push_back(layer);
                layerMap[i] = layer;
            }

            if (antiAliasLevel > 1) {
                for (int a = 0; a < (antiAliasLevel - 1); a++) {
                    for (int i = 0; i < layerCount; i++) {
                        //iPhotonProgress.showInfo("Reading photon file AA " + (2 + a) + "/" + antiAliasLevel + " layer " + (i + 1) + "/" + photonFileHeader_.getNumberOfLayers());

                        PhotonFileLayer layer(ds, photonFileHeader_.getResolutionX(), photonFileHeader_.getResolutionY());
                        layer.imageData_.assign(fileContent.begin() + layer.dataAddress_, fileContent.begin() + layer.dataAddress_ + layer.dataSize_);

                        layerMap[i].addAntiAliasLayer(layer);
                    }
                }
            }
        }

        photonLayer.unLink();
        //System.gc();

        return layers;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rdi, -0x498(%rbp)
movq %rdi, %rax
movq %rax, -0x4a8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12ac0
movl %eax, -0x49c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12ae0
movl -0x49c(%rbp), %esi
movl %eax, %edx
leaq -0xa8(%rbp), %rdi
callq 0xbaf0
movq -0x498(%rbp), %rdi
movb $0x0, -0xa9(%rbp)
callq 0x12b00
movl $0x1, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
callq 0xcae0
cmpl $0x1, %eax
jle 0xcfc8
movq -0x10(%rbp), %rdi
callq 0xd6c0
movl %eax, -0x4ac(%rbp)
jmp 0xcfa3
movl -0x4ac(%rbp), %eax
movl %eax, -0xb0(%rbp)
jmp 0xcfc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0xd4e3
movq -0x10(%rbp), %rdi
callq 0xd6e0
movl %eax, -0x4b0(%rbp)
jmp 0xcfd9
movl -0x4b0(%rbp), %eax
movl %eax, -0xc0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x32c0
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12b20
movl %eax, -0x4b4(%rbp)
jmp 0xd006
movl -0x4b4(%rbp), %eax
movslq %eax, %rsi
leaq -0xf0(%rbp), %rdi
callq 0x11ed0
movq %rax, -0xe8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x35b0
movq %rax, -0xf8(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x3580
movq -0x4c0(%rbp), %rcx
movq -0xe8(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
callq 0x11f10
jmp 0xd068
leaq -0xf9(%rbp), %rdi
callq 0x3330
movl $0x10, %edi
movl $0x8, %esi
callq 0x11790
movl %eax, %edx
leaq -0x288(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x34d0
jmp 0xd09a
leaq -0x290(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x117b0
jmp 0xd0af
leaq -0x2c0(%rbp), %rdi
callq 0x12b40
movl $0x0, -0x2c4(%rbp)
movl -0x2c4(%rbp), %eax
cmpl -0xc0(%rbp), %eax
jge 0xd2a3
movq -0x10(%rbp), %rdi
callq 0x12ac0
movl %eax, -0x4c4(%rbp)
jmp 0xd0e8
movq -0x10(%rbp), %rdi
callq 0x12ae0
movl %eax, -0x4c8(%rbp)
jmp 0xd0f9
movl -0x4c8(%rbp), %ecx
movl -0x4c4(%rbp), %edx
leaq -0x380(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x12b60
jmp 0xd11a
leaq -0x358(%rbp), %rax
movq %rax, -0x4d0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x32c0
movq %rax, -0x390(%rbp)
movslq -0x374(%rbp), %rsi
leaq -0x390(%rbp), %rdi
callq 0x11ed0
movq %rax, -0x388(%rbp)
movq -0x18(%rbp), %rdi
callq 0x32c0
movq %rax, -0x3a8(%rbp)
movslq -0x374(%rbp), %rsi
leaq -0x3a8(%rbp), %rdi
callq 0x11ed0
movq %rax, -0x3a0(%rbp)
movslq -0x370(%rbp), %rsi
leaq -0x3a0(%rbp), %rdi
callq 0x11ed0
movq -0x4d0(%rbp), %rdi
movq %rax, -0x398(%rbp)
movq -0x388(%rbp), %rsi
movq -0x398(%rbp), %rdx
callq 0x12d00
jmp 0xd1b2
movq -0x498(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x12d80
jmp 0xd1c7
leaq -0x2c0(%rbp), %rdi
leaq -0x2c4(%rbp), %rsi
callq 0x12df0
movq %rax, -0x4d8(%rbp)
jmp 0xd1e3
movq -0x4d8(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x12ed0
jmp 0xd1f8
leaq -0x380(%rbp), %rdi
callq 0x12fb0
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c4(%rbp)
jmp 0xd0c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xf9(%rbp), %rdi
callq 0x3330
jmp 0xd4e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0xd4ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0xd4a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0xd495
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x12fb0
jmp 0xd495
cmpl $0x1, -0xb0(%rbp)
jle 0xd451
movl $0x0, -0x3ac(%rbp)
movl -0x3ac(%rbp), %eax
movl -0xb0(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xd44f
movl $0x0, -0x3b0(%rbp)
movl -0x3b0(%rbp), %eax
cmpl -0xc0(%rbp), %eax
jge 0xd439
movq -0x10(%rbp), %rdi
callq 0x12ac0
movl %eax, -0x4dc(%rbp)
jmp 0xd2fe
movq -0x10(%rbp), %rdi
callq 0x12ae0
movl %eax, -0x4e0(%rbp)
jmp 0xd30f
movl -0x4e0(%rbp), %ecx
movl -0x4dc(%rbp), %edx
leaq -0x468(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x12b60
jmp 0xd330
leaq -0x440(%rbp), %rax
movq %rax, -0x4e8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x32c0
movq %rax, -0x478(%rbp)
movslq -0x45c(%rbp), %rsi
leaq -0x478(%rbp), %rdi
callq 0x11ed0
movq %rax, -0x470(%rbp)
movq -0x18(%rbp), %rdi
callq 0x32c0
movq %rax, -0x490(%rbp)
movslq -0x45c(%rbp), %rsi
leaq -0x490(%rbp), %rdi
callq 0x11ed0
movq %rax, -0x488(%rbp)
movslq -0x458(%rbp), %rsi
leaq -0x488(%rbp), %rdi
callq 0x11ed0
movq -0x4e8(%rbp), %rdi
movq %rax, -0x480(%rbp)
movq -0x470(%rbp), %rsi
movq -0x480(%rbp), %rdx
callq 0x12d00
jmp 0xd3c8
leaq -0x2c0(%rbp), %rdi
leaq -0x3b0(%rbp), %rsi
callq 0x12df0
movq %rax, -0x4f0(%rbp)
jmp 0xd3e4
movq -0x4f0(%rbp), %rdi
leaq -0x468(%rbp), %rsi
callq 0x13000
jmp 0xd3f9
leaq -0x468(%rbp), %rdi
callq 0x12fb0
movl -0x3b0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3b0(%rbp)
jmp 0xd2db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x12fb0
jmp 0xd495
jmp 0xd43b
movl -0x3ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3ac(%rbp)
jmp 0xd2ba
jmp 0xd451
leaq -0x2c0(%rbp), %rdi
callq 0x13030
leaq -0xa8(%rbp), %rdi
callq 0x13050
jmp 0xd46b
movb $0x1, -0xa9(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x3230
leaq -0xe0(%rbp), %rdi
callq 0x31b0
testb $0x1, -0xa9(%rbp)
jne 0xd4c7
jmp 0xd4bb
leaq -0x2c0(%rbp), %rdi
callq 0x13030
leaq -0x288(%rbp), %rdi
callq 0x3230
leaq -0xe0(%rbp), %rdi
callq 0x31b0
jmp 0xd4e3
movq -0x498(%rbp), %rdi
callq 0xdeb0
leaq -0xa8(%rbp), %rdi
callq 0xc160
movq -0x4a8(%rbp), %rax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
movq -0x498(%rbp), %rdi
callq 0xdeb0
leaq -0xa8(%rbp), %rdi
callq 0xc160
movq -0xb8(%rbp), %rdi
callq 0x3570
nopw (%rax,%rax)