// File: /workspace/github_cpp_makefile_star2_O3/cannam[P]mini-cpp-convnet/flower.cpp
// Function: activation(std::vector<float, std::allocator<float>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<float>
activation(const vector<float> &in,
           string type)
{
    auto out(in);
    size_t sz = out.size();

    if (type == "relu") {
        for (size_t i = 0; i < sz; ++i) {
            if (out[i] < 0.f) {
                out[i] = 0.f;
            }
        }
    } else if (type == "softmax") {
        float sum = 0.f;
        for (size_t i = 0; i < sz; ++i) {
            out[i] = exp(out[i]);
            sum += out[i];
        }
        if (sum != 0.f) {
            for (size_t i = 0; i < sz; ++i) {
                out[i] /= sum;
            }
        }
    } else {
        throw runtime_error("Unknown activation function '" + type + "'");
    }

    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r15
movq %rdi, %rbx
callq 0x1e92e
movq (%rbx), %r12
movq 0x8(%rbx), %r13
movq %r13, %r14
subq %r12, %r14
sarq $0x2, %r14
leaq 0x33be(%rip), %rsi      # 0x20174
movq %r15, %rdi
callq 0x2080
testl %eax, %eax
je 0x1ce6b
leaq 0x33ca(%rip), %rsi      # 0x20197
movq %r15, %rdi
callq 0x2080
testl %eax, %eax
jne 0x1cea7
cmpq %r12, %r13
je 0x1ce95
movq %rbx, 0x10(%rsp)
movq (%rbx), %r15
cmpq $0x1, %r14
movq %r14, %rbp
adcq $0x0, %rbp
xorps %xmm1, %xmm1
xorl %ebx, %ebx
movss %xmm1, 0xc(%rsp)
movss (%r15,%rbx,4), %xmm0
callq 0x22a0
movss 0xc(%rsp), %xmm1
movss %xmm0, (%r15,%rbx,4)
addss %xmm0, %xmm1
incq %rbx
cmpq %rbx, %rbp
jne 0x1cdfe
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
setp %al
setne %cl
orb %al, %cl
cmpq %r12, %r13
setne %al
andb %cl, %al
cmpb $0x1, %al
movq 0x10(%rsp), %rbx
jne 0x1ce95
movq (%rbx), %rax
cmpq $0x1, %r14
adcq $0x0, %r14
xorl %ecx, %ecx
movss (%rax,%rcx,4), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r14
jne 0x1ce53
jmp 0x1ce95
cmpq %r12, %r13
je 0x1ce95
movq (%rbx), %rax
cmpq $0x1, %r14
adcq $0x0, %r14
xorl %ecx, %ecx
xorps %xmm0, %xmm0
ucomiss (%rax,%rcx,4), %xmm0
jbe 0x1ce8d
movl $0x0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r14
jne 0x1ce80
movq %rbx, %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 0x32be(%rip), %rsi      # 0x20179
leaq 0x18(%rsp), %rdi
movq %r15, %rdx
callq 0x1e8a5
leaq 0x32c6(%rip), %rsi      # 0x20195
leaq 0x18(%rsp), %rdi
callq 0x22f0
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1cefc
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x1cf09
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
movq 0x8(%rax), %rdx
leaq 0x38(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r14, %rdi
callq 0x2270
xorl %ebp, %ebp
movq 0x940b7(%rip), %rsi     # 0xb0ff0
movq 0x94070(%rip), %rdx     # 0xb0fb0
movq %r14, %rdi
callq 0x22c0
movq %rax, %r15
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x1cf62
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21e0
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cf7d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21e0
testb %bpl, %bpl
jne 0x1cfa7
jmp 0x1cfaf
movq %rax, %r15
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cfa7
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1cfa7
movq %rax, %r15
movq %r14, %rdi
callq 0x2180
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1cfc3
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %r15, %rdi
callq 0x22d0