user: What would the C source look like for the assembly code provided here:

```asm
<CheckIfElecHop>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %edi,-0x54(%rbp)
  mov    %esi,-0x58(%rbp)
  mov    %edx,-0x5c(%rbp)
  mov    %rcx,-0x68(%rbp)
  mov    %r8,-0x70(%rbp)
  mov    %r9,-0x78(%rbp)
  movsd  %xmm0,-0x80(%rbp)
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x60(%rbp)
  fildl  -0x60(%rbp)
  fstpt  -0x50(%rbp)
  mov    0x30(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x60(%rbp)
  fildl  -0x60(%rbp)
  fstpt  -0x40(%rbp)
  mov    0x38(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x60(%rbp)
  fildl  -0x60(%rbp)
  fstpt  -0x30(%rbp)
  mov    0xb0(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x60(%rbp)
  fildl  -0x60(%rbp)
  fstpt  -0x20(%rbp)
  fldl   -0x80(%rbp)
  fstpt  -0x10(%rbp)
  cmpl   $0xffffffff,-0x54(%rbp)
  jne    L288
  cmpl   $0x1,0xc0(%rbp)
  je     L288
  mov    -0x68(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x68(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  jp     L301
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  fstp   %st(0)
  je     L160
  jmp    L34
L301:
  fstp   %st(0)
L34:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fldt   -0x50(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x40(%rbp),%rax
  fstpt  (%rax)
  mov    0x48(%rbp),%rax
  fldt   (%rax)
  fldt   -0x40(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x48(%rbp),%rax
  fstpt  (%rax)
  mov    0x50(%rbp),%rax
  fldt   (%rax)
  fldt   -0x30(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x50(%rbp),%rax
  fstpt  (%rax)
L160:
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x88(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x88(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   0xa0(%rbp)
  fstpt  (%rax)
  mov    0xb8(%rbp),%rax
  movl   $0x1,(%rax)
  jmp    L124
L288:
  mov    0x58(%rbp),%eax
  imul   0x70(%rbp),%eax
  cmp    %eax,-0x54(%rbp)
  jne    L124
  cmpl   $0x0,0x70(%rbp)
  je     L124
  mov    0x10(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  jp     L66
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  fstp   %st(0)
  je     L92
  jmp    L245
L66:
  fstp   %st(0)
L245:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fldt   -0x50(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x40(%rbp),%rax
  fstpt  (%rax)
  mov    0x48(%rbp),%rax
  fldt   (%rax)
  fldt   -0x40(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x48(%rbp),%rax
  fstpt  (%rax)
  mov    0x50(%rbp),%rax
  fldt   (%rax)
  fldt   -0x30(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x50(%rbp),%rax
  fstpt  (%rax)
L92:
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x88(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x88(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   0xa0(%rbp)
  fstpt  (%rax)
  mov    0xb8(%rbp),%rax
  movl   $0x1,(%rax)
L124:
  cmpl   $0xffffffff,-0x58(%rbp)
  jne    L126
  cmpl   $0x1,0xc8(%rbp)
  je     L126
  mov    -0x70(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  jp     L22
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  fstp   %st(0)
  je     L180
  jmp    L197
L22:
  fstp   %st(0)
L197:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fldt   -0x50(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x40(%rbp),%rax
  fstpt  (%rax)
  mov    0x48(%rbp),%rax
  fldt   (%rax)
  fldt   -0x40(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x48(%rbp),%rax
  fstpt  (%rax)
  mov    0x50(%rbp),%rax
  fldt   (%rax)
  fldt   -0x30(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x50(%rbp),%rax
  fstpt  (%rax)
L180:
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x88(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x88(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   0xa0(%rbp)
  fstpt  (%rax)
  mov    0xb8(%rbp),%rax
  movl   $0x1,(%rax)
  jmp    L63
L126:
  mov    0x60(%rbp),%eax
  imul   0x78(%rbp),%eax
  cmp    %eax,-0x58(%rbp)
  jne    L63
  cmpl   $0x0,0x78(%rbp)
  je     L63
  mov    0x18(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x18(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  jp     L337
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  fstp   %st(0)
  je     L239
  jmp    L192
L337:
  fstp   %st(0)
L192:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fldt   -0x50(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x40(%rbp),%rax
  fstpt  (%rax)
  mov    0x48(%rbp),%rax
  fldt   (%rax)
  fldt   -0x40(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x48(%rbp),%rax
  fstpt  (%rax)
  mov    0x50(%rbp),%rax
  fldt   (%rax)
  fldt   -0x30(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x50(%rbp),%rax
  fstpt  (%rax)
L239:
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x88(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x88(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   0xa0(%rbp)
  fstpt  (%rax)
  mov    0xb8(%rbp),%rax
  movl   $0x1,(%rax)
L63:
  cmpl   $0xffffffff,-0x5c(%rbp)
  jne    L233
  cmpl   $0x1,0xd0(%rbp)
  je     L233
  mov    -0x78(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x78(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  jp     L27
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  fstp   %st(0)
  je     L225
  jmp    L324
L27:
  fstp   %st(0)
L324:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fldt   -0x50(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x40(%rbp),%rax
  fstpt  (%rax)
  mov    0x48(%rbp),%rax
  fldt   (%rax)
  fldt   -0x40(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x48(%rbp),%rax
  fstpt  (%rax)
  mov    0x50(%rbp),%rax
  fldt   (%rax)
  fldt   -0x30(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x50(%rbp),%rax
  fstpt  (%rax)
L225:
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x88(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x88(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   0xa0(%rbp)
  fstpt  (%rax)
  mov    0xb8(%rbp),%rax
  movl   $0x1,(%rax)
  jmp    L33
L233:
  mov    0x68(%rbp),%eax
  imul   0x80(%rbp),%eax
  cmp    %eax,-0x5c(%rbp)
  jne    L33
  cmpl   $0x0,0x80(%rbp)
  je     L33
  mov    0x20(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x20(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  jp     L140
  fldt   0xa0(%rbp)
  fucomip %st(1),%st
  fstp   %st(0)
  je     L318
  jmp    L227
L140:
  fstp   %st(0)
L227:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fldt   -0x50(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x40(%rbp),%rax
  fstpt  (%rax)
  mov    0x48(%rbp),%rax
  fldt   (%rax)
  fldt   -0x40(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x48(%rbp),%rax
  fstpt  (%rax)
  mov    0x50(%rbp),%rax
  fldt   (%rax)
  fldt   -0x30(%rbp)
  fldt   -0x10(%rbp)
  fmulp  %st,%st(1)
  mov    0x90(%rbp),%rax
  fldt   (%rax)
  fldt   0xa0(%rbp)
  fsubp  %st,%st(1)
  fldt   -0x20(%rbp)
  fmulp  %st,%st(1)
  fdivrp %st,%st(1)
  faddp  %st,%st(1)
  mov    0x50(%rbp),%rax
  fstpt  (%rax)
L318:
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x38(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x88(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x88(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x90(%rbp),%rax
  fldt   0xa0(%rbp)
  fstpt  (%rax)
  mov    0xb8(%rbp),%rax
  movl   $0x1,(%rax)
L33:
  mov    0x40(%rbp),%rax
  fldt   (%rax)
  fucomip %st(0),%st
  jnp    L133
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L133:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D5
type: string

tool: D5: ERROR *TotalVelX is nan!

assistant: ```c
int CheckIfElecHop(int xx, int yy, int zz, int *Xsource, int *Ysource, int *Zsource, int *Xdrain, int *Ydrain, int *Zdrain, int *TrackX, int *TrackY, int *TrackZ, long double *TotalVelX, long double *TotalVelY, long double *TotalVelZ, const int SLength, const int SWidth, const int SHeight, const int EndX, const int EndY, const int EndZ, int *NumAvgVel, long double *TimeTrack1, long double t, double SiteDistance, int *nc, int *ElecExit, const int PeriodicX, const int PeriodicY, const int PeriodicZ) {
  long double TrackX2 = (long double)(*TrackX);
  long double TrackY2 = (long double)(*TrackY);
  long double TrackZ2 = (long double)(*TrackZ);
  long double nc2 = (long double)(*nc);
  long double SiteDistance2 = (long double)SiteDistance;
  if (xx == -1 && PeriodicX != 1) {
    (*Xsource) = *Xsource + 1;
    if (t != *TimeTrack1) {
      (*TotalVelX) = (*TotalVelX) + (TrackX2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelY) = (*TotalVelY) + (TrackY2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelZ) = (*TotalVelZ) + (TrackZ2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
    }
    (*TrackX) = 0;
    (*TrackY) = 0;
    (*TrackZ) = 0;
    (*NumAvgVel) = *NumAvgVel + 1;
    (*TimeTrack1) = t;
    (*ElecExit) = 1;
  } else if (xx == SLength * EndX && EndX != 0) {
    (*Xdrain) = *Xdrain + 1;
    if (t != *TimeTrack1) {
      (*TotalVelX) = (*TotalVelX) + (TrackX2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelY) = (*TotalVelY) + (TrackY2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelZ) = (*TotalVelZ) + (TrackZ2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
    }
    (*TrackX) = 0;
    (*TrackY) = 0;
    (*TrackZ) = 0;
    (*NumAvgVel) = *NumAvgVel + 1;
    (*TimeTrack1) = t;
    (*ElecExit) = 1;
  }
  if (yy == -1 && PeriodicY != 1) {
    (*Ysource) = *Ysource + 1;
    if (t != *TimeTrack1) {
      (*TotalVelX) = (*TotalVelX) + (TrackX2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelY) = (*TotalVelY) + (TrackY2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelZ) = (*TotalVelZ) + (TrackZ2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
    }
    (*TrackX) = 0;
    (*TrackY) = 0;
    (*TrackZ) = 0;
    (*NumAvgVel) = *NumAvgVel + 1;
    (*TimeTrack1) = t;
    (*ElecExit) = 1;
  } else if (yy == SWidth * EndY && EndY != 0) {
    (*Ydrain) = *Ydrain + 1;
    if (t != *TimeTrack1) {
      (*TotalVelX) = (*TotalVelX) + (TrackX2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelY) = (*TotalVelY) + (TrackY2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelZ) = (*TotalVelZ) + (TrackZ2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
    }
    (*TrackX) = 0;
    (*TrackY) = 0;
    (*TrackZ) = 0;
    (*NumAvgVel) = *NumAvgVel + 1;
    (*TimeTrack1) = t;
    (*ElecExit) = 1;
  }
  if (zz == -1 && PeriodicZ != 1) {
    (*Zsource) = *Zsource + 1;
    if (t != *TimeTrack1) {
      (*TotalVelX) = (*TotalVelX) + (TrackX2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelY) = (*TotalVelY) + (TrackY2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelZ) = (*TotalVelZ) + (TrackZ2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
    }
    (*TrackX) = 0;
    (*TrackY) = 0;
    (*TrackZ) = 0;
    (*NumAvgVel) = *NumAvgVel + 1;
    (*TimeTrack1) = t;
    (*ElecExit) = 1;
  } else if (zz == SHeight * EndZ && EndZ != 0) {
    (*Zdrain) = *Zdrain + 1;
    if (t != *TimeTrack1) {
      (*TotalVelX) = (*TotalVelX) + (TrackX2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelY) = (*TotalVelY) + (TrackY2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
      (*TotalVelZ) = (*TotalVelZ) + (TrackZ2) * (SiteDistance2) / ((t - (*TimeTrack1)) * (nc2));
    }
    (*TrackX) = 0;
    (*TrackY) = 0;
    (*TrackZ) = 0;
    (*NumAvgVel) = *NumAvgVel + 1;
    (*TimeTrack1) = t;
    (*ElecExit) = 1;
  }
  if (isnan(*TotalVelX)) {
    printf("ERROR *TotalVelX is nan!\n");
    exit(1);
  }
  return 0;
}
```