user: 下面的汇编指令对应的C源代码是什么：

```asm
<sphx2s>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xc8,%rsp
  mov    %rdi,-0xb8(%rbp)
  mov    %esi,-0xbc(%rbp)
  mov    %edx,-0xc0(%rbp)
  mov    %ecx,-0xc4(%rbp)
  mov    %r8d,-0xc8(%rbp)
  mov    %r9,-0xd0(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0xd8(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0xe0(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0xe8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0xc0(%rbp)
  jle    L103
  mov    -0xbc(%rbp),%eax
  mov    %eax,-0xb0(%rbp)
  mov    -0xc0(%rbp),%eax
  mov    %eax,-0xac(%rbp)
  jmp    L573
L103:
  movl   $0x1,-0xb0(%rbp)
  movl   $0x1,-0xac(%rbp)
  mov    -0xbc(%rbp),%eax
  mov    %eax,-0xc0(%rbp)
L573:
  mov    -0xb8(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L624
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jne    L624
  mov    -0xb8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L489
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jne    L489
  mov    -0xb8(%rbp),%rax
  movsd  (%rax),%xmm1
  movsd  D367(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0xb8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movsd  D6(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  mov    -0xe0(%rbp),%rbx
  mov    -0xe8(%rbp),%r12
  mov    -0xd0(%rbp),%rax
  mov    %rax,%rsi
  mov    -0xd8(%rbp),%r15
  mov    $0x0,%r13d
  jmp    L97
L5:
  mov    $0x0,%r14d
  jmp    L615
L51:
  mov    %rsi,%rax
  movsd  (%rax),%xmm0
  addsd  -0x80(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%r15),%xmm0
  movsd  %xmm0,(%r12)
  mov    -0xb8(%rbp),%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L10
  movsd  (%rbx),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L237
  movsd  (%rbx),%xmm1
  movsd  D6(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L237
L10:
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L237
  movsd  (%rbx),%xmm0
  movsd  D6(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L237:
  movsd  (%rbx),%xmm0
  comisd D6(%rip),%xmm0
  jbe    L52
  movsd  (%rbx),%xmm0
  movsd  D6(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L606
L52:
  movsd  (%rbx),%xmm1
  movsd  D98(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L606
  movsd  (%rbx),%xmm1
  movsd  D6(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L606:
  mov    -0xc8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  mov    -0xc8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r12
  mov    -0xc4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rsi
  mov    -0xc4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r15
  add    $0x1,%r14d
L615:
  cmp    -0xb0(%rbp),%r14d
  jl     L51
  add    $0x1,%r13d
L97:
  cmp    -0xc0(%rbp),%r13d
  jl     L5
  jmp    L7
L489:
  mov    -0xb8(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0xb8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movsd  D6(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  mov    -0xe0(%rbp),%rbx
  mov    -0xe8(%rbp),%r12
  mov    -0xd0(%rbp),%rax
  mov    %rax,%rsi
  mov    -0xd8(%rbp),%r15
  mov    $0x0,%r13d
  jmp    L430
L321:
  mov    $0x0,%r14d
  jmp    L450
L599:
  mov    %rsi,%rax
  movsd  (%rax),%xmm1
  movsd  -0x80(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%r15),%xmm0
  movq   D193(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  mov    -0xb8(%rbp),%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L493
  movsd  (%rbx),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L60
  movsd  (%rbx),%xmm1
  movsd  D6(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L60
L493:
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L60
  movsd  (%rbx),%xmm0
  movsd  D6(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L60:
  movsd  (%rbx),%xmm0
  comisd D6(%rip),%xmm0
  jbe    L9
  movsd  (%rbx),%xmm0
  movsd  D6(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L529
L9:
  movsd  (%rbx),%xmm1
  movsd  D98(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L529
  movsd  (%rbx),%xmm1
  movsd  D6(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L529:
  mov    -0xc8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  mov    -0xc8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r12
  mov    -0xc4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rsi,%rdi
  add    %rax,%rdi
  mov    %rdi,%rsi
  mov    -0xc4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r15
  add    $0x1,%r14d
L450:
  cmp    -0xb0(%rbp),%r14d
  jl     L599
  add    $0x1,%r13d
L430:
  cmp    -0xc0(%rbp),%r13d
  jl     L321
L7:
  mov    $0x0,%eax
  jmp    L99
L624:
  mov    -0xd0(%rbp),%rax
  mov    %rax,%rsi
  movl   $0x0,-0xa8(%rbp)
  mov    -0xbc(%rbp),%eax
  imul   -0xc8(%rbp),%eax
  mov    %eax,-0xa4(%rbp)
  mov    $0x0,%r14d
  jmp    L337
L256:
  mov    %rsi,%rax
  movsd  (%rax),%xmm0
  mov    -0xb8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x50(%rbp)
  mov    -0xa8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xe0(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    $0x0,%r13d
  jmp    L324
L190:
  movsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  mov    -0xa4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  add    $0x1,%r13d
L324:
  cmp    -0xac(%rbp),%r13d
  jl     L190
  add    $0x1,%r14d
  mov    -0xc8(%rbp),%eax
  add    %eax,-0xa8(%rbp)
  mov    -0xc4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rsi,%rcx
  add    %rax,%rcx
  mov    %rcx,%rsi
L337:
  cmp    -0xbc(%rbp),%r14d
  jl     L256
  mov    -0xd8(%rbp),%r15
  mov    -0xe0(%rbp),%rbx
  mov    -0xe8(%rbp),%r12
  mov    $0x0,%r13d
  jmp    L418
L2:
  mov    (%r15),%rax
  lea    -0x98(%rbp),%rcx
  lea    -0x88(%rbp),%rdx
  mov    %rcx,%rsi
  mov    %rdx,%rdi
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <sincosd@plt>
  mov    -0xb8(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm1
  movsd  -0x98(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x70(%rbp)
  mov    -0xb8(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm1
  movsd  -0x98(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
  mov    -0xb8(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm1
  movsd  -0x88(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x60(%rbp)
  mov    -0xb8(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm1
  movsd  -0x88(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x58(%rbp)
  mov    $0x0,%r14d
  jmp    L559
L486:
  movsd  (%rbx),%xmm0
  movsd  %xmm0,-0x50(%rbp)
  lea    -0xa0(%rbp),%rcx
  lea    -0x90(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rdx,%rdi
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <sincosd@plt>
  movsd  -0xa0(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x70(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
  movsd  -0x78(%rbp),%xmm0
  movq   D385(%rip),%xmm1
  andpd  %xmm0,%xmm1
  movsd  D20(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L131
  movsd  (%r15),%xmm1
  mov    -0xb8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <cosd@plt>
  neg    %eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  -0xa0(%rbp),%xmm2
  movsd  D340(%rip),%xmm0
  subsd  %xmm2,%xmm0
  mulsd  -0x70(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
L131:
  movsd  -0x98(%rbp),%xmm0
  movq   D193(%rip),%xmm1
  xorpd  %xmm0,%xmm1
  movsd  -0x90(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x78(%rbp),%xmm0
  jp     L26
  pxor   %xmm0,%xmm0
  ucomisd -0x78(%rbp),%xmm0
  jne    L26
  pxor   %xmm0,%xmm0
  ucomisd -0x48(%rbp),%xmm0
  jp     L26
  pxor   %xmm0,%xmm0
  ucomisd -0x48(%rbp),%xmm0
  je     L618
L26:
  movsd  -0x78(%rbp),%xmm0
  mov    -0x48(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  mov    $0x2,%eax
  call   <atan2d@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x80(%rbp)
  jmp    L193
L618:
  mov    -0xb8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm1
  movsd  D176(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L244
  movsd  -0x50(%rbp),%xmm1
  movsd  D367(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x80(%rbp)
  jmp    L193
L244:
  movsd  -0x50(%rbp),%xmm0
  movq   D193(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x80(%rbp)
L193:
  mov    -0xb8(%rbp),%rax
  movsd  (%rax),%xmm0
  addsd  -0x80(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  mov    -0xb8(%rbp),%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L315
  movsd  (%rbx),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L327
  movsd  (%rbx),%xmm1
  movsd  D6(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L327
L315:
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L327
  movsd  (%rbx),%xmm0
  movsd  D6(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L327:
  movsd  (%rbx),%xmm0
  comisd D6(%rip),%xmm0
  jbe    L499
  movsd  (%rbx),%xmm0
  movsd  D6(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L154
L499:
  movsd  (%rbx),%xmm1
  movsd  D98(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L154
  movsd  (%rbx),%xmm1
  movsd  D6(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L154:
  movsd  D367(%rip),%xmm0
  mov    -0x50(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm3
  ucomisd %xmm0,%xmm3
  jp     L191
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm4
  ucomisd %xmm0,%xmm4
  jne    L191
  movsd  (%r15),%xmm1
  mov    -0xb8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm2
  movsd  -0xa0(%rbp),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  movsd  (%r12),%xmm0
  comisd D176(%rip),%xmm0
  jbe    L43
  movsd  (%r12),%xmm1
  movsd  D367(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
L43:
  movsd  (%r12),%xmm1
  movsd  D359(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L265
  movsd  (%r12),%xmm1
  movsd  D274(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  jmp    L265
L191:
  movsd  -0xa0(%rbp),%xmm0
  mulsd  -0x68(%rbp),%xmm0
  movsd  -0x60(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  -0x40(%rbp),%xmm0
  movq   D385(%rip),%xmm1
  andpd  %xmm1,%xmm0
  comisd D187(%rip),%xmm0
  jbe    L417
  pxor   %xmm0,%xmm0
  comisd -0x40(%rbp),%xmm0
  jbe    L419
  movsd  -0x78(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x48(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <acosd@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movq   D385(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movq   D193(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  jmp    L547
L419:
  movsd  -0x78(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x48(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <acosd@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movq   D385(%rip),%xmm1
  andpd  %xmm1,%xmm0
L547:
  movsd  %xmm0,(%r12)
  jmp    L265
L417:
  mov    -0x40(%rbp),%rax
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <asind@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,(%r12)
L265:
  add    $0x1,%r14d
  mov    -0xc8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  mov    -0xc8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r12
L559:
  cmp    -0xb0(%rbp),%r14d
  jl     L486
  add    $0x1,%r13d
  mov    -0xc4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r15
L418:
  cmp    -0xc0(%rbp),%r13d
  jl     L2
  mov    $0x0,%eax
L99:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L89
  call   <__stack_chk_fail@plt>
L89:
  add    $0xc8,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D367
type_guessed: f64
name: retrieve_data
arguments: tag: D6
type_guessed: f64[2]
name: retrieve_data
arguments: tag: D98
type_guessed: f32[2]
name: retrieve_data
arguments: tag: D193
type_guessed: f32[2]
name: retrieve_data
arguments: tag: D385
type_guessed: qword
name: retrieve_data
arguments: tag: D20
type_guessed: byte[8]
name: retrieve_data
arguments: tag: D340
type_guessed: f64
name: retrieve_data
arguments: tag: D176
type_guessed: f64[2]
name: retrieve_data
arguments: tag: D359
type_guessed: f32[2]
name: retrieve_data
arguments: tag: D274
type_guessed: f32[2]
name: retrieve_data
arguments: tag: D187
type_guessed: f64

tool: D367: 180

tool: {"D6": [360.0,-360.0]}

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

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

tool: D385: 9223372036854775807

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

tool: D340: 1

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

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

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

tool: D187: 0.99

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;
}
```