// File: /workspace/github_cpp_makefile_star2_O1/theolepage[P]prophecy/src/model/model.hh
// Function: Model<float>::train(std::vector<Matrix<float>, std::allocator<Matrix<float>>>&, std::vector<Matrix<float>, std::allocator<Matrix<float>>>&, int, int)
void train(std::vector<Matrix<T>>& x,
                std::vector<Matrix<T>>& y,
                int epochs,
                int batch_size)
    {
        if (!compiled_)
            throw "Model has not been compiled.";

        for (int epoch = 0; epoch < epochs; epoch++)
        {
            // Determine batches
            int i = 0;
            int nb_batches = ceil(x.size() / batch_size);
            for (int batch = 0; batch < nb_batches; batch++)
            {
                // For each batch, compute delta weights and biases
                for (int k = 0; k < batch_size && i < static_cast<int>(x.size()); k++)
                {
                    layers_[0]->feedforward(x[i], true);
                    layers_[layers_.size() - 1]->backpropagation(&y[i]);
                    ++i;
                }

                // At the end of batch, update weights_ and biases_
                for (size_t l = 1; l < layers_.size(); l++)
                {
                    auto layer = std::dynamic_pointer_cast<HiddenLayer<T>>(layers_[l]);
                    layer->update(learning_rate_);
                }
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x40(%rsp)
cmpb $0x1, 0x8(%rdi)
jne 0x2fd3
testl %ecx, %ecx
jle 0x2fc4
movq %rsi, %r15
movq %rdi, %r12
movslq %r8d, %rax
movq %rax, 0x20(%rsp)
movl %eax, %ebp
negl %ebp
xorl %eax, %eax
movq %r8, 0x30(%rsp)
movl %ecx, 0x14(%rsp)
movq %rax, 0x28(%rsp)
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x5, %rax
xorl %edx, %edx
divq 0x20(%rsp)
movq %rax, 0x38(%rsp)
testl %eax, %eax
jle 0x2fb1
xorl %eax, %eax
movq $0x0, 0x8(%rsp)
movl %eax, 0x1c(%rsp)
testl %r8d, %r8d
jle 0x2efc
movq 0x8(%rsp), %rax
movslq %eax, %r14
addl %r8d, %eax
movl %eax, 0x18(%rsp)
movq %r14, %rbx
shlq $0x5, %rbx
xorl %r13d, %r13d
movq (%r15), %rdx
movq 0x8(%r15), %rax
subq %rdx, %rax
shrq $0x5, %rax
cltq
cmpq %rax, %r14
jge 0x2eef
movq 0x10(%r12), %rax
movq (%rax), %rsi
addq %rbx, %rdx
movq (%rsi), %rax
leaq 0x48(%rsp), %rdi
movl $0x1, %ecx
callq *0x10(%rax)
leaq 0x5c34(%rip), %rax      # 0x8ae0
movq %rax, 0x48(%rsp)
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2ec0
callq 0x349c
movq 0x18(%r12), %rax
movq -0x10(%rax), %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
movq (%rdi), %rax
callq *0x18(%rax)
incq %r14
decl %r13d
addq $0x20, %rbx
cmpl %r13d, %ebp
jne 0x2e75
movl 0x18(%rsp), %eax
jmp 0x2ef7
movq 0x8(%rsp), %rax
subl %r13d, %eax
movq %rax, 0x8(%rsp)
movq 0x10(%r12), %r13
movq 0x18(%r12), %rax
subq %r13, %rax
cmpq $0x11, %rax
jb 0x2f9c
movl $0x1, %ebx
movl $0x18, %r14d
movq -0x8(%r13,%r14), %rdi
testq %rdi, %rdi
je 0x2f42
leaq 0x5d59(%rip), %rsi      # 0x8c88
leaq 0x5df2(%rip), %rdx      # 0x8d28
xorl %ecx, %ecx
callq 0x2170
movq %rax, %rdi
jmp 0x2f44
xorl %edi, %edi
movq (%r13,%r14), %r13
testq %r13, %r13
je 0x2f65
movq 0x606b(%rip), %rax      # 0x8fc0
cmpb $0x0, (%rax)
je 0x2f60
incl 0x8(%r13)
jmp 0x2f65
lock
incl 0x8(%r13)
movss 0xc(%r12), %xmm0
movq (%rdi), %rax
callq *0x28(%rax)
testq %r13, %r13
je 0x2f7f
movq %r13, %rdi
callq 0x349c
incq %rbx
movq 0x10(%r12), %r13
movq 0x18(%r12), %rax
subq %r13, %rax
sarq $0x4, %rax
addq $0x10, %r14
cmpq %rax, %rbx
jb 0x2f1e
movl 0x1c(%rsp), %eax
incl %eax
cmpl 0x38(%rsp), %eax
movq 0x30(%rsp), %r8
jl 0x2e4f
movq 0x28(%rsp), %rax
incl %eax
movl 0x14(%rsp), %ecx
cmpl %ecx, %eax
jne 0x2e20
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20a0
leaq 0x3264(%rip), %rcx      # 0x6248
movq %rcx, (%rax)
movq 0x5fc2(%rip), %rsi      # 0x8fb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x21f0
movq %rax, %rbx
testq %r13, %r13
je 0x3008
movq %r13, %rdi
callq 0x349c
movq %rbx, %rdi
callq 0x2200