// File: /workspace/github_cpp_makefile_star2_O1/ekg[P]sgd2/src/sgd2.hpp
// Function: sgd2::schedule(std::vector<sgd2::term_sparse, std::allocator<sgd2::term_sparse>> const&, unsigned long, double)
std::vector<double> schedule(const std::vector<term_sparse> &terms, uint64_t t_max, double eps)
{
    double w_min = std::numeric_limits<double>::max();
    double w_max = std::numeric_limits<double>::min();
    for (const auto& term : terms)
    {
        if (term.w_ij < w_min && term.w_ij != 0) w_min = term.w_ij;
        if (term.w_ji < w_min && term.w_ji != 0) w_min = term.w_ji;

        if (term.w_ij > w_max) w_max = term.w_ij;
        if (term.w_ji > w_max) w_max = term.w_ji;
    }
    double eta_max = 1.0 / w_min;
    double eta_min = eps / w_max;

    double lambda = log(eta_max/eta_min) / ((double)t_max-1);

    // initialize step sizes
    std::vector<double> etas;
    etas.reserve(t_max);
    for (uint64_t t=0; t<t_max; t++)
        etas.push_back(eta_max * exp(-lambda * t));

    return etas;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
cmpq %rcx, %rax
je 0x6c4d
movsd 0x445b(%rip), %xmm4     # 0xb030
movsd 0x444b(%rip), %xmm1     # 0xb028
xorpd %xmm3, %xmm3
movsd 0x18(%rax), %xmm5
movsd 0x20(%rax), %xmm2
movapd %xmm5, %xmm6
cmpneqsd %xmm3, %xmm6
movapd %xmm6, %xmm7
andpd %xmm5, %xmm7
andnpd %xmm1, %xmm6
orpd %xmm7, %xmm6
movapd %xmm5, %xmm7
cmpltsd %xmm1, %xmm7
andpd %xmm7, %xmm6
andnpd %xmm1, %xmm7
orpd %xmm6, %xmm7
movapd %xmm2, %xmm6
cmpneqsd %xmm3, %xmm6
movapd %xmm2, %xmm1
minsd %xmm7, %xmm1
andpd %xmm6, %xmm1
andnpd %xmm7, %xmm6
orpd %xmm6, %xmm1
maxsd %xmm4, %xmm5
maxsd %xmm5, %xmm2
addq $0x28, %rax
movapd %xmm2, %xmm4
cmpq %rcx, %rax
jne 0x6be1
jmp 0x6c5d
movsd 0x43d3(%rip), %xmm1     # 0xb028
movsd 0x43d3(%rip), %xmm2     # 0xb030
movsd 0x43a3(%rip), %xmm3     # 0xb008
divsd %xmm1, %xmm3
divsd %xmm2, %xmm0
movsd %xmm3, -0x38(%rbp)
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x2110
movapd %xmm0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8080
testq %r14, %r14
je 0x6d52
movq %r14, %xmm0
punpckldq 0x43a7(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x43af(%rip), %xmm0     # 0xb070
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd 0x434b(%rip), %xmm1     # 0xb020
movapd -0x30(%rbp), %xmm0
xorpd 0x43ae(%rip), %xmm0     # 0xb090
divsd %xmm1, %xmm0
movapd %xmm0, -0x30(%rbp)
xorl %r12d, %r12d
leaq -0x40(%rbp), %r15
movq %r12, %xmm1
punpckldq 0x4361(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4369(%rip), %xmm1     # 0xb070
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x2250
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6d3f
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x6d4a
movq %rbx, %rdi
movq %r15, %rdx
callq 0x9b78
incq %r12
cmpq %r12, %r14
jne 0x6cf2
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6d64
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x6d7b
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x2240