// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/kinetic_tnm.c
// Function: Normal_vector
void Normal_vector(double *v, struct bond *bond, double *vers)
{
  double *r0=NULL; int j;
  if((bond)&&(bond->previous)&&(bond->previous->previous)&&
     (bond->previous->previous->atom)){
    r0=bond->previous->previous->atom->r;
  }
  if(r0==NULL){
    printf("ERROR, no previous atom found for bond angle\n");
    goto error_normal;
  }
  double *r1=bond->previous->atom->r, dr[3];
  for(j=0; j<3; j++)dr[j]=r1[j]-r0[j];
  Vector_product_d(v, vers, dr);
  // Normalize:
  double v2=0; for(j=0; j<3; j++)v2+=v[j]*v[j];
  if(v2<=0){
    printf("ERROR for bond angle, zero norm (%.6f) of rotation axis\n",v2);
    goto error_normal;
  }
  v2=1./sqrt(v2); for(j=0; j<3; j++)v[j]*=v2;
  return;
 error_normal:
  printf("atoms: %s %d %s %d prev. bond: %d prev. prev.: %d\n",
	 bond->previous->atom->name, bond->previous->atom->res,
	 bond->atom->name, bond->atom->res,
	 bond->previous->i_atom, bond->previous->previous->i_atom);
  exit(8);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x313c2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x313c2
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x28(%rax)
je 0x313c2
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
cmpq $0x0, (%rax)
je 0x313c2
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x313dc
leaq 0x4c7de(%rip), %rdi     # 0x7dbae
movb $0x0, %al
callq 0x10d0
jmp 0x314f6
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x3, -0x24(%rbp)
jge 0x31427
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movslq -0x24(%rbp), %rax
movsd %xmm0, -0x50(%rbp,%rax,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x313f2
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x14aa0
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x3, -0x24(%rbp)
jge 0x31484
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x58(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x31447
xorps %xmm0, %xmm0
ucomisd -0x58(%rbp), %xmm0
jb 0x314a3
movsd -0x58(%rbp), %xmm0
leaq 0x4c742(%rip), %rdi     # 0x7dbdc
movb $0x1, %al
callq 0x10d0
jmp 0x314f6
movsd -0x58(%rbp), %xmm0
callq 0x1220
movaps %xmm0, %xmm1
movsd 0x44b90(%rip), %xmm0    # 0x76048
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x3, -0x24(%rbp)
jge 0x314f0
movsd -0x58(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x314c8
addq $0x60, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rsi
addq $0x18, %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movl 0x64(%rax), %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x18, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x64(%rax), %r8d
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x20(%rax), %r9d
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movl 0x20(%rax), %eax
leaq 0x4c6ca(%rip), %rdi     # 0x7dc15
movl %eax, (%rsp)
movb $0x0, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
nop