user: 这段汇编代码用C语言表示是什么样的:

```asm
<sphx2s>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xd8,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %esi,-0xcc(%rbp)
  mov    %edx,-0xd0(%rbp)
  mov    %ecx,-0xd4(%rbp)
  mov    %r8d,-0xd8(%rbp)
  mov    %r9,-0xe0(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0xe8(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0xf0(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0xf8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0xd0(%rbp)
  jle    L459
  mov    -0xcc(%rbp),%eax
  mov    %eax,-0xb0(%rbp)
  mov    -0xd0(%rbp),%eax
  mov    %eax,-0xac(%rbp)
  jmp    L576
L459:
  movl   $0x1,-0xb0(%rbp)
  movl   $0x1,-0xac(%rbp)
  mov    -0xcc(%rbp),%eax
  mov    %eax,-0xd0(%rbp)
L576:
  mov    -0xc8(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L613
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jne    L613
  mov    -0xc8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L21
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jne    L21
  mov    -0xc8(%rbp),%rax
  movsd  (%rax),%xmm1
  movsd  D351(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0xc8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movsd  D27(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  movl   $0x0,-0xb4(%rbp)
  mov    -0xe8(%rbp),%r15
  mov    -0xf0(%rbp),%rbx
  mov    -0xf8(%rbp),%r12
  mov    $0x0,%r13d
  jmp    L419
L297:
  mov    -0xb4(%rbp),%eax
  cltd
  idivl  -0xcc(%rbp)
  mov    %edx,%eax
  imul   -0xd4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xe0(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  mov    $0x0,%r14d
  jmp    L157
L299:
  mov    %rsi,%rax
  movsd  (%rax),%xmm0
  addsd  -0x80(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%r15),%xmm0
  movsd  %xmm0,(%r12)
  mov    -0xc8(%rbp),%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L543
  movsd  (%rbx),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L569
  movsd  (%rbx),%xmm1
  movsd  D27(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L569
L543:
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L569
  movsd  (%rbx),%xmm0
  movsd  D27(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L569:
  movsd  (%rbx),%xmm0
  comisd D27(%rip),%xmm0
  jbe    L249
  movsd  (%rbx),%xmm0
  movsd  D27(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L69
L249:
  movsd  (%rbx),%xmm1
  movsd  D33(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L69
  movsd  (%rbx),%xmm1
  movsd  D27(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L69:
  mov    -0xd8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  mov    -0xd8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r12
  add    $0x1,%r14d
  mov    -0xd4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rsi
  addl   $0x1,-0xb4(%rbp)
L157:
  cmp    -0xb0(%rbp),%r14d
  jl     L299
  add    $0x1,%r13d
  mov    -0xd4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r15
L419:
  cmp    -0xd0(%rbp),%r13d
  jl     L297
  jmp    L315
L21:
  mov    -0xc8(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0xc8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movsd  D27(%rip),%xmm0
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  movl   $0x0,-0xb4(%rbp)
  mov    -0xe8(%rbp),%r15
  mov    -0xf0(%rbp),%rbx
  mov    -0xf8(%rbp),%r12
  mov    $0x0,%r13d
  jmp    L378
L291:
  mov    -0xb4(%rbp),%eax
  cltd
  idivl  -0xcc(%rbp)
  mov    %edx,%eax
  imul   -0xd4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xe0(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  mov    $0x0,%r14d
  jmp    L94
L367:
  mov    %rsi,%rax
  movsd  (%rax),%xmm1
  movsd  -0x80(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%r15),%xmm0
  movq   D101(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  mov    -0xc8(%rbp),%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L170
  movsd  (%rbx),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L560
  movsd  (%rbx),%xmm1
  movsd  D27(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L560
L170:
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L560
  movsd  (%rbx),%xmm0
  movsd  D27(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L560:
  movsd  (%rbx),%xmm0
  comisd D27(%rip),%xmm0
  jbe    L159
  movsd  (%rbx),%xmm0
  movsd  D27(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L223
L159:
  movsd  (%rbx),%xmm1
  movsd  D33(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L223
  movsd  (%rbx),%xmm1
  movsd  D27(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L223:
  mov    -0xd8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  mov    -0xd8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r12
  add    $0x1,%r14d
  mov    -0xd4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rsi,%rcx
  add    %rax,%rcx
  mov    %rcx,%rsi
  addl   $0x1,-0xb4(%rbp)
L94:
  cmp    -0xb0(%rbp),%r14d
  jl     L367
  add    $0x1,%r13d
  mov    -0xd4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r15
L378:
  cmp    -0xd0(%rbp),%r13d
  jl     L291
L315:
  mov    $0x0,%eax
  jmp    L454
L613:
  mov    -0xe0(%rbp),%rax
  mov    %rax,%rsi
  movl   $0x0,-0xa8(%rbp)
  mov    -0xcc(%rbp),%eax
  imul   -0xd8(%rbp),%eax
  mov    %eax,-0xa4(%rbp)
  mov    $0x0,%r14d
  jmp    L425
L269:
  mov    %rsi,%rax
  movsd  (%rax),%xmm0
  mov    -0xc8(%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    -0xf0(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    $0x0,%r13d
  jmp    L212
L66:
  movsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  mov    -0xa4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  add    $0x1,%r13d
L212:
  cmp    -0xac(%rbp),%r13d
  jl     L66
  add    $0x1,%r14d
  mov    -0xd8(%rbp),%eax
  add    %eax,-0xa8(%rbp)
  mov    -0xd4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rsi,%rdi
  add    %rax,%rdi
  mov    %rdi,%rsi
L425:
  cmp    -0xcc(%rbp),%r14d
  jl     L269
  mov    -0xe8(%rbp),%r15
  mov    -0xf0(%rbp),%rbx
  mov    -0xf8(%rbp),%r12
  mov    $0x0,%r13d
  jmp    L608
L333:
  mov    (%r15),%rax
  lea    -0x98(%rbp),%rcx
  lea    -0x88(%rbp),%rdx
  mov    %rcx,%rsi
  mov    %rdx,%rdi
  movq   %rax,%xmm0
  call   <sincosd@plt>
  mov    -0xc8(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm1
  movsd  -0x98(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x70(%rbp)
  mov    -0xc8(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm1
  movsd  -0x98(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
  mov    -0xc8(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm1
  movsd  -0x88(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x60(%rbp)
  mov    -0xc8(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm1
  movsd  -0x88(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x58(%rbp)
  mov    $0x0,%r14d
  jmp    L140
L62:
  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
  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   D144(%rip),%xmm1
  andpd  %xmm0,%xmm1
  movsd  D281(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L73
  movsd  -0xa0(%rbp),%xmm1
  movsd  D45(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  -0x70(%rbp),%xmm0
  movsd  %xmm0,-0x100(%rbp)
  movsd  (%r15),%xmm1
  mov    -0xc8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <cosd@plt>
  movapd %xmm0,%xmm1
  movsd  -0x100(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
L73:
  movsd  -0x98(%rbp),%xmm0
  movq   D101(%rip),%xmm1
  xorpd  %xmm0,%xmm1
  movsd  -0x90(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x78(%rbp),%xmm0
  jp     L4
  pxor   %xmm0,%xmm0
  ucomisd -0x78(%rbp),%xmm0
  jne    L4
  pxor   %xmm0,%xmm0
  ucomisd -0x48(%rbp),%xmm0
  jp     L4
  pxor   %xmm0,%xmm0
  ucomisd -0x48(%rbp),%xmm0
  je     L381
L4:
  movsd  -0x78(%rbp),%xmm0
  mov    -0x48(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <atan2d@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  jmp    L222
L381:
  mov    -0xc8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm1
  movsd  D67(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L189
  movsd  -0x50(%rbp),%xmm1
  movsd  D351(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x80(%rbp)
  jmp    L222
L189:
  movsd  -0x50(%rbp),%xmm0
  movq   D101(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x80(%rbp)
L222:
  mov    -0xc8(%rbp),%rax
  movsd  (%rax),%xmm0
  addsd  -0x80(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  mov    -0xc8(%rbp),%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L118
  movsd  (%rbx),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L127
  movsd  (%rbx),%xmm1
  movsd  D27(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L127
L118:
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L127
  movsd  (%rbx),%xmm0
  movsd  D27(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L127:
  movsd  (%rbx),%xmm0
  comisd D27(%rip),%xmm0
  jbe    L154
  movsd  (%rbx),%xmm0
  movsd  D27(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L235
L154:
  movsd  (%rbx),%xmm1
  movsd  D33(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L235
  movsd  (%rbx),%xmm1
  movsd  D27(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
L235:
  movsd  D351(%rip),%xmm0
  mov    -0x50(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm5
  ucomisd %xmm0,%xmm5
  jp     L449
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm6
  ucomisd %xmm0,%xmm6
  jne    L449
  movsd  (%r15),%xmm1
  mov    -0xc8(%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 D67(%rip),%xmm0
  jbe    L217
  movsd  (%r12),%xmm1
  movsd  D351(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
L217:
  movsd  (%r12),%xmm1
  movsd  D179(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L553
  movsd  (%r12),%xmm1
  movsd  D2(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  jmp    L553
L449:
  movsd  -0xa0(%rbp),%xmm0
  mulsd  -0x68(%rbp),%xmm0
  movsd  -0x60(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  -0x40(%rbp),%xmm0
  movq   D144(%rip),%xmm1
  andpd  %xmm1,%xmm0
  comisd D355(%rip),%xmm0
  jbe    L447
  pxor   %xmm0,%xmm0
  comisd -0x40(%rbp),%xmm0
  jbe    L514
  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>
  mov    %eax,%edi
  call   <acosd@plt>
  movq   %xmm0,%rax
  movq   D144(%rip),%xmm0
  movq   %rax,%xmm3
  andpd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movq   D101(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  jmp    L277
L514:
  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>
  mov    %eax,%edi
  call   <acosd@plt>
  movq   %xmm0,%rax
  movq   D144(%rip),%xmm0
  movq   %rax,%xmm4
  andpd  %xmm0,%xmm4
  movapd %xmm4,%xmm0
L277:
  movsd  %xmm0,(%r12)
  jmp    L553
L447:
  mov    -0x40(%rbp),%rax
  movq   %rax,%xmm0
  call   <asind@plt>
  movq   %xmm0,%rax
  mov    %rax,(%r12)
L553:
  add    $0x1,%r14d
  mov    -0xd8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rbx
  mov    -0xd8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r12
L140:
  cmp    -0xb0(%rbp),%r14d
  jl     L62
  add    $0x1,%r13d
  mov    -0xd4(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%r15
L608:
  cmp    -0xd0(%rbp),%r13d
  jl     L333
  mov    $0x0,%eax
L454:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L384
  call   <__stack_chk_fail@plt>
L384:
  add    $0xd8,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D351
type_guessed: f64
name: extract_symbolic_data
arguments: data_tag: D27
type_guessed: f64[2]
name: extract_symbolic_data
arguments: data_tag: D33
type_guessed: f32[2]
name: extract_symbolic_data
arguments: data_tag: D101
type_guessed: f32[2]
name: extract_symbolic_data
arguments: data_tag: D144
type_guessed: qword
name: extract_symbolic_data
arguments: data_tag: D281
type_guessed: byte[8]
name: extract_symbolic_data
arguments: data_tag: D45
type_guessed: f64
name: extract_symbolic_data
arguments: data_tag: D67
type_guessed: f64[2]
name: extract_symbolic_data
arguments: data_tag: D179
type_guessed: f32[2]
name: extract_symbolic_data
arguments: data_tag: D2
type_guessed: f32[2]
name: extract_symbolic_data
arguments: data_tag: D355
type_guessed: f64

tool: D351: 180

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

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

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

tool: D144: 9223372036854775807

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

tool: D45: 1

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

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

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

tool: D355: 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 jphi, 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);
      jphi = 0;
      thetap = theta;
      lngp = lng;
      latp = lat;
      for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {
        phip = phi + (jphi % nphi) * spt;
        for (iphi = 0; iphi < mphi; iphi++, phip += spt, jphi++) {
          *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;
        }
      }
    } else {
      dlng = fmod(eul[0] + eul[2], 360.0);
      jphi = 0;
      thetap = theta;
      lngp = lng;
      latp = lat;
      for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {
        phip = phi + (jphi % nphi) * spt;
        for (iphi = 0; iphi < mphi; iphi++, phip += spt, jphi++) {
          *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;
        }
      }
    }
    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;
}
```