// File: /workspace/github_c_makefile_star2_O3/stonezwr[P]SpiKL-IP/neuron.C
// Function: Neuron::SpiKL_IP(int)
void Neuron::SpiKL_IP(int t){
	double Tau_Lower_Bound=32;
	double Tau_Upper_Bound=512;
	double R_Lower_Bound=32;
	double R_Upper_Bound=512;
	double y=_lsm_calcium/(TAU_C-1);
	double LR1=5;
	double LR2=5;
	double beta=5;  //reciprocal of miu
    if(!(_name[0] == 'r' && _name[9] == '_'))   return;	
	double X;
	if(y>0.01){
		X=_lsm_v_thresh/(exp((1/_lsm_t_m_c)*(1/y-LSM_T_REFRAC))-1);
		_lsm_R+=LR1*(2*y*_lsm_t_m_c*_lsm_v_thresh-X-_lsm_v_thresh-beta*_lsm_t_m_c*_lsm_v_thresh*y*y)/(_lsm_R*X);
		_lsm_t_m_c+=LR2*(2*LSM_T_REFRAC*y-1-beta*(LSM_T_REFRAC*y*y-y))/_lsm_t_m_c;		
	}
	else{
		_lsm_R+=LR1*0.1;
		_lsm_t_m_c-=LR2*0.1;
	}
	if(_lsm_R<R_Lower_Bound)
		_lsm_R=R_Lower_Bound;
	if(_lsm_R>R_Upper_Bound)
		_lsm_R=R_Upper_Bound;

	if(_lsm_t_m_c<Tau_Lower_Bound)
		_lsm_t_m_c=Tau_Lower_Bound;
	if(_lsm_t_m_c>Tau_Upper_Bound)
		_lsm_t_m_c=Tau_Upper_Bound;
	

}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq 0x10(%rdi), %rax
cmpb $0x72, (%rax)
jne 0x7827
cmpb $0x5f, 0x9(%rax)
jne 0x7827
movq %rdi, %rbx
movsd 0x178(%rdi), %xmm0
divsd 0x10023(%rip), %xmm0    # 0x176c0
ucomisd 0x10023(%rip), %xmm0    # 0x176c8
jbe 0x77af
movsd 0x1d0(%rbx), %xmm1
movaps %xmm1, 0x10(%rsp)
movapd %xmm0, %xmm1
movapd %xmm0, (%rsp)
movhpd 0x1f0(%rbx), %xmm1      # xmm1 = xmm1[0],mem[0]
movapd 0xff4f(%rip), %xmm0     # 0x17620
divpd %xmm1, %xmm0
movsd 0xfff3(%rip), %xmm1     # 0x176d0
addsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
mulsd %xmm1, %xmm0
callq 0x35a0
movsd 0xffe2(%rip), %xmm3     # 0x176d8
addsd %xmm3, %xmm0
movapd 0x10(%rsp), %xmm7
divsd %xmm0, %xmm7
movapd (%rsp), %xmm8
movapd %xmm8, %xmm2
addsd %xmm8, %xmm2
movsd 0x1f0(%rbx), %xmm0
movapd %xmm2, %xmm4
mulsd %xmm0, %xmm4
movsd 0x1d0(%rbx), %xmm5
movsd 0x1d8(%rbx), %xmm1
mulsd %xmm5, %xmm4
subsd %xmm7, %xmm4
subsd %xmm5, %xmm4
movsd 0xff98(%rip), %xmm6     # 0x176e0
mulsd %xmm0, %xmm6
mulsd %xmm5, %xmm6
mulsd %xmm8, %xmm6
movsd 0xff8b(%rip), %xmm5     # 0x176e8
mulsd %xmm8, %xmm5
addsd %xmm3, %xmm5
unpcklpd %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0]
mulsd %xmm8, %xmm2
subsd %xmm8, %xmm2
unpcklpd %xmm6, %xmm2            # xmm2 = xmm2[0],xmm6[0]
movapd 0xfeb0(%rip), %xmm3     # 0x17630
unpcklpd %xmm8, %xmm3            # xmm3 = xmm3[0],xmm8[0]
mulpd %xmm2, %xmm3
addpd %xmm5, %xmm3
mulpd 0xfeab(%rip), %xmm3     # 0x17640
mulsd %xmm1, %xmm7
movapd %xmm0, %xmm2
unpcklpd %xmm7, %xmm2            # xmm2 = xmm2[0],xmm7[0]
divpd %xmm2, %xmm3
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
addpd %xmm3, %xmm0
jmp 0x77c7
movupd 0x1f0(%rbx), %xmm0
movhpd 0x1d8(%rbx), %xmm0      # xmm0 = xmm0[0],mem[0]
addpd 0xfe49(%rip), %xmm0     # 0x17610
movhpd %xmm0, 0x1d8(%rbx)
movlpd %xmm0, 0x1f0(%rbx)
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
movsd 0xff09(%rip), %xmm1     # 0x176f0
ucomisd %xmm2, %xmm1
ja 0x77fb
movsd 0xff03(%rip), %xmm1     # 0x176f8
ucomisd %xmm1, %xmm2
jbe 0x7803
movsd %xmm1, 0x1d8(%rbx)
movsd 0xfee5(%rip), %xmm1     # 0x176f0
ucomisd %xmm0, %xmm1
ja 0x781f
movsd 0xfedf(%rip), %xmm1     # 0x176f8
ucomisd %xmm1, %xmm0
jbe 0x7827
movsd %xmm1, 0x1f0(%rbx)
addq $0x20, %rsp
popq %rbx
retq
nop