// File: /workspace/github_c_makefile_star2_O1/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 0x8456
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, -0x40(%rbp)
movq $0x0, 0x10(%rbx)
cmpl $0x2, 0x4(%r15)
movl $0x1, -0x30(%rbp)
jl 0x8cd6
movl 0x5c(%r15), %eax
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 0xa24e
leaq -0x370(%rbp), %rbx
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
movl $0x18, %edx
callq 0x2350
movq %rbx, -0x50(%rbp)
leaq -0x158(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movl %ecx, -0x2c(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x8e92
leaq -0x108(%rbp), %r12
leaq -0xa0(%rbp), %r13
leaq -0x130(%rbp), %rbx
movl 0x34(%r15), %edx
movl 0x38(%r15), %ecx
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0xa3f2
movslq -0x124(%rbp), %rcx
movq -0x48(%rbp), %rax
addq (%rax), %rcx
movslq -0x120(%rbp), %r8
movq -0x100(%rbp), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x2220
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0xa504
leaq -0x160(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0xa542
movq %rax, %r14
movl -0x110(%rbp), %eax
movl %eax, 0x20(%r14)
movups -0x130(%rbp), %xmm0
movups -0x120(%rbp), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
leaq 0x28(%r14), %rdi
movq %r12, %rsi
callq 0x2120
leaq 0x48(%r14), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2120
leaq 0x68(%r14), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xb336
movups 0x58(%r12), %xmm0
movups %xmm0, 0x80(%r14)
movq %r14, %rdi
addq $0x90, %rdi
movq %r13, %rsi
callq 0xb48a
movq 0x80(%r12), %rax
movq 0x85(%r12), %rcx
movq %rcx, 0xad(%r14)
movq %rax, 0xa8(%r14)
movq %r13, %rdi
callq 0x95e8
leaq -0xc8(%rbp), %rdi
callq 0xa648
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x8e69
callq 0x21d0
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x8e81
callq 0x21d0
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
cmpl -0x34(%rbp), %eax
jl 0x8d59
cmpl $0x2, -0x30(%rbp)
jl 0x8f8f
addl $-0x2, -0x30(%rbp)
xorl %eax, %eax
leaq -0x130(%rbp), %r14
leaq -0x50(%rbp), %rbx
leaq -0x160(%rbp), %r12
leaq -0x2c(%rbp), %r13
movq %rax, -0x58(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x8f7f
movl 0x34(%r15), %edx
movl 0x38(%r15), %ecx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa3f2
movslq -0x124(%rbp), %rcx
movq -0x48(%rbp), %rax
addq (%rax), %rcx
movslq -0x120(%rbp), %r8
movq -0x100(%rbp), %rdx
leaq -0x108(%rbp), %rdi
xorl %esi, %esi
callq 0x2220
movq %r12, %rdi
movq %r13, %rsi
callq 0xa542
addq $0x90, %rax
movq %rax, %rdi
movq %r14, %rsi
callq 0xa504
leaq -0xa0(%rbp), %rdi
callq 0x95e8
leaq -0xc8(%rbp), %rdi
callq 0xa648
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x8f56
callq 0x21d0
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x8f6e
callq 0x21d0
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
cmpl -0x34(%rbp), %eax
jl 0x8ecd
movq -0x58(%rbp), %rcx
leal 0x1(%rcx), %eax
cmpl -0x30(%rbp), %ecx
jne 0x8eb8
leaq -0x160(%rbp), %rdi
callq 0xba6e
leaq -0x1e8(%rbp), %rdi
callq 0xa5f6
movq 0x8ffa(%rip), %rsi      # 0x11fa8
leaq -0x370(%rbp), %rdi
callq 0x2180
leaq -0x2f0(%rbp), %rdi
callq 0x20d0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x8fd8
callq 0x21d0
movq -0x178(%rbp), %rdi
testq %rdi, %rdi
je 0x8fe9
callq 0x21d0
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0x8ffa
callq 0x21d0
movq -0x1a8(%rbp), %rdi
testq %rdi, %rdi
je 0x900b
callq 0x21d0
movq -0x1c0(%rbp), %rdi
testq %rdi, %rdi
je 0x901c
callq 0x21d0
leaq -0x1d8(%rbp), %rdi
callq 0x96fa
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 0x908f
movq %rax, %rbx
jmp 0x90a1
jmp 0x904e
jmp 0x9055
jmp 0x9055
movq %rax, %rbx
jmp 0x9064
jmp 0x9055
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xa5aa
leaq -0x160(%rbp), %rdi
callq 0xba6e
movq 0x8f31(%rip), %rsi      # 0x11fa8
leaq -0x370(%rbp), %rdi
callq 0x2180
leaq -0x2f0(%rbp), %rdi
callq 0x20d0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x90a1
callq 0x21d0
movq -0x40(%rbp), %rdi
callq 0x95e8
leaq -0x1e8(%rbp), %rdi
callq 0x8714
movq %rbx, %rdi
callq 0x23b0