// File: /workspace/github_c_makefile_star2_O0/stonezwr[P]SpiKL-IP/synapse.C
// Function: Synapse::LSMLearn(int, int)
void Synapse::LSMLearn(int t, int iteration){
    assert((_fixed==false)&&(_lsm_active==true));
    _lsm_active = false;

    int iter = iteration + 1;

    if(iteration <= 50) iter = 1;
    else if(iteration <= 100) iter = 2;
    else if(iteration <= 150) iter = 4;
    else if(iteration <= 200) iter = 8;
    else if(iteration <= 250) iter = 16;
    else if(iteration <= 300) iter = 32;
    else iter = iteration/4; 

    double weight_old = _lsm_weight;
    _lsm_c = _post->GetCalciumPre();
	int signal=_post->GetTeacherSignal();
    if(_lsm_c>LSM_CAL_MID){
        if((_lsm_c < LSM_CAL_MID+LSM_CAL_BOUND)){
            _lsm_weight += LSM_DELTA_POT/( 1 + iteration/ITER_SEARCH_CONV);
        }
    }else{
        if((_lsm_c > LSM_CAL_MID-LSM_CAL_BOUND)){ 
            _lsm_weight -= LSM_DELTA_DEP/( 1+ iteration/ITER_SEARCH_CONV);
        }
    }
    CheckReadoutWeightOutBound();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movb 0x11(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x25(%rbp)
jne 0x1bf91
movq -0x30(%rbp), %rax
movb 0x14(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
sete %al
movb %al, -0x25(%rbp)
movb -0x25(%rbp), %al
testb $0x1, %al
jne 0x1bf9a
jmp 0x1bf9c
jmp 0x1bfbb
leaq 0x192b3(%rip), %rdi     # 0x35256
leaq 0x191ea(%rip), %rsi     # 0x35194
movl $0x55, %edx
leaq 0x192c5(%rip), %rcx     # 0x3527b
callq 0x4210
movq -0x30(%rbp), %rax
movb $0x0, 0x14(%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x32, -0x10(%rbp)
jg 0x1bfdb
movl $0x1, -0x14(%rbp)
jmp 0x1c04a
cmpl $0x64, -0x10(%rbp)
jg 0x1bfea
movl $0x2, -0x14(%rbp)
jmp 0x1c048
cmpl $0x96, -0x10(%rbp)
jg 0x1bffc
movl $0x4, -0x14(%rbp)
jmp 0x1c046
cmpl $0xc8, -0x10(%rbp)
jg 0x1c00e
movl $0x8, -0x14(%rbp)
jmp 0x1c044
cmpl $0xfa, -0x10(%rbp)
jg 0x1c020
movl $0x10, -0x14(%rbp)
jmp 0x1c042
cmpl $0x12c, -0x10(%rbp)     # imm = 0x12C
jg 0x1c032
movl $0x20, -0x14(%rbp)
jmp 0x1c040
movl -0x10(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0x14(%rbp)
jmp 0x1c042
jmp 0x1c044
jmp 0x1c046
jmp 0x1c048
jmp 0x1c04a
movq -0x30(%rbp), %rax
movsd 0x38(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movq 0x8(%rax), %rdi
callq 0x1c430
movq -0x30(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movq 0x8(%rax), %rdi
callq 0x1c450
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, -0x24(%rbp)
movsd 0x30(%rax), %xmm0
movsd 0x190e7(%rip), %xmm1    # 0x35170
ucomisd %xmm1, %xmm0
jbe 0x1c0db
movq -0x30(%rbp), %rax
movsd 0x190e5(%rip), %xmm0    # 0x35180
ucomisd 0x30(%rax), %xmm0
jbe 0x1c0d9
movq -0x30(%rbp), %rax
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0x17f65(%rip), %xmm1    # 0x34018
divsd %xmm1, %xmm0
movsd 0x18501(%rip), %xmm1    # 0x345c0
addsd %xmm0, %xmm1
movsd 0x190ad(%rip), %xmm0    # 0x35178
divsd %xmm1, %xmm0
addsd 0x38(%rax), %xmm0
movsd %xmm0, 0x38(%rax)
jmp 0x1c12f
movq -0x30(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd 0x18534(%rip), %xmm1    # 0x34620
ucomisd %xmm1, %xmm0
jbe 0x1c12d
movq -0x30(%rbp), %rax
cvtsi2sdl -0x10(%rbp), %xmm1
movsd 0x17f15(%rip), %xmm0    # 0x34018
divsd %xmm0, %xmm1
movsd 0x184b1(%rip), %xmm0    # 0x345c0
addsd %xmm1, %xmm0
movsd 0x1905d(%rip), %xmm1    # 0x35178
divsd %xmm0, %xmm1
movsd 0x38(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rax)
jmp 0x1c12f
movq -0x30(%rbp), %rdi
callq 0x1c470
addq $0x30, %rsp
popq %rbp
retq
nop