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

```asm
<sphx2s>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rdi,%rbp
  mov    %esi,%edi
  mov    %edx,0x5c(%rsp)
  mov    %ecx,%r14d
  mov    %r8d,%ebx
  mov    %r9,%r12
  mov    0xe0(%rsp),%r15
  mov    0xe8(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0xf0(%rsp),%rax
  mov    %rax,0x50(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  mov    %edx,%ecx
  mov    %esi,%r13d
  test   %edx,%edx
  jle    L164
L429:
  pxor   %xmm0,%xmm0
  ucomisd 0x20(%rbp),%xmm0
  jp     L445
  je     L3
L445:
  mov    %edi,%eax
  imul   %ebx,%eax
  test   %edi,%edi
  jle    L534
  cltq
  lea    0x0(,%rax,8),%rsi
  movslq %r14d,%r11
  shl    $0x3,%r11
  movslq %ebx,%r10
  shl    $0x3,%r10
  mov    0x48(%rsp),%r9
  mov    $0x0,%r8d
L609:
  movsd  (%r12),%xmm0
  subsd  0x10(%rbp),%xmm0
  mov    %r9,%rax
  test   %ecx,%ecx
  jle    L121
  mov    $0x0,%edx
L32:
  movsd  %xmm0,(%rax)
  add    %rsi,%rax
  add    $0x1,%edx
  cmp    %edx,%ecx
  jne    L32
L121:
  add    $0x1,%r8d
  add    %r11,%r12
  add    %r10,%r9
  cmp    %r8d,%edi
  jne    L609
L534:
  cmpl   $0x0,0x5c(%rsp)
  jle    L717
  movslq %ebx,%rbx
  lea    0x0(,%rbx,8),%rcx
  mov    %rcx,0x30(%rsp)
  movslq %r14d,%rax
  shl    $0x3,%rax
  mov    %rax,0x60(%rsp)
  lea    -0x1(%r13),%eax
  add    $0x1,%rax
  imul   %rcx,%rax
  mov    %rax,0x68(%rsp)
  movl   $0x0,0x58(%rsp)
  jmp    L396
L164:
  mov    %esi,0x5c(%rsp)
  mov    $0x1,%ecx
  mov    $0x1,%r13d
  jmp    L429
L3:
  ucomisd 0x8(%rbp),%xmm0
  jp     L363
  jne    L363
  movsd  D315(%rip),%xmm0
  addsd  0x0(%rbp),%xmm0
  subsd  0x10(%rbp),%xmm0
  movsd  D278(%rip),%xmm1
  call   <fmod@plt>
  movapd %xmm0,%xmm3
  mov    0x5c(%rsp),%eax
  test   %eax,%eax
  jle    L717
  movslq %ebx,%rdi
  shl    $0x3,%rdi
  movslq %r14d,%r8
  shl    $0x3,%r8
  lea    -0x1(%r13),%r10d
  add    $0x1,%r10
  mov    %rdi,%r11
  imul   %r10,%r11
  imul   %r8,%r10
  mov    $0x0,%r9d
  pxor   %xmm7,%xmm7
  movsd  D278(%rip),%xmm10
  movsd  D207(%rip),%xmm6
  movapd %xmm10,%xmm9
  movapd %xmm10,%xmm5
  mov    %r10,0x8(%rsp)
  mov    %eax,%r10d
  mov    0x48(%rsp),%rbx
  mov    0x50(%rsp),%r14
  jmp    L426
L620:
  movsd  (%rax),%xmm0
  comisd %xmm7,%xmm0
  jbe    L97
  subsd  %xmm10,%xmm0
  movsd  %xmm0,(%rax)
L97:
  movsd  (%rax),%xmm0
  comisd %xmm1,%xmm0
  jbe    L466
  subsd  %xmm5,%xmm0
  movsd  %xmm0,(%rax)
L20:
  add    %rdi,%rax
  add    %rdi,%rsi
  add    $0x1,%ecx
  add    %r8,%rdx
  cmp    %ecx,%r13d
  je     L551
L707:
  movapd %xmm3,%xmm0
  addsd  (%r12,%rdx,1),%xmm0
  movsd  %xmm0,(%rax)
  movsd  (%r15,%rdx,1),%xmm0
  movsd  %xmm0,(%rsi)
  movsd  0x0(%rbp),%xmm0
  comisd %xmm2,%xmm0
  jb     L620
  movsd  (%rax),%xmm0
  comisd %xmm0,%xmm4
  jbe    L97
  addsd  %xmm8,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L97
L466:
  comisd %xmm0,%xmm6
  jbe    L20
  addsd  %xmm9,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L20
L551:
  add    %r11,%rbx
  add    %r11,%r14
  mov    0x8(%rsp),%rax
  add    %rax,%r12
  add    %rax,%r15
L56:
  add    $0x1,%r9d
  cmp    %r9d,%r10d
  je     L717
L426:
  test   %r13d,%r13d
  jle    L56
  mov    %rbx,%rax
  mov    %r14,%rsi
  mov    $0x0,%edx
  mov    $0x0,%ecx
  pxor   %xmm2,%xmm2
  movapd %xmm2,%xmm4
  movsd  D278(%rip),%xmm8
  movapd %xmm8,%xmm1
  jmp    L707
L363:
  movsd  0x0(%rbp),%xmm0
  addsd  0x10(%rbp),%xmm0
  movsd  D278(%rip),%xmm1
  call   <fmod@plt>
  movapd %xmm0,%xmm2
  mov    0x5c(%rsp),%eax
  test   %eax,%eax
  jle    L717
  movslq %ebx,%rdi
  shl    $0x3,%rdi
  movslq %r14d,%r8
  shl    $0x3,%r8
  lea    -0x1(%r13),%r10d
  add    $0x1,%r10
  mov    %rdi,%r11
  imul   %r10,%r11
  imul   %r8,%r10
  mov    $0x0,%r9d
  movq   D174(%rip),%xmm4
  pxor   %xmm3,%xmm3
  movapd %xmm3,%xmm8
  movsd  D207(%rip),%xmm7
  movsd  D278(%rip),%xmm11
  movapd %xmm11,%xmm6
  mov    %r10,0x8(%rsp)
  mov    %eax,%r10d
  mov    0x48(%rsp),%rbx
  mov    0x50(%rsp),%r14
  jmp    L366
L550:
  movsd  (%rax),%xmm0
  comisd %xmm8,%xmm0
  jbe    L364
  subsd  %xmm10,%xmm0
  movsd  %xmm0,(%rax)
L364:
  movsd  (%rax),%xmm0
  comisd %xmm1,%xmm0
  jbe    L336
  subsd  %xmm6,%xmm0
  movsd  %xmm0,(%rax)
L674:
  add    %rdi,%rax
  add    %rdi,%rsi
  add    $0x1,%ecx
  add    %r8,%rdx
  cmp    %ecx,%r13d
  je     L142
L367:
  movapd %xmm2,%xmm0
  subsd  (%r12,%rdx,1),%xmm0
  movsd  %xmm0,(%rax)
  movsd  (%r15,%rdx,1),%xmm0
  xorpd  %xmm4,%xmm0
  movsd  %xmm0,(%rsi)
  movsd  0x0(%rbp),%xmm0
  comisd %xmm3,%xmm0
  jb     L550
  movsd  (%rax),%xmm0
  comisd %xmm0,%xmm5
  jbe    L364
  addsd  %xmm9,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L364
L336:
  comisd %xmm0,%xmm7
  jbe    L674
  addsd  %xmm11,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L674
L142:
  add    %r11,%rbx
  add    %r11,%r14
  mov    0x8(%rsp),%rax
  add    %rax,%r12
  add    %rax,%r15
L8:
  add    $0x1,%r9d
  cmp    %r9d,%r10d
  je     L717
L366:
  test   %r13d,%r13d
  jle    L8
  mov    %rbx,%rax
  mov    %r14,%rsi
  mov    $0x0,%edx
  mov    $0x0,%ecx
  movsd  D278(%rip),%xmm10
  pxor   %xmm5,%xmm5
  movapd %xmm10,%xmm9
  movapd %xmm10,%xmm1
  jmp    L367
L536:
  movsd  (%r15),%xmm0
  addsd  0x8(%rbp),%xmm0
  mov    $0x1,%eax
  call   <cosd@plt>
  movsd  D13(%rip),%xmm0
  subsd  0x78(%rsp),%xmm0
  mulsd  0x20(%rsp),%xmm0
  neg    %eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rsp)
  jmp    L423
L21:
  movsd  0x8(%rsp),%xmm1
  movsd  0x18(%rsp),%xmm0
  mov    $0x2,%eax
  call   <atan2d@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  jmp    L134
L156:
  movsd  0x10(%rsp),%xmm0
  xorpd  D174(%rip),%xmm0
  jmp    L134
L123:
  addsd  D278(%rip),%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L438
L614:
  comisd D210(%rip),%xmm0
  jbe    L438
  subsd  D278(%rip),%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L438
L207:
  movsd  D207(%rip),%xmm1
  comisd %xmm0,%xmm1
  jbe    L0
  addsd  D278(%rip),%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L0
L29:
  movsd  D315(%rip),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%r12)
  jmp    L642
L664:
  movsd  0x38(%rsp),%xmm0
  mulsd  0x78(%rsp),%xmm0
  addsd  0x40(%rsp),%xmm0
  movapd %xmm0,%xmm1
  andpd  D364(%rip),%xmm1
  comisd D188(%rip),%xmm1
  jbe    L102
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  ja     L373
  movsd  0x8(%rsp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  0x18(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L505
  sqrtsd %xmm0,%xmm0
L100:
  mov    $0x1,%eax
  call   <acosd@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  andpd  D364(%rip),%xmm0
L209:
  movsd  %xmm0,(%r12)
L433:
  add    $0x1,%r14d
  mov    0x30(%rsp),%rax
  add    %rax,%rbx
  add    %rax,%r12
  cmp    %r14d,%r13d
  je     L59
L434:
  movsd  (%rbx),%xmm5
  movsd  %xmm5,0x10(%rsp)
  lea    0x78(%rsp),%rsi
  lea    0x88(%rsp),%rdi
  movapd %xmm5,%xmm0
  mov    $0x1,%eax
  call   <sincosd@plt>
  movsd  0x20(%rsp),%xmm0
  mulsd  0x78(%rsp),%xmm0
  movsd  0x28(%rsp),%xmm7
  subsd  %xmm0,%xmm7
  movsd  %xmm7,0x8(%rsp)
  movapd %xmm7,%xmm0
  andpd  D364(%rip),%xmm0
  movsd  D343(%rip),%xmm1
  comisd %xmm0,%xmm1
  ja     L536
L423:
  movsd  0x80(%rsp),%xmm0
  xorpd  D174(%rip),%xmm0
  movapd %xmm0,%xmm6
  mulsd  0x88(%rsp),%xmm6
  movsd  %xmm6,0x18(%rsp)
  movsd  0x8(%rsp),%xmm4
  ucomisd D210(%rip),%xmm4
  setp   %al
  mov    $0x1,%edx
  cmovne %edx,%eax
  test   %al,%al
  jne    L21
  ucomisd D210(%rip),%xmm6
  setp   %al
  cmovne %edx,%eax
  test   %al,%al
  jne    L21
  movsd  D297(%rip),%xmm0
  comisd 0x8(%rbp),%xmm0
  jbe    L156
  movsd  0x10(%rsp),%xmm0
  addsd  D315(%rip),%xmm0
L134:
  addsd  0x0(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  0x0(%rbp),%xmm1
  comisd D210(%rip),%xmm1
  jb     L614
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  ja     L123
L438:
  movsd  (%rbx),%xmm0
  comisd D278(%rip),%xmm0
  jbe    L207
  subsd  D278(%rip),%xmm0
  movsd  %xmm0,(%rbx)
L0:
  movsd  D315(%rip),%xmm1
  movsd  0x10(%rsp),%xmm0
  call   <fmod@plt>
  ucomisd D210(%rip),%xmm0
  jp     L664
  jne    L664
  movsd  0x8(%rbp),%xmm0
  mulsd  0x78(%rsp),%xmm0
  addsd  (%r15),%xmm0
  comisd D297(%rip),%xmm0
  ja     L29
  movsd  %xmm0,(%r12)
L642:
  movsd  (%r12),%xmm0
  movsd  D337(%rip),%xmm1
  comisd %xmm0,%xmm1
  jbe    L433
  movsd  D327(%rip),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%r12)
  jmp    L433
L373:
  movsd  0x8(%rsp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  0x18(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L618
  sqrtsd %xmm0,%xmm0
L30:
  mov    $0x1,%eax
  call   <acosd@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  orpd   D174(%rip),%xmm0
  jmp    L209
L618:
  call   <sqrt@plt>
  jmp    L30
L505:
  call   <sqrt@plt>
  jmp    L100
L102:
  mov    $0x1,%eax
  call   <asind@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,(%r12)
  jmp    L433
L59:
  mov    0x68(%rsp),%rcx
  add    %rcx,0x48(%rsp)
  add    %rcx,0x50(%rsp)
L559:
  addl   $0x1,0x58(%rsp)
  mov    0x58(%rsp),%eax
  add    0x60(%rsp),%r15
  cmp    %eax,0x5c(%rsp)
  je     L717
L396:
  lea    0x80(%rsp),%rsi
  lea    0x90(%rsp),%rdi
  movsd  (%r15),%xmm0
  mov    $0x1,%eax
  call   <sincosd@plt>
  movsd  0x18(%rbp),%xmm2
  movsd  0x80(%rsp),%xmm0
  movapd %xmm2,%xmm3
  mulsd  %xmm0,%xmm3
  movsd  %xmm3,0x20(%rsp)
  movsd  0x20(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x38(%rsp)
  movsd  0x90(%rsp),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  %xmm2,0x40(%rsp)
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x28(%rsp)
  test   %r13d,%r13d
  jle    L559
  mov    0x48(%rsp),%rbx
  mov    0x50(%rsp),%r12
  mov    $0x0,%r14d
  jmp    L434
L717:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L89
  mov    $0x0,%eax
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L89:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D315
type_guessed: f64
name: retrieve_data
arguments: data_tag: D278
type_guessed: f64[2]
name: retrieve_data
arguments: data_tag: D207
type_guessed: f32[2]
name: retrieve_data
arguments: data_tag: D174
type_guessed: f32[4]
name: retrieve_data
arguments: data_tag: D13
type_guessed: f64
name: retrieve_data
arguments: data_tag: D210
type_guessed: f32[4]
name: retrieve_data
arguments: data_tag: D364
type_guessed: qword[2]
name: retrieve_data
arguments: data_tag: D188
type_guessed: f64[2]
name: retrieve_data
arguments: data_tag: D343
type_guessed: byte[8]
name: retrieve_data
arguments: data_tag: D297
type_guessed: f64[2]
name: retrieve_data
arguments: data_tag: D337
type_guessed: f32[2]
name: retrieve_data
arguments: data_tag: D327
type_guessed: f32[2]

tool: D315: 180

tool: {"D278": [360.0,180.0]}

tool: {"D207": [0.0,-3.8515625]}

tool: {"D174": [0.0,-0.0,0.0,0.0]}

tool: D13: 1

tool: {"D210": [0.0,0.0,null,null]}

tool: {"D364": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D188": [0.99,0.0]}

tool: {"D343": [0xf1,0x68,0xe3,0x88,0xb5,0xf8,0xe4,0x3e]}

tool: {"D297": [90.0,-90.0]}

tool: {"D337": [0.0,-3.3515625]}

tool: {"D327": [0.0,-3.6015625]}

assistant: ```c
int sphx2s(const double eul[5], int nphi, int ntheta, int spt, int sll, const double phi[], const double theta[], double lng[], double lat[]) {
  int mphi, mtheta, rowlen, rowoff;
  double cosphi, costhe, costhe3, costhe4, dlng, dphi, sinphi, sinthe, sinthe3, sinthe4, x, y, z;
  register int iphi, itheta;
  register const double *phip, *thetap;
  register double *latp, *lngp;
  if (ntheta > 0) {
    mphi = nphi;
    mtheta = ntheta;
  } else {
    mphi = 1;
    mtheta = 1;
    ntheta = nphi;
  }
  if (eul[4] == 0.0) {
    if (eul[1] == 0.0) {
      dlng = fmod(eul[0] + 180.0 - eul[2], 360.0);
      lngp = lng;
      latp = lat;
      phip = phi;
      thetap = theta;
      for (itheta = 0; itheta < ntheta; itheta++) {
        for (iphi = 0; iphi < mphi; iphi++) {
          *lngp = *phip + dlng;
          *latp = *thetap;
          if (eul[0] >= 0.0) {
            if (*lngp < 0.0)
              *lngp += 360.0;
          } else {
            if (*lngp > 0.0)
              *lngp -= 360.0;
          }
          if (*lngp > 360.0) {
            *lngp -= 360.0;
          } else if (*lngp < -360.0) {
            *lngp += 360.0;
          }
          lngp += sll;
          latp += sll;
          phip += spt;
          thetap += spt;
        }
      }
    } else {
      dlng = fmod(eul[0] + eul[2], 360.0);
      lngp = lng;
      latp = lat;
      phip = phi;
      thetap = theta;
      for (itheta = 0; itheta < ntheta; itheta++) {
        for (iphi = 0; iphi < mphi; iphi++) {
          *lngp = dlng - *phip;
          *latp = -(*thetap);
          if (eul[0] >= 0.0) {
            if (*lngp < 0.0)
              *lngp += 360.0;
          } else {
            if (*lngp > 0.0)
              *lngp -= 360.0;
          }
          if (*lngp > 360.0) {
            *lngp -= 360.0;
          } else if (*lngp < -360.0) {
            *lngp += 360.0;
          }
          lngp += sll;
          latp += sll;
          phip += spt;
          thetap += spt;
        }
      }
    }
    return 0;
  }
  phip = phi;
  rowoff = 0;
  rowlen = nphi * sll;
  for (iphi = 0; iphi < nphi; iphi++, rowoff += sll, phip += spt) {
    dphi = *phip - eul[2];
    lngp = lng + rowoff;
    for (itheta = 0; itheta < mtheta; itheta++) {
      *lngp = dphi;
      lngp += rowlen;
    }
  }
  thetap = theta;
  lngp = lng;
  latp = lat;
  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {
    sincosd(*thetap, &sinthe, &costhe);
    costhe3 = costhe * eul[3];
    costhe4 = costhe * eul[4];
    sinthe3 = sinthe * eul[3];
    sinthe4 = sinthe * eul[4];
    for (iphi = 0; iphi < mphi; iphi++, lngp += sll, latp += sll) {
      dphi = *lngp;
      sincosd(dphi, &sinphi, &cosphi);
      x = sinthe4 - costhe3 * cosphi;
      if (fabs(x) < 1.0e-5) {
        x = -cosd(*thetap + eul[1]) + costhe3 * (1.0 - cosphi);
      }
      y = -costhe * sinphi;
      if (x != 0.0 || y != 0.0) {
        dlng = atan2d(y, x);
      } else {
        if (eul[1] < 90.0) {
          dlng = dphi + 180.0;
        } else {
          dlng = -dphi;
        }
      }
      *lngp = eul[0] + dlng;
      if (eul[0] >= 0.0) {
        if (*lngp < 0.0)
          *lngp += 360.0;
      } else {
        if (*lngp > 0.0)
          *lngp -= 360.0;
      }
      if (*lngp > 360.0) {
        *lngp -= 360.0;
      } else if (*lngp < -360.0) {
        *lngp += 360.0;
      }
      if (fmod(dphi, 180.0) == 0.0) {
        *latp = *thetap + cosphi * eul[1];
        if (*latp > 90.0)
          *latp = 180.0 - *latp;
        if (*latp < -90.0)
          *latp = -180.0 - *latp;
      } else {
        z = sinthe3 + costhe4 * cosphi;
        if (fabs(z) > 0.99) {
          *latp = ((z) < 0.0 ? -fabs(acosd(sqrt(x * x + y * y))) : fabs(acosd(sqrt(x * x + y * y))));
        } else {
          *latp = asind(z);
        }
      }
    }
  }
  return 0;
}
```