user: Translate the below assembly code into C programming language:

```asm
<CheckIfElecHop>:
  endbr64
  push   %r15
  mov    %edi,%r10d
  mov    %esi,%edi
  mov    %edx,%esi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    0x68(%rsp),%rbp
  mov    0x70(%rsp),%rbx
  mov    %rcx,0x8(%rsp)
  mov    0x78(%rsp),%r11
  mov    0xf0(%rsp),%rcx
  movsd  %xmm0,(%rsp)
  fldt   0xe0(%rsp)
  mov    0x80(%rsp),%r12
  mov    0x88(%rsp),%r14
  fildl  0x0(%rbp)
  mov    0x90(%rsp),%r13
  mov    0xc8(%rsp),%rdx
  fildl  (%rbx)
  mov    0xd0(%rsp),%rax
  mov    0xf8(%rsp),%r15
  fildl  (%r11)
  fildl  (%rcx)
  fldl   (%rsp)
  cmp    $0xffffffff,%r10d
  jne    L68
  cmpl   $0x1,0x100(%rsp)
  je     L68
  fldt   (%rax)
  mov    0x8(%rsp),%rcx
  addl   $0x1,(%rcx)
  fucomi %st(6),%st
  jp     L26
L91:
  jne    L26
  fstp   %st(0)
  fxch   %st(5)
L304:
  movl   $0x0,0x0(%rbp)
  movl   $0x0,(%rbx)
  movl   $0x0,(%r11)
  addl   $0x1,(%rdx)
  fld    %st(0)
  fstpt  (%rax)
  movl   $0x1,(%r15)
  jmp    L263
  cs nopw 0x0(%rax,%rax,1)
L75:
  fxch   %st(5)
  jmp    L263
  nopl   0x0(%rax)
L237:
  fxch   %st(5)
L263:
  cmp    $0xffffffff,%edi
  jne    L20
  cmpl   $0x1,0x108(%rsp)
  je     L20
  fldt   (%rax)
  addl   $0x1,(%r8)
  fucomi %st(1),%st
  jp     L114
L89:
  jne    L114
  fstp   %st(0)
L294:
  movl   $0x0,0x0(%rbp)
  movl   $0x0,(%rbx)
  movl   $0x0,(%r11)
  addl   $0x1,(%rdx)
  fld    %st(0)
  fstpt  (%rax)
  movl   $0x1,(%r15)
L152:
  cmp    $0xffffffff,%esi
  jne    L50
  cmpl   $0x1,0x110(%rsp)
  je     L50
  fldt   (%rax)
  addl   $0x1,(%r9)
  fucomi %st(1),%st
  jp     L295
  je     L184
  fxch   %st(5)
  jmp    L62
L295:
  fxch   %st(5)
  nopw   0x0(%rax,%rax,1)
L62:
  fmul   %st(6),%st
  fxch   %st(5)
  fsubr  %st(1),%st
  fmul   %st(2),%st
  fdivrp %st,%st(5)
  fldt   (%r12)
  faddp  %st,%st(5)
  fxch   %st(4)
  fstpt  (%r12)
  fxch   %st(2)
  fmul   %st(4),%st
  fldt   (%rax)
  fsubr  %st(4),%st
  fmul   %st(3),%st
  fdivrp %st,%st(1)
  fldt   (%r14)
  faddp  %st,%st(1)
  fstpt  (%r14)
  fmulp  %st,%st(3)
  fldt   (%rax)
  fsubr  %st(2),%st
  fmulp  %st,%st(1)
  fdivrp %st,%st(2)
  fldt   0x0(%r13)
  faddp  %st,%st(2)
  fxch   %st(1)
  fstpt  0x0(%r13)
  jmp    L301
  nopw   0x0(%rax,%rax,1)
L184:
  fstp   %st(0)
  fstp   %st(4)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(1)
  jmp    L301
  xchg   %ax,%ax
L141:
  fstp   %st(0)
  fstp   %st(4)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(1)
  nopl   0x0(%rax)
L301:
  movl   $0x0,0x0(%rbp)
  movl   $0x0,(%rbx)
  movl   $0x0,(%r11)
  addl   $0x1,(%rdx)
  fstpt  (%rax)
  movl   $0x1,(%r15)
  jmp    L161
  nopw   0x0(%rax,%rax,1)
L124:
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  jmp    L161
  cs nopw 0x0(%rax,%rax,1)
L76:
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
  fstp   %st(0)
L161:
  fldt   (%r12)
  fucomip %st(0),%st
  jp     L224
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L50:
  mov    0xa8(%rsp),%ecx
  imul   0xc0(%rsp),%ecx
  cmp    %esi,%ecx
  jne    L124
  mov    0xc0(%rsp),%ecx
  test   %ecx,%ecx
  je     L76
  fldt   (%rax)
  mov    0x60(%rsp),%rsi
  addl   $0x1,(%rsi)
  fucomi %st(1),%st
  jp     L71
  je     L141
  fxch   %st(5)
  jmp    L85
L71:
  fxch   %st(5)
  nopl   0x0(%rax,%rax,1)
L85:
  fmul   %st(6),%st
  fxch   %st(5)
  fsubr  %st(1),%st
  fmul   %st(2),%st
  fdivrp %st,%st(5)
  fldt   (%r12)
  faddp  %st,%st(5)
  fxch   %st(4)
  fstpt  (%r12)
  fxch   %st(2)
  fmul   %st(4),%st
  fldt   (%rax)
  fsubr  %st(4),%st
  fmul   %st(3),%st
  fdivrp %st,%st(1)
  fldt   (%r14)
  faddp  %st,%st(1)
  fstpt  (%r14)
  fmulp  %st,%st(3)
  fldt   (%rax)
  fsubr  %st(2),%st
  fmulp  %st,%st(1)
  fdivrp %st,%st(2)
  fldt   0x0(%r13)
  faddp  %st,%st(2)
  fxch   %st(1)
  fstpt  0x0(%r13)
  jmp    L301
  nopl   (%rax)
L20:
  mov    0xa0(%rsp),%ecx
  imul   0xb8(%rsp),%ecx
  cmp    %edi,%ecx
  jne    L152
  mov    0xb8(%rsp),%edi
  test   %edi,%edi
  je     L152
  fldt   (%rax)
  mov    0x58(%rsp),%rdi
  addl   $0x1,(%rdi)
  fucomi %st(1),%st
  jnp    L89
L114:
  fsubr  %st(1),%st
  fmul   %st(2),%st
  fld    %st(5)
  fmul   %st(7),%st
  fdivp  %st,%st(1)
  fldt   (%r12)
  faddp  %st,%st(1)
  fstpt  (%r12)
  fldt   (%rax)
  fsubr  %st(1),%st
  fmul   %st(2),%st
  fld    %st(4)
  fmul   %st(7),%st
  fdivp  %st,%st(1)
  fldt   (%r14)
  faddp  %st,%st(1)
  fstpt  (%r14)
  fldt   (%rax)
  fsubr  %st(1),%st
  fmul   %st(2),%st
  fld    %st(3)
  fmul   %st(7),%st
  fdivp  %st,%st(1)
  fldt   0x0(%r13)
  faddp  %st,%st(1)
  fstpt  0x0(%r13)
  jmp    L294
  nopl   0x0(%rax,%rax,1)
L68:
  mov    0x98(%rsp),%ecx
  imul   0xb0(%rsp),%ecx
  cmp    %r10d,%ecx
  jne    L75
  mov    0xb0(%rsp),%r10d
  test   %r10d,%r10d
  je     L237
  fldt   (%rax)
  mov    0x50(%rsp),%rcx
  addl   $0x1,(%rcx)
  fucomi %st(6),%st
  jnp    L91
  nopl   0x0(%rax,%rax,1)
L26:
  fsubr  %st(6),%st
  fmul   %st(2),%st
  fld    %st(5)
  fmul   %st(2),%st
  fdivp  %st,%st(1)
  fldt   (%r12)
  faddp  %st,%st(1)
  fstpt  (%r12)
  fldt   (%rax)
  fsubr  %st(6),%st
  fmul   %st(2),%st
  fld    %st(4)
  fmul   %st(2),%st
  fdivp  %st,%st(1)
  fldt   (%r14)
  faddp  %st,%st(1)
  fstpt  (%r14)
  fldt   (%rax)
  fsubr  %st(6),%st
  fmul   %st(2),%st
  fld    %st(3)
  fmul   %st(2),%st
  fdivp  %st,%st(1)
  fldt   0x0(%r13)
  faddp  %st,%st(1)
  fstpt  0x0(%r13)
  fxch   %st(5)
  jmp    L304
L224:
  lea    D4(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
```

tool_calls: name: read_data
arguments: data_label: D4
type: string

tool: D4: 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;
}
```