// File: /workspace/github_c_makefile_star2_O1/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 0x2fa80
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
testq %rax, %rax
js 0x2faa4
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x2fabc
movl 0x30(%rbx), %ecx
cmpq $0x6, %rcx
ja 0x2fc4c
leaq 0x2705c(%rip), %rdx     # 0x56af0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movss 0x34(%rbx), %xmm0
jmp 0x2fadf
movq %rax, %rdx
shrq %rdx
andl $0x1, %eax
orq %rdx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %ecx, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x48(%rbx), %xmm1
callq 0x3120
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
addq $0x10, %rsp
popq %rbx
retq
movss 0x34(%rbx), %xmm0
movslq 0x68(%rbx), %rcx
testq %rcx, %rcx
jle 0x2fadf
movq 0x60(%rbx), %rdx
xorl %esi, %esi
movslq (%rdx,%rsi,4), %rdi
cmpq %rdi, %rax
jb 0x2fadf
movq 0x58(%rbx), %rdi
mulss (%rdi,%rsi,4), %xmm0
incq %rsi
cmpq %rsi, %rcx
jne 0x2faf9
jmp 0x2fadf
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x40(%rbx), %xmm0
jmp 0x2fb67
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
testq %rax, %rax
js 0x2fbcb
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x2fbe3
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x44(%rbx), %xmm0
movslq 0x50(%rbx), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %xmm2
punpckldq 0x26f5c(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x26f64(%rip), %xmm2    # 0x56ae0
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
jmp 0x2fad0
cvtss2sd 0x34(%rbx), %xmm0
movslq 0x50(%rbx), %rcx
subq %rcx, %rax
movsd %xmm0, 0x8(%rsp)
js 0x2fc04
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x2fc1c
cvtss2sd 0x34(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movss 0x2344a(%rip), %xmm1    # 0x53008
xorps %xmm0, %xmm0
callq 0xf201
jmp 0x2fac4
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
cvtsi2ssl 0x54(%rbx), %xmm1
divss %xmm1, %xmm0
movss 0x23414(%rip), %xmm1    # 0x53008
subss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
jmp 0x2fac8
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
mulss 0x40(%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x34e0
movsd 0x234f6(%rip), %xmm1    # 0x53128
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
mulsd 0x8(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
jmp 0x2fadf
movq 0x3a3a5(%rip), %rax     # 0x69ff8
movq (%rax), %rcx
leaq 0x26f83(%rip), %rdi     # 0x56be0
movl $0x11, %esi
movl $0x1, %edx
callq 0x3450
jmp 0x2fa9d