user: 请将以下的汇编代码转换成C语言代码：

```asm
<powspec2d>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %r8d,-0x50(%rbp)
  mov    -0x50(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L115
L304:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x28(%rbp)
L115:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L304
  movl   $0x0,-0x28(%rbp)
  jmp    L320
L258:
  movl   $0x0,-0x24(%rbp)
  jmp    L14
L151:
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  imul   %eax,%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   %eax,%eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  pxor   %xmm4,%xmm4
  cvtss2sd %xmm0,%xmm4
  movq   %xmm4,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0xc(%rbp)
  pxor   %xmm4,%xmm4
  cvtss2sd -0xc(%rbp),%xmm4
  movsd  %xmm4,-0x58(%rbp)
  pxor   %xmm5,%xmm5
  cvtss2sd -0xc(%rbp),%xmm5
  movq   %xmm5,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  movsd  -0x58(%rbp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  D16(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L93
  pxor   %xmm6,%xmm6
  cvtss2sd -0xc(%rbp),%xmm6
  movq   %xmm6,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L181
L93:
  pxor   %xmm7,%xmm7
  cvtss2sd -0xc(%rbp),%xmm7
  movq   %xmm7,%rax
  movq   %rax,%xmm0
  call   <ceil@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
L181:
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L40
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L40:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm0,%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm3
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm3,%xmm0
  addss  %xmm2,%xmm0
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  addss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x24(%rbp)
L14:
  mov    -0x50(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %eax,-0x24(%rbp)
  jl     L151
  addl   $0x1,-0x28(%rbp)
L320:
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %eax,-0x28(%rbp)
  jl     L258
  movl   $0x0,-0x28(%rbp)
  jmp    L237
L300:
  mov    -0x50(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x24(%rbp)
  jmp    L94
L275:
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x50(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  imul   %eax,%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   %eax,%eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  pxor   %xmm4,%xmm4
  cvtss2sd %xmm0,%xmm4
  movq   %xmm4,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0xc(%rbp)
  pxor   %xmm5,%xmm5
  cvtss2sd -0xc(%rbp),%xmm5
  movsd  %xmm5,-0x58(%rbp)
  pxor   %xmm6,%xmm6
  cvtss2sd -0xc(%rbp),%xmm6
  movq   %xmm6,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  movsd  -0x58(%rbp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  D16(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L202
  pxor   %xmm5,%xmm5
  cvtss2sd -0xc(%rbp),%xmm5
  movq   %xmm5,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L95
L202:
  pxor   %xmm7,%xmm7
  cvtss2sd -0xc(%rbp),%xmm7
  movq   %xmm7,%rax
  movq   %rax,%xmm0
  call   <ceil@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
L95:
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L192
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L192:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm0,%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm3
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm3,%xmm0
  addss  %xmm2,%xmm0
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  addss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x24(%rbp)
L94:
  mov    -0x24(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L275
  addl   $0x1,-0x28(%rbp)
L237:
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %eax,-0x28(%rbp)
  jl     L300
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x28(%rbp)
  jmp    L182
L241:
  mov    -0x50(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x24(%rbp)
  jmp    L301
L319:
  mov    -0x28(%rbp),%eax
  sub    -0x4c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x50(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  imul   %eax,%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   %eax,%eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  pxor   %xmm4,%xmm4
  cvtss2sd %xmm0,%xmm4
  movq   %xmm4,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0xc(%rbp)
  pxor   %xmm6,%xmm6
  cvtss2sd -0xc(%rbp),%xmm6
  movsd  %xmm6,-0x58(%rbp)
  pxor   %xmm5,%xmm5
  cvtss2sd -0xc(%rbp),%xmm5
  movq   %xmm5,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  movsd  -0x58(%rbp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  D16(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L266
  pxor   %xmm6,%xmm6
  cvtss2sd -0xc(%rbp),%xmm6
  movq   %xmm6,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L162
L266:
  pxor   %xmm7,%xmm7
  cvtss2sd -0xc(%rbp),%xmm7
  movq   %xmm7,%rax
  movq   %rax,%xmm0
  call   <ceil@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
L162:
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L58
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L58:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm0,%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm3
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm3,%xmm0
  addss  %xmm2,%xmm0
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  addss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x24(%rbp)
L301:
  mov    -0x24(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L319
  addl   $0x1,-0x28(%rbp)
L182:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L241
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x28(%rbp)
  jmp    L134
L48:
  movl   $0x0,-0x24(%rbp)
  jmp    L75
L272:
  mov    -0x28(%rbp),%eax
  sub    -0x4c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  imul   %eax,%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   %eax,%eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  pxor   %xmm3,%xmm3
  cvtss2sd %xmm0,%xmm3
  movq   %xmm3,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0xc(%rbp)
  pxor   %xmm7,%xmm7
  cvtss2sd -0xc(%rbp),%xmm7
  movsd  %xmm7,-0x58(%rbp)
  pxor   %xmm4,%xmm4
  cvtss2sd -0xc(%rbp),%xmm4
  movq   %xmm4,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  movsd  -0x58(%rbp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  D16(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L100
  pxor   %xmm5,%xmm5
  cvtss2sd -0xc(%rbp),%xmm5
  movq   %xmm5,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L116
L100:
  pxor   %xmm6,%xmm6
  cvtss2sd -0xc(%rbp),%xmm6
  movq   %xmm6,%rax
  movq   %rax,%xmm0
  call   <ceil@plt>
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x20(%rbp)
L116:
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L90
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L90:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm0,%xmm2
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm3
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm3,%xmm0
  addss  %xmm2,%xmm0
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  addss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x24(%rbp)
L75:
  mov    -0x50(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %eax,-0x24(%rbp)
  jl     L272
  addl   $0x1,-0x28(%rbp)
L134:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L48
  movl   $0x0,-0x28(%rbp)
  jmp    L140
L18:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L265
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x28(%rbp),%xmm1
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mulss  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pxor   %xmm1,%xmm1
  cvtsi2ss %eax,%xmm1
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
L265:
  addl   $0x1,-0x28(%rbp)
L140:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L18
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D16
type: f64

tool: D16: 0.5

assistant: ```c
void powspec2d(float *Fr, float *Fi, float *PS2d, int N1, int N2) {
  int i, j, n, a, b;
  int ind, ind2, *number;
  float val;
  n = (N1 < N2 ? N1 : N2) / 2;
  number = (int *)malloc((n + 1) * sizeof(int));
  for (i = 0; i <= n; i++) {
    PS2d[i] = 0;
    number[i] = 0;
  }
  for (i = 0; i < N1 / 2; i++)
    for (j = 0; j < N2 / 2; j++) {
      a = i;
      b = j;
      ind2 = i + j * N1;
      val = sqrt((float)(a * a + b * b));
      if ((val - floor(val)) < 0.5)
        ind = (int)floor(val);
      else
        ind = (int)ceil(val);
      if (ind > n)
        ind = n;
      PS2d[ind] += Fr[ind2] * Fr[ind2] + Fi[ind2] * Fi[ind2];
      number[ind]++;
    }
  for (i = 0; i < N1 / 2; i++)
    for (j = N2 / 2; j < N2; j++) {
      a = i;
      b = j - N2;
      ind2 = i + j * N1;
      val = sqrt((float)(a * a + b * b));
      if ((val - floor(val)) < 0.5)
        ind = (int)floor(val);
      else
        ind = (int)ceil(val);
      if (ind > n)
        ind = n;
      PS2d[ind] += Fr[ind2] * Fr[ind2] + Fi[ind2] * Fi[ind2];
      number[ind]++;
    }
  for (i = N1 / 2; i < N1; i++)
    for (j = N2 / 2; j < N2; j++) {
      a = i - N1;
      b = j - N2;
      ind2 = i + j * N1;
      val = sqrt((float)(a * a + b * b));
      if ((val - floor(val)) < 0.5)
        ind = (int)floor(val);
      else
        ind = (int)ceil(val);
      if (ind > n)
        ind = n;
      PS2d[ind] += Fr[ind2] * Fr[ind2] + Fi[ind2] * Fi[ind2];
      number[ind]++;
    }
  for (i = N1 / 2; i < N1; i++)
    for (j = 0; j < N2 / 2; j++) {
      a = i - N1;
      b = j;
      ind2 = i + j * N1;
      val = sqrt((float)(a * a + b * b));
      if ((val - floor(val)) < 0.5)
        ind = (int)floor(val);
      else
        ind = (int)ceil(val);
      if (ind > n)
        ind = n;
      PS2d[ind] += Fr[ind2] * Fr[ind2] + Fi[ind2] * Fi[ind2];
      number[ind]++;
    }
  for (i = 0; i <= n; i++) {
    if (number[i] != 0)
      PS2d[i] = (float)(i)*PS2d[i] / (float)number[i];
  }
  free(number);
}
```