// File: cannam[P]mini-cpp-convnet/flower.cpp
// Function: activation(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&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<vector<vector<float>>>
activation(const vector<vector<vector<float>>> &in,
           string type)
{
    auto out(in);

    if (type == "relu") {
        for (size_t i = 0; i < out.size(); ++i) {
            for (size_t j = 0; j < out[i].size(); ++j) {
                for (size_t k = 0; k < out[i][j].size(); ++k) {
                    if (out[i][j][k] < 0.f) {
                        out[i][j][k] = 0.f;
                    }
                }
            }
        }
    } else {
        throw runtime_error("Unknown activation function '" + type + "'");
    }
        
    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdx, -0x98(%rbp)
movq %rdi, -0xa8(%rbp)
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movq -0x10(%rbp), %rsi
callq 0x4ac20
movq -0x98(%rbp), %rdi
leaq 0xa8da(%rip), %rsi      # 0x53144
callq 0x4ad10
movb %al, -0x8a(%rbp)
jmp 0x48877
movb -0x8a(%rbp), %al
testb $0x1, %al
jne 0x48886
jmp 0x489f0
movq $0x0, -0x38(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq %rax, -0xb0(%rbp)
callq 0x4a740
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jae 0x489eb
movq $0x0, -0x40(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x38(%rbp), %rsi
callq 0x4ab20
movq %rax, %rdi
callq 0x4a7d0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jae 0x489d8
movq $0x0, -0x48(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x48(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x38(%rbp), %rsi
callq 0x4ab20
movq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0x4ab40
movq %rax, %rdi
callq 0x4a7b0
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
jae 0x489c5
movq -0xa8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x4ab20
movq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0x4ab40
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x4ab60
xorps %xmm0, %xmm0
ucomiss (%rax), %xmm0
jbe 0x489b2
movq -0xa8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x4ab20
movq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0x4ab40
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x4ab60
xorps %xmm0, %xmm0
movss %xmm0, (%rax)
jmp 0x489b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x48af1
jmp 0x489b4
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x488fe
jmp 0x489c7
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x488c0
jmp 0x489da
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x4888e
jmp 0x48acb
movb $0x1, -0x89(%rbp)
movl $0x10, %edi
callq 0x3120
movq -0x98(%rbp), %rdx
movq %rax, -0xc8(%rbp)
leaq 0xa733(%rip), %rsi      # 0x53149
leaq -0x88(%rbp), %rdi
callq 0x4ad90
jmp 0x48a24
leaq 0xa73a(%rip), %rdx      # 0x53165
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4ad40
jmp 0x48a3d
movq -0xc8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3350
jmp 0x48a4f
movq -0xc8(%rbp), %rdi
movb $0x0, -0x89(%rbp)
movq 0xa058c(%rip), %rsi     # 0xe8ff0
movq 0xa0545(%rip), %rdx     # 0xe8fb0
callq 0x3390
jmp 0x48b06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x48ab2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x48aa6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x3180
leaq -0x88(%rbp), %rdi
callq 0x3180
testb $0x1, -0x89(%rbp)
jne 0x48abd
jmp 0x48ac9
movq -0xc8(%rbp), %rdi
callq 0x31d0
jmp 0x48af1
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x48ae1
movq -0xa8(%rbp), %rdi
callq 0x4ab80
movq -0xa0(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x4ab80
movq -0x28(%rbp), %rdi
callq 0x33b0
nopw %cs:(%rax,%rax)