// File: /workspace/github_c_makefile_star2_O3/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 0x81ec
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, -0x40(%rbp)
movq $0x0, 0x10(%rbx)
cmpl $0x2, 0x4(%r15)
movl $0x1, -0x30(%rbp)
jl 0x8a6c
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 0x9ff2
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 0x8c28
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 0xa1aa
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 0xa2bc
leaq -0x160(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0xa2fa
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 0xb0d2
movups 0x58(%r12), %xmm0
movups %xmm0, 0x80(%r14)
movq %r14, %rdi
addq $0x90, %rdi
movq %r13, %rsi
callq 0xb234
movq 0x80(%r12), %rax
movq 0x85(%r12), %rcx
movq %rcx, 0xad(%r14)
movq %rax, 0xa8(%r14)
movq %r13, %rdi
callq 0x9380
leaq -0xc8(%rbp), %rdi
callq 0xa400
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x8bff
callq 0x21d0
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x8c17
callq 0x21d0
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
cmpl -0x34(%rbp), %eax
jl 0x8aef
cmpl $0x2, -0x30(%rbp)
jl 0x8d25
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 0x8d15
movl 0x34(%r15), %edx
movl 0x38(%r15), %ecx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa1aa
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 0xa2fa
addq $0x90, %rax
movq %rax, %rdi
movq %r14, %rsi
callq 0xa2bc
leaq -0xa0(%rbp), %rdi
callq 0x9380
leaq -0xc8(%rbp), %rdi
callq 0xa400
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x8cec
callq 0x21d0
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x8d04
callq 0x21d0
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
cmpl -0x34(%rbp), %eax
jl 0x8c63
movq -0x58(%rbp), %rcx
leal 0x1(%rcx), %eax
cmpl -0x30(%rbp), %ecx
jne 0x8c4e
leaq -0x160(%rbp), %rdi
callq 0xb87c
leaq -0x1e8(%rbp), %rdi
callq 0xa3ae
movq 0x9264(%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 0x8d6e
callq 0x21d0
movq -0x178(%rbp), %rdi
testq %rdi, %rdi
je 0x8d7f
callq 0x21d0
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0x8d90
callq 0x21d0
movq -0x1a8(%rbp), %rdi
testq %rdi, %rdi
je 0x8da1
callq 0x21d0
movq -0x1c0(%rbp), %rdi
testq %rdi, %rdi
je 0x8db2
callq 0x21d0
leaq -0x1d8(%rbp), %rdi
callq 0x949c
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 0x8e25
movq %rax, %rbx
jmp 0x8e37
jmp 0x8de4
jmp 0x8deb
jmp 0x8deb
movq %rax, %rbx
jmp 0x8dfa
jmp 0x8deb
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xa362
leaq -0x160(%rbp), %rdi
callq 0xb87c
movq 0x919b(%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 0x8e37
callq 0x21d0
movq -0x40(%rbp), %rdi
callq 0x9380
leaq -0x1e8(%rbp), %rdi
callq 0x84aa
movq %rbx, %rdi
callq 0x23b0