// File: 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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xb0(%rbp)
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4a740
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x47e5c
movl $0x10, %edi
callq 0x3120
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
leaq 0xb290(%rip), %rsi      # 0x530ae
callq 0x30d0
jmp 0x47e25
movq -0xb8(%rbp), %rdi
movq 0xa11bd(%rip), %rsi     # 0xe8ff0
movq 0xa1176(%rip), %rdx     # 0xe8fb0
callq 0x3390
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x31d0
jmp 0x481b4
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4a770
movq %rax, %rdi
callq 0x4a7d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x47ed8
movl $0x10, %edi
callq 0x3120
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
leaq 0xb214(%rip), %rsi      # 0x530ae
callq 0x30d0
jmp 0x47ea1
movq -0xc0(%rbp), %rdi
movq 0xa1141(%rip), %rsi     # 0xe8ff0
movq 0xa10fa(%rip), %rdx     # 0xe8fb0
callq 0x3390
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x31d0
jmp 0x481b4
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0xe8(%rbp)
callq 0x4a770
movq -0xe8(%rbp), %rsi
movq %rax, %rdi
callq 0x4a790
movq %rax, %rdi
callq 0x4a7b0
movq %rax, -0x48(%rbp)
movb $0x0, -0x49(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
leaq (%rax,%rcx,2), %rax
movq %rax, -0xe0(%rbp)
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
leaq (%rax,%rcx,2), %rax
movq %rax, -0xd8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl $0x0, -0x84(%rbp)
leaq -0x85(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x4a800
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rcx
leaq -0x80(%rbp), %rdi
leaq -0x84(%rbp), %rdx
callq 0x4a820
jmp 0x47f79
leaq -0x86(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x4a8a0
movq -0xd8(%rbp), %rsi
movq -0xf0(%rbp), %rcx
leaq -0x68(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4a8c0
jmp 0x47fa9
leaq -0x87(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x4a940
movq -0xb0(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xf8(%rbp), %rcx
leaq -0x68(%rbp), %rdx
callq 0x4a960
jmp 0x47fdc
leaq -0x87(%rbp), %rdi
callq 0x4a9e0
leaq -0x68(%rbp), %rdi
callq 0x4aa00
leaq -0x86(%rbp), %rdi
callq 0x4aa60
leaq -0x80(%rbp), %rdi
callq 0x4aa80
leaq -0x85(%rbp), %rdi
callq 0x4aae0
movq $0x0, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x4818e
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x48175
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x4815c
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x4a770
movq %rax, %rdi
movq -0x98(%rbp), %rsi
callq 0x4a790
movq %rax, %rdi
movq -0xa0(%rbp), %rsi
callq 0x4ab00
movq -0xb0(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0xfc(%rbp)
movq -0x90(%rbp), %rsi
addq -0x18(%rbp), %rsi
callq 0x4ab20
movq %rax, %rdi
movq -0x98(%rbp), %rsi
addq -0x20(%rbp), %rsi
callq 0x4ab40
movq %rax, %rdi
movq -0xa0(%rbp), %rsi
callq 0x4ab60
movss -0xfc(%rbp), %xmm0
movss %xmm0, (%rax)
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x48055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4814e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x48139
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x87(%rbp), %rdi
callq 0x4a9e0
leaq -0x68(%rbp), %rdi
callq 0x4aa00
leaq -0x86(%rbp), %rdi
callq 0x4aa60
leaq -0x80(%rbp), %rdi
callq 0x4aa80
leaq -0x85(%rbp), %rdi
callq 0x4aae0
jmp 0x481b4
jmp 0x4815e
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x48039
jmp 0x48177
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x4801d
movb $0x1, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
jne 0x481a4
movq -0xb0(%rbp), %rdi
callq 0x4ab80
movq -0xa8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x33b0
nopl (%rax)