// File: /workspace/github_cpp_makefile_star2_O1/cannam[P]mini-cpp-convnet/flower.cpp
// Function: read_image(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<vector<vector<float>>>
read_image(string filename)
{
    png_image image;
    memset(&image, 0, sizeof(image));
    image.version = PNG_IMAGE_VERSION;

    if (!png_image_begin_read_from_file(&image, filename.c_str())) {
        throw runtime_error
            (string("Failed to open image file: ") + image.message);
    }

    image.format = PNG_FORMAT_RGB;
    auto size = image.width * image.height * 3;
    vector<png_byte> buffer(size, 255);
    
    if (!png_image_finish_read(&image, nullptr, buffer.data(), 0, nullptr)) {
        throw runtime_error
            (string("Failed to read image file: ") + image.message);
    }

    vector<vector<vector<float>>> image_tensor;
    auto ptr = buffer.begin();
    
    for (png_uint_32 i = 0; i < image.height; ++i) {
        image_tensor.push_back(vector<vector<float>>());
        for (png_uint_32 j = 0; j < image.width; ++j) {
            image_tensor[i].push_back(vector<float>());
            for (png_uint_32 k = 0; k < 3; ++k) {
                image_tensor[i][j].push_back(*ptr++ / 255.f);
            }
        }
    }
        
    return image_tensor;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movq $0x0, 0x60(%rdi)
movl $0x1, 0x8(%rdi)
movq (%rsi), %rsi
callq 0x2210
testl %eax, %eax
je 0x1e253
movl $0x2, 0x84(%rsp)
movl 0x7c(%rsp), %eax
imull 0x80(%rsp), %eax
leal (%rax,%rax,2), %esi
movq %rsp, %rdx
movb $-0x1, (%rdx)
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rcx
callq 0x1eef6
movq 0x48(%rsp), %rdx
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2100
testl %eax, %eax
je 0x1e2b6
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
cmpl $0x0, 0x80(%rsp)
je 0x1e227
movq 0x48(%rsp), %r13
xorl %r14d, %r14d
movq %rsp, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1f50c
movq %rbp, %rdi
callq 0x1ec86
cmpl $0x0, 0x7c(%rsp)
je 0x1e214
movq %r14, 0x60(%rsp)
leaq (%r14,%r14,2), %r12
leaq (,%r12,8), %rax
movq %rax, 0x68(%rsp)
movq $0x0, 0x20(%rsp)
movq %r13, %r15
movq (%rbx), %rdi
addq 0x68(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %rbp, %rsi
callq 0x1f724
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1e192
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq 0x20(%rsp), %rax
leaq (%rax,%rax,2), %r13
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
leaq (%rax,%r13,8), %rdi
movzbl (%r15,%r14), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x2e4b(%rip), %xmm0     # 0x21008
movss %xmm0, (%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x1e1da
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x1e1e2
movq %rbp, %rdx
callq 0x1f916
incq %r14
cmpl $0x3, %r14d
jne 0x1e19e
movq 0x20(%rsp), %rdx
incq %rdx
movl 0x7c(%rsp), %eax
leaq (%r15,%r14), %r13
movq %rdx, 0x20(%rsp)
cmpq %rax, %rdx
jb 0x1e159
addq %r14, %r15
movq %r15, %r13
movq 0x60(%rsp), %r14
incq %r14
movl 0x80(%rsp), %eax
cmpq %rax, %r14
jb 0x1e10c
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1e23e
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2f07(%rip), %rsi      # 0x21177
leaq 0x2f1b(%rip), %rdx      # 0x21192
leaq 0x28(%rsp), %rdi
callq 0x1f404
leaq 0x94(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x22f0
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1e319
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x1e325
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2ec0(%rip), %rsi      # 0x21193
leaq 0x2ed4(%rip), %rdx      # 0x211ae
leaq 0x28(%rsp), %rdi
callq 0x1f404
leaq 0x94(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x22f0
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1e364
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x1e370
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rsp, %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x2270
xorl %ebp, %ebp
movq 0x93c9d(%rip), %rsi     # 0xb1ff0
movq 0x93c56(%rip), %rdx     # 0xb1fb0
movq %rbx, %rdi
callq 0x22c0
jmp 0x1e3ad
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rsp, %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x2270
xorl %ebp, %ebp
movq 0x93c52(%rip), %rsi     # 0xb1ff0
movq 0x93c0b(%rip), %rdx     # 0xb1fb0
movq %rbx, %rdi
callq 0x22c0
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1e3ce
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1e3ce
movq %rax, %r14
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e427
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1e427
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1e408
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1e408
movq %rax, %r14
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e43c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1e43c
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1e488
movq %rbx, %rdi
callq 0x2180
jmp 0x1e488
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1e49f
movq %rbx, %rdi
callq 0x2180
jmp 0x1e49f
movq %rax, %r14
jmp 0x1e488
movq %rax, %r14
jmp 0x1e49f
movq %rax, %r14
movq %rsp, %rdi
callq 0x1ec86
jmp 0x1e480
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1e480
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
jmp 0x1e480
movq %rax, %r14
movq %rbx, %rdi
callq 0x1ecd4
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1e49f
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %r14, %rdi
callq 0x22d0