// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/network.c
// Function: get_current_rate
float get_current_rate(network *net)
{
    size_t batch_num = get_current_batch(net);
    int i;
    float rate;
    if (batch_num < net->burn_in) return net->learning_rate * pow((float)batch_num / net->burn_in, net->power);
    switch (net->policy) {
        case CONSTANT:
            return net->learning_rate;
        case STEP:
            return net->learning_rate * pow(net->scale, batch_num/net->step);
        case STEPS:
            rate = net->learning_rate;
            for(i = 0; i < net->num_steps; ++i){
                if(net->steps[i] > batch_num) return rate;
                rate *= net->scales[i];
            }
            return rate;
        case EXP:
            return net->learning_rate * pow(net->gamma, batch_num);
        case POLY:
            return net->learning_rate * pow(1 - (float)batch_num / net->max_batches, net->power);
        case RANDOM:
            return net->learning_rate * pow(rand_uniform(0,1), net->power);
        case SIG:
            return net->learning_rate * (1./(1.+exp(net->gamma*(batch_num - net->step))));
        default:
            fprintf(stderr, "Policy is weird!\n");
            return net->learning_rate;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq (%rax), %rax
movslq 0x4(%rdi), %rcx
movslq 0x1c(%rdi), %rsi
imulq %rcx, %rsi
xorl %edx, %edx
divq %rsi
movslq 0x6c(%rdi), %rcx
cmpq %rcx, %rax
jae 0x226ee
cvtss2sd 0x34(%rbx), %xmm0
testq %rax, %rax
movsd %xmm0, 0x8(%rsp)
js 0x22712
cvtsi2ss %rax, %xmm0
jmp 0x22727
movl 0x30(%rbx), %ecx
cmpq $0x6, %rcx
ja 0x2289b
leaq 0x2d43e(%rip), %rdx     # 0x4fb40
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movss 0x34(%rbx), %xmm0
jmp 0x22747
movq %rax, %rdx
shrq %rdx
andl $0x1, %eax
orq %rdx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %ecx, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
cvtss2sd 0x48(%rbx), %xmm1
callq 0x3110
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
addq $0x10, %rsp
popq %rbx
retq
movss 0x34(%rbx), %xmm0
movl 0x68(%rbx), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpq %rdx, %rcx
je 0x22747
movq 0x60(%rbx), %rsi
movslq (%rsi,%rdx,4), %rsi
cmpq %rsi, %rax
jb 0x22747
movq 0x58(%rbx), %rsi
mulss (%rsi,%rdx,4), %xmm0
incq %rdx
jmp 0x2275c
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
cvtss2sd 0x40(%rbx), %xmm0
jmp 0x227c5
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
testq %rax, %rax
js 0x22826
cvtsi2ss %rax, %xmm0
jmp 0x2283b
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
cvtss2sd 0x44(%rbx), %xmm0
movslq 0x50(%rbx), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %xmm2
punpckldq 0x2d34e(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x2d356(%rip), %xmm2    # 0x4fb30
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
jmp 0x22738
cvtss2sd 0x34(%rbx), %xmm0
movslq 0x50(%rbx), %rcx
subq %rcx, %rax
movsd %xmm0, 0x8(%rsp)
js 0x22859
cvtsi2ss %rax, %xmm0
jmp 0x2286e
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movss 0x297ef(%rip), %xmm1    # 0x4c008
xorps %xmm0, %xmm0
callq 0x4c09
jmp 0x2272f
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
cvtsi2ssl 0x54(%rbx), %xmm1
divss %xmm1, %xmm0
movss 0x297bc(%rip), %xmm1    # 0x4c008
subss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
jmp 0x22733
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
mulss 0x40(%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x34d0
movsd 0x298a4(%rip), %xmm1    # 0x4c128
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
mulsd 0x8(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm0
jmp 0x22747
movq 0x41756(%rip), %rax     # 0x63ff8
movq (%rax), %rcx
leaq 0x2d384(%rip), %rdi     # 0x4fc30
pushq $0x11
popq %rsi
pushq $0x1
popq %rdx
callq 0x3440
jmp 0x2270b