// File: /workspace/github_cpp_makefile_star2_O3/cannam[P]mini-cpp-convnet/flower.cpp
// Function: zeroPad(std::vector<std::vector<std::vector<float, std::allocator<float>>, std::allocator<std::vector<float, std::allocator<float>>>>, std::allocator<std::vector<std::vector<float, std::allocator<float>>, std::allocator<std::vector<float, std::allocator<float>>>>>> const&, unsigned long, unsigned long)
vector<vector<vector<float>>>
zeroPad(const vector<vector<vector<float>>> &in,
        size_t pad_y,
        size_t pad_x)
{
    size_t in_height = in.size();
    if (in_height == 0) {
        throw runtime_error("Input too small in zeroPad");
    }

    size_t in_width = in[0].size();
    if (in_width == 0) {
        throw runtime_error("Input too small in zeroPad");
    }
    
    size_t depth = in[0][0].size();
    
#ifdef VERBOSE
    cerr << "zeroPad: input size " << in_width << "x" << in_height
         << "; padding " << pad_x << "," << pad_y << "; output size "
         << in_width + 2 * pad_x << "x" << in_height + 2 * pad_y
         << " and depth " << depth << endl;
#endif
    
    auto out =
        vector<vector<vector<float>>>
        (in_height + 2 * pad_y,
         vector<vector<float>>
         (in_width + 2 * pad_x,
          vector<float>
          (depth,
           0.f)));

    for (size_t y = 0; y < in_height; ++y) {
        for (size_t x = 0; x < in_width; ++x) {
            for (size_t c = 0; c < depth; ++c) {
                out[y + pad_y][x + pad_x][c] = in[y][x][c];
            }
        }
    }

    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq (%rsi), %rax
movq 0x8(%rsi), %rbp
subq %rax, %rbp
je 0x1c75f
movq (%rax), %rcx
movq 0x8(%rax), %r12
subq %rcx, %r12
je 0x1c77d
movq %rsi, %r14
movq (%rcx), %r13
movq 0x8(%rcx), %rbx
movq %rbx, %r15
subq %r13, %r15
sarq $0x2, %r15
leaq 0x3c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x20(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r15, %rsi
callq 0x1e4b6
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
sarq $0x3, %r12
imulq %rax, %r12
movq 0x18(%rsp), %rax
leaq (%r12,%rax,2), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0x6(%rsp), %rcx
callq 0x1e640
sarq $0x3, %rbp
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rbp
movq 0x10(%rsp), %rax
leaq (,%rax,2), %rsi
addq %rbp, %rsi
leaq 0x40(%rsp), %rdx
leaq 0x5(%rsp), %rcx
movq 0x8(%rsp), %rdi
callq 0x1e6d8
leaq 0x40(%rsp), %rdi
callq 0x1e770
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1c6b8
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
cmpq $0x1, %r15
adcq $0x0, %r15
cmpq $0x1, %r12
adcq $0x0, %r12
cmpq $0x1, %rbp
adcq $0x0, %rbp
xorl %eax, %eax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x18(%rsp), %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (,%rax,8), %rsi
leaq (%rsi,%rsi,2), %rdi
movq (%r14), %rsi
addq %rdi, %rsi
movq 0x8(%rsp), %r8
addq (%r8), %rdi
leaq (%rdi,%rcx,8), %rdi
xorl %r8d, %r8d
cmpq %r13, %rbx
je 0x1c73b
movq (%rsi), %r9
leaq (,%r8,8), %r10
leaq (%r10,%r10,2), %r10
movq (%r9,%r10), %r9
addq (%rdi), %r10
movq (%r10,%rdx,8), %r10
xorl %r11d, %r11d
movss (%r9,%r11,4), %xmm0
movss %xmm0, (%r10,%r11,4)
incq %r11
cmpq %r11, %r15
jne 0x1c727
incq %r8
cmpq %r12, %r8
jne 0x1c705
incq %rax
cmpq %rbp, %rax
jne 0x1c6e4
movq 0x8(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20f0
movq %rax, %r14
leaq 0x396b(%rip), %rsi      # 0x200de
movq %rax, %rdi
callq 0x20b0
jmp 0x1c799
movl $0x10, %edi
callq 0x20f0
movq %rax, %r14
leaq 0x394d(%rip), %rsi      # 0x200de
movq %rax, %rdi
callq 0x20b0
movq 0x94850(%rip), %rsi     # 0xb0ff0
movq 0x94809(%rip), %rdx     # 0xb0fb0
movq %r14, %rdi
callq 0x22c0
jmp 0x1c7b1
movq %rax, %rbx
movq %r14, %rdi
callq 0x2180
jmp 0x1c7ec
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x1e770
jmp 0x1c7d0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1c7ec
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
jmp 0x1c7ec
movq %rax, %rbx
movq %rbx, %rdi
callq 0x22d0