// File: /workspace/github_c_makefile_star2_O2/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 0x64dd
cmpb $0x5f, 0x9(%rax)
jne 0x64dd
movq %rdi, %rbx
movsd 0x178(%rdi), %xmm0
divsd 0xe34d(%rip), %xmm0     # 0x146a0
ucomisd 0xe34d(%rip), %xmm0     # 0x146a8
jbe 0x6465
movsd 0x1d0(%rbx), %xmm1
movaps %xmm1, 0x10(%rsp)
movapd %xmm0, %xmm1
movapd %xmm0, (%rsp)
movhpd 0x1f0(%rbx), %xmm1      # xmm1 = xmm1[0],mem[0]
movapd 0xe279(%rip), %xmm0     # 0x14600
divpd %xmm1, %xmm0
movsd 0xe31d(%rip), %xmm1     # 0x146b0
addsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
mulsd %xmm1, %xmm0
callq 0x3570
movsd 0xe30c(%rip), %xmm3     # 0x146b8
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 0xe2c2(%rip), %xmm6     # 0x146c0
mulsd %xmm0, %xmm6
mulsd %xmm5, %xmm6
mulsd %xmm8, %xmm6
movsd 0xe2b5(%rip), %xmm5     # 0x146c8
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 0xe1da(%rip), %xmm3     # 0x14610
unpcklpd %xmm8, %xmm3            # xmm3 = xmm3[0],xmm8[0]
mulpd %xmm2, %xmm3
addpd %xmm5, %xmm3
mulpd 0xe1d5(%rip), %xmm3     # 0x14620
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 0x647d
movupd 0x1f0(%rbx), %xmm0
movhpd 0x1d8(%rbx), %xmm0      # xmm0 = xmm0[0],mem[0]
addpd 0xe173(%rip), %xmm0     # 0x145f0
movhpd %xmm0, 0x1d8(%rbx)
movlpd %xmm0, 0x1f0(%rbx)
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
movsd 0xe233(%rip), %xmm1     # 0x146d0
ucomisd %xmm2, %xmm1
ja 0x64b1
movsd 0xe22d(%rip), %xmm1     # 0x146d8
ucomisd %xmm1, %xmm2
jbe 0x64b9
movsd %xmm1, 0x1d8(%rbx)
movsd 0xe20f(%rip), %xmm1     # 0x146d0
ucomisd %xmm0, %xmm1
ja 0x64d5
movsd 0xe209(%rip), %xmm1     # 0x146d8
ucomisd %xmm1, %xmm0
jbe 0x64dd
movsd %xmm1, 0x1f0(%rbx)
addq $0x20, %rsp
popq %rbx
retq
nop