// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movq %rdx, -0x48(%rbp)
movq %rsi, %r15
movq %rdi, %rbx
movl 0x34(%rsi), %esi
movl 0x38(%r15), %edx
leaq -0x1e8(%rbp), %rdi
callq 0x7df6
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movq %rbx, -0x40(%rbp)
movups %xmm0, (%rbx)
cmpl $0x2, 0x4(%r15)
jl 0x8657
movl 0x5c(%r15), %eax
jmp 0x865a
pushq $0x1
popq %rax
movl %eax, -0x30(%rbp)
movl 0x44(%r15), %eax
movl %eax, -0x34(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rdx
movslq 0x40(%r15), %rsi
addq %rdx, %rsi
addq 0x8(%rax), %rdx
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x78(%rbp), %rdi
callq 0x997a
leaq -0x370(%rbp), %rbx
leaq -0x78(%rbp), %rsi
pushq $0x18
popq %rdx
movq %rbx, %rdi
callq 0x3380
leaq -0xa0(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
leaq -0x58(%rbp), %rcx
movq %rbx, (%rcx)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
xorl %eax, %eax
leaq -0x138(%rbp), %rbx
leaq -0x160(%rbp), %r14
leaq -0xa8(%rbp), %r13
leaq -0x2c(%rbp), %r12
movl %eax, -0x2c(%rbp)
cmpl -0x34(%rbp), %eax
jge 0x8748
movl 0x34(%r15), %edx
movl 0x38(%r15), %ecx
movq %r14, %rdi
leaq -0x58(%rbp), %rsi
callq 0x9b0e
movslq -0x154(%rbp), %rsi
movq -0x48(%rbp), %rax
addq (%rax), %rsi
movslq -0x150(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x9c28
movq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x9c42
movq %r13, %rdi
movq %r12, %rsi
callq 0x9c80
movq %rax, %rdi
movq %r14, %rsi
callq 0x9cd2
movq %r14, %rdi
callq 0x9d5e
movl -0x2c(%rbp), %eax
incl %eax
jmp 0x86db
cmpl $0x2, -0x30(%rbp)
jl 0x87e8
decl -0x30(%rbp)
xorl %eax, %eax
leaq -0x160(%rbp), %r13
leaq -0x58(%rbp), %rbx
leaq -0xa8(%rbp), %r14
leaq -0x2c(%rbp), %r12
cmpl -0x30(%rbp), %eax
je 0x87e8
movl %eax, -0x4c(%rbp)
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
cmpl -0x34(%rbp), %eax
jge 0x87e1
movl 0x34(%r15), %edx
movl 0x38(%r15), %ecx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x9b0e
movslq -0x154(%rbp), %rsi
movq -0x48(%rbp), %rax
addq (%rax), %rsi
movslq -0x150(%rbp), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %rdi
callq 0x9c28
movq %r14, %rdi
movq %r12, %rsi
callq 0x9c80
addq $0x90, %rax
movq %rax, %rdi
movq %r13, %rsi
callq 0x9c42
movq %r13, %rdi
callq 0x9d5e
movl -0x2c(%rbp), %eax
incl %eax
jmp 0x8777
movl -0x4c(%rbp), %eax
incl %eax
jmp 0x876d
leaq -0xa8(%rbp), %rdi
callq 0xb078
leaq -0x1e8(%rbp), %rbx
movq %rbx, %rdi
callq 0x9d98
leaq -0x370(%rbp), %rdi
callq 0x3170
leaq -0x78(%rbp), %rdi
callq 0x30f0
movq %rbx, %rdi
callq 0x8154
movq -0x40(%rbp), %rax
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x8874
movq %rax, %rbx
jmp 0x887d
jmp 0x884d
jmp 0x8846
jmp 0x884d
movq %rax, %rbx
jmp 0x885c
jmp 0x884d
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x9d5e
leaq -0xa8(%rbp), %rdi
callq 0xb078
leaq -0x370(%rbp), %rdi
callq 0x3170
leaq -0x78(%rbp), %rdi
callq 0x30f0
movq -0x40(%rbp), %rdi
callq 0x8d4e
leaq -0x1e8(%rbp), %rdi
callq 0x8154
movq %rbx, %rdi
callq 0x33f0