// File: /workspace/github_cpp_makefile_star2_O1/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 0x1ee38
movq (%rbx), %r12
movq 0x8(%rbx), %r13
movq %r13, %r14
subq %r12, %r14
sarq $0x2, %r14
leaq 0x3d12(%rip), %rsi      # 0x2114c
movq %r15, %rdi
callq 0x2080
testl %eax, %eax
je 0x1d4f1
movq %rbx, 0x8(%rsp)
leaq 0x3d19(%rip), %rsi      # 0x2116f
movq %r15, %rdi
callq 0x2080
testl %eax, %eax
jne 0x1d52d
xorps %xmm1, %xmm1
cmpq %r12, %r13
je 0x1d4ac
movq 0x8(%rsp), %rax
movq (%rax), %r15
cmpq $0x1, %r14
movq %r14, %rbp
adcq $0x0, %rbp
xorl %ebx, %ebx
movss %xmm1, 0x14(%rsp)
movss (%r15,%rbx,4), %xmm0
callq 0x22a0
movss 0x14(%rsp), %xmm1
movss %xmm0, (%r15,%rbx,4)
addss %xmm0, %xmm1
incq %rbx
cmpq %rbx, %rbp
jne 0x1d483
ucomiss 0x3b51(%rip), %xmm1     # 0x21004
setp %al
setne %cl
orb %al, %cl
cmpq %r12, %r13
setne %al
andb %cl, %al
cmpb $0x1, %al
movq 0x8(%rsp), %rbx
jne 0x1d51b
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 0x1d4d9
jmp 0x1d51b
cmpq %r12, %r13
je 0x1d51b
movq (%rbx), %rax
cmpq $0x1, %r14
adcq $0x0, %r14
xorl %ecx, %ecx
xorps %xmm0, %xmm0
ucomiss (%rax,%rcx,4), %xmm0
jbe 0x1d513
movl $0x0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r14
jne 0x1d506
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 0x3c10(%rip), %rsi      # 0x21151
leaq 0x38(%rsp), %rdi
movq %r15, %rdx
callq 0x1edaf
leaq 0x3c18(%rip), %rsi      # 0x2116d
leaq 0x38(%rsp), %rdi
callq 0x22f0
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1d582
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x1d58f
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
movq 0x8(%rax), %rdx
leaq 0x18(%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 0x94a31(%rip), %rsi     # 0xb1ff0
movq 0x949ea(%rip), %rdx     # 0xb1fb0
movq %r14, %rdi
callq 0x22c0
movq %rax, %r15
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d5f0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1d5f0
movq %rax, %r15
movb $0x1, %bpl
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d613
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x1d613
movq %rax, %r15
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1d620
movq %r14, %rdi
callq 0x2180
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1d63e
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %r15, %rdi
callq 0x22d0