user: Converte this assembly snippet into its equivalent C code:

```asm
<measurement>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x1e8,%rsp
  mov    %rdi,-0x1b8(%rbp)
  mov    %rsi,-0x210(%rbp)
  movsd  %xmm0,-0x1c8(%rbp)
  mov    %r8d,-0x208(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movsd  D191(%rip),%xmm0
  divsd  -0x1c8(%rbp),%xmm0
  movsd  %xmm0,-0x1a8(%rbp)
  mov    %rsp,%rax
L201:
  cmp    %rax,%rsp
  je     L302
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L201
L302:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x1d0(%rbp)
  mov    %rsp,%rax
L345:
  cmp    %rax,%rsp
  je     L30
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L345
L30:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x1d8(%rbp)
  mov    %rsp,%rax
L17:
  cmp    %rax,%rsp
  je     L363
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L17
L363:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x1e0(%rbp)
  mov    %rsp,%rax
L329:
  cmp    %rax,%rsp
  je     L334
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L329
L334:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x1e8(%rbp)
  mov    %rsp,%rax
L373:
  cmp    %rax,%rsp
  je     L365
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L373
L365:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x1f0(%rbp)
  mov    %rsp,%rax
L232:
  cmp    %rax,%rsp
  je     L24
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L232
L24:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x1f8(%rbp)
  mov    %rsp,%rax
L28:
  cmp    %rax,%rsp
  je     L309
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L28
L309:
  sub    $0x7d0,%rsp
  orq    $0x0,0x7c8(%rsp)
  mov    %rsp,-0x200(%rbp)
  movq   $0x0,-0x1c0(%rbp)
  jmp    L64
L112:
  mulsd  -0x1a8(%rbp),%xmm0
  call   <exp@plt>
  movsd  -0x70(%rbp),%xmm7
  movapd %xmm7,%xmm1
  divsd  %xmm7,%xmm1
  mulsd  %xmm0,%xmm1
  movq   %xmm1,%rbx
  mov    $0x0,%eax
  call   <rng@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movq   %rbx,%xmm6
  comisd %xmm0,%xmm6
  jb     L36
  mov    -0x98(%rbp),%rdx
  mov    (%rdx),%rax
  mov    -0x58(%rbp),%rcx
  mov    (%rax,%rcx,1),%rax
  mov    -0x60(%rbp),%rsi
  mov    (%rax,%rsi,1),%rax
  movsd  -0xa8(%rbp),%xmm4
  movsd  %xmm4,(%rax)
  mov    (%rdx),%rax
  mov    (%rax,%rcx,1),%rax
  mov    (%rax,%rsi,1),%rax
  movsd  -0x198(%rbp),%xmm6
  movsd  %xmm6,0x8(%rax)
  movsd  -0x78(%rbp),%xmm6
  addsd  D191(%rip),%xmm6
  movsd  %xmm6,-0x78(%rbp)
L36:
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  -0xa0(%rbp),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm7
  movsd  %xmm7,-0xf8(%rbp)
  movsd  -0x48(%rbp),%xmm2
  movsd  %xmm2,-0x100(%rbp)
  mov    -0xc0(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x58(%rbp),%rcx
  mov    (%rax,%rcx,1),%rax
  mov    -0x60(%rbp),%r12
  mov    (%rax,%r12,1),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm6
  movsd  %xmm6,-0x108(%rbp)
  movsd  -0x48(%rbp),%xmm4
  movsd  %xmm4,-0x110(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,-0x128(%rbp)
  movsd  -0x48(%rbp),%xmm5
  movsd  %xmm5,-0x130(%rbp)
  mov    -0xc8(%rbp),%rdx
  mov    (%rdx),%rax
  mov    -0x58(%rbp),%rcx
  mov    (%rax,%rcx,1),%rax
  mov    (%rax,%r12,1),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm3
  movsd  %xmm3,-0x148(%rbp)
  movsd  -0x48(%rbp),%xmm8
  movsd  %xmm8,-0x150(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm13
  movsd  %xmm13,-0x168(%rbp)
  movsd  -0x48(%rbp),%xmm3
  movsd  %xmm3,-0x170(%rbp)
  mov    -0x98(%rbp),%rdx
  mov    (%rdx),%rbx
  mov    -0xb0(%rbp),%rsi
  mov    (%rbx,%rsi,1),%rax
  mov    (%rax,%r12,1),%rax
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rax),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm11
  movsd  %xmm11,-0xe0(%rbp)
  movsd  -0x48(%rbp),%xmm3
  movsd  %xmm3,-0xe8(%rbp)
  mov    -0xb8(%rbp),%rdi
  mov    (%rbx,%rdi,1),%rax
  mov    %r12,-0x60(%rbp)
  mov    (%rax,%r12,1),%r12
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm15
  movsd  %xmm15,-0x138(%rbp)
  movsd  -0x48(%rbp),%xmm6
  movsd  %xmm6,-0x140(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm5
  movsd  %xmm5,-0x118(%rbp)
  movsd  -0x48(%rbp),%xmm15
  movsd  %xmm15,-0x120(%rbp)
  mov    -0x58(%rbp),%rax
  mov    (%rbx,%rax,1),%r12
  mov    -0x188(%rbp),%rsi
  mov    (%r12,%rsi,8),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm10
  movsd  %xmm10,-0x158(%rbp)
  movsd  -0x48(%rbp),%xmm12
  movsd  %xmm12,-0x160(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm9
  movsd  %xmm9,-0x178(%rbp)
  movsd  -0x48(%rbp),%xmm11
  movsd  %xmm11,-0x180(%rbp)
  mov    -0x190(%rbp),%rdi
  mov    (%r12,%rdi,8),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm14
  movsd  %xmm14,-0xd0(%rbp)
  movsd  -0x48(%rbp),%xmm7
  movsd  %xmm7,-0xd8(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x128(%rbp),%xmm0
  movsd  -0x110(%rbp),%xmm4
  mulsd  %xmm4,%xmm0
  movsd  -0x168(%rbp),%xmm13
  movsd  -0x150(%rbp),%xmm8
  mulsd  %xmm8,%xmm13
  addsd  %xmm13,%xmm0
  movsd  -0xe8(%rbp),%xmm3
  movapd %xmm3,%xmm1
  movsd  -0x118(%rbp),%xmm5
  mulsd  %xmm5,%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0x140(%rbp),%xmm6
  mulsd  %xmm6,%xmm5
  addsd  %xmm5,%xmm0
  movsd  -0x178(%rbp),%xmm9
  movsd  -0x160(%rbp),%xmm12
  mulsd  %xmm12,%xmm9
  addsd  %xmm9,%xmm0
  movsd  -0xd8(%rbp),%xmm7
  movapd %xmm7,%xmm1
  mulsd  -0x50(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0xf8(%rbp),%xmm1
  movsd  -0x70(%rbp),%xmm13
  mulsd  %xmm13,%xmm1
  subsd  -0x80(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  -0x130(%rbp),%xmm5
  mulsd  %xmm4,%xmm5
  movapd %xmm5,%xmm1
  movsd  -0x170(%rbp),%xmm5
  mulsd  %xmm8,%xmm5
  addsd  %xmm5,%xmm1
  movsd  -0x120(%rbp),%xmm5
  mulsd  %xmm5,%xmm3
  addsd  %xmm3,%xmm1
  mulsd  %xmm5,%xmm6
  addsd  %xmm6,%xmm1
  movsd  -0x180(%rbp),%xmm3
  mulsd  %xmm12,%xmm3
  addsd  %xmm3,%xmm1
  mulsd  -0x48(%rbp),%xmm7
  addsd  %xmm7,%xmm1
  movsd  -0x100(%rbp),%xmm2
  mulsd  %xmm13,%xmm2
  subsd  -0x88(%rbp),%xmm2
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0x108(%rbp),%xmm1
  addsd  -0x148(%rbp),%xmm1
  addsd  -0xe0(%rbp),%xmm1
  addsd  -0x138(%rbp),%xmm1
  addsd  -0x158(%rbp),%xmm1
  addsd  -0xd0(%rbp),%xmm1
  mulsd  -0x90(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0xf0(%rbp),%xmm7
  addsd  D191(%rip),%xmm7
  movsd  %xmm7,-0xd0(%rbp)
  comisd D96(%rip),%xmm0
  jb     L382
  mov    -0x60(%rbp),%rcx
  mov    (%r12,%rcx,1),%rax
  movsd  -0xa8(%rbp),%xmm7
  movsd  %xmm7,(%rax)
  mov    -0x98(%rbp),%rdx
  mov    (%rdx),%rax
  mov    -0x58(%rbp),%rdx
  mov    (%rax,%rdx,1),%rax
  mov    (%rax,%rcx,1),%rax
  movsd  -0xa0(%rbp),%xmm6
  movsd  %xmm6,0x8(%rax)
  movsd  -0x78(%rbp),%xmm7
  addsd  D191(%rip),%xmm7
  movsd  %xmm7,-0x78(%rbp)
L289:
  add    $0x1,%r14
  cmp    $0x4,%r14
  je     L160
L310:
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x98(%rbp)
  lea    0x0(,%r14,8),%rcx
  mov    %rcx,-0x60(%rbp)
  mov    (%rax),%rax
  mov    -0x58(%rbp),%r12
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%r14,8),%r12
  movsd  (%r12),%xmm3
  movsd  %xmm3,-0xa8(%rbp)
  mov    %r15,%rsi
  mov    %r13,%rdi
  movapd %xmm3,%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm5
  movsd  %xmm5,-0x90(%rbp)
  movsd  -0x48(%rbp),%xmm4
  movsd  %xmm4,-0x70(%rbp)
  movsd  0x8(%r12),%xmm3
  movsd  %xmm3,-0x198(%rbp)
  mov    %r15,%rsi
  mov    %r13,%rdi
  movapd %xmm3,%xmm0
  call   <sincos@plt>
  mov    -0x50(%rbp),%rbx
  mov    -0x48(%rbp),%r12
  mov    $0x0,%eax
  call   <rng_theta@plt>
  mov    $0x0,%eax
  call   <rng_phi@plt>
  pxor   %xmm6,%xmm6
  cvtsi2sd %eax,%xmm6
  movsd  %xmm6,-0xa0(%rbp)
  movq   %rbx,%xmm7
  movsd  -0x70(%rbp),%xmm4
  mulsd  %xmm4,%xmm7
  movsd  %xmm7,-0x80(%rbp)
  movq   %r12,%xmm6
  mulsd  %xmm4,%xmm6
  movsd  %xmm6,-0x88(%rbp)
  movsd  -0x90(%rbp),%xmm5
  subsd  %xmm5,%xmm5
  movsd  %xmm5,-0x90(%rbp)
  mov    -0xc0(%rbp),%rcx
  mov    (%rcx),%rax
  mov    -0x58(%rbp),%r12
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%r14,8),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm4
  movsd  %xmm4,-0xf8(%rbp)
  movsd  -0x48(%rbp),%xmm3
  movsd  %xmm3,-0x100(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,-0x108(%rbp)
  movsd  -0x48(%rbp),%xmm8
  movsd  %xmm8,-0x110(%rbp)
  mov    -0xc8(%rbp),%rcx
  mov    (%rcx),%rax
  mov    %r12,-0x58(%rbp)
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%r14,8),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm15
  movsd  %xmm15,-0x148(%rbp)
  movsd  -0x48(%rbp),%xmm9
  movsd  %xmm9,-0x150(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm10
  movsd  %xmm10,-0xe8(%rbp)
  movsd  -0x48(%rbp),%xmm2
  movsd  %xmm2,-0xf0(%rbp)
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rbx
  mov    -0xb0(%rbp),%rcx
  mov    (%rbx,%rcx,1),%rax
  mov    (%rax,%r14,8),%r12
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm14
  movsd  %xmm14,-0x118(%rbp)
  movsd  -0x48(%rbp),%xmm11
  movsd  %xmm11,-0x120(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm12
  movsd  %xmm12,-0x158(%rbp)
  movsd  -0x48(%rbp),%xmm13
  movsd  %xmm13,-0x160(%rbp)
  mov    -0xb8(%rbp),%rcx
  mov    (%rbx,%rcx,1),%rax
  mov    (%rax,%r14,8),%r12
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm4
  movsd  %xmm4,-0xd8(%rbp)
  movsd  -0x48(%rbp),%xmm14
  movsd  %xmm14,-0xe0(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm15
  movsd  %xmm15,-0x128(%rbp)
  movsd  -0x48(%rbp),%xmm4
  movsd  %xmm4,-0x130(%rbp)
  mov    -0x58(%rbp),%r12
  mov    (%rbx,%r12,1),%r12
  lea    0x1(%r14),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  movslq %eax,%rcx
  mov    %rcx,-0x188(%rbp)
  mov    (%r12,%rcx,8),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm8
  movsd  %xmm8,-0x168(%rbp)
  movsd  -0x48(%rbp),%xmm8
  movsd  %xmm8,-0x170(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm13
  movsd  %xmm13,-0x138(%rbp)
  movsd  -0x48(%rbp),%xmm1
  movsd  %xmm1,-0x140(%rbp)
  lea    0x3(%r14),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  movslq %eax,%rdx
  mov    %rdx,-0x190(%rbp)
  mov    (%r12,%rdx,8),%rbx
  mov    %r15,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm3
  movsd  %xmm3,-0x178(%rbp)
  movsd  -0x48(%rbp),%xmm4
  movsd  %xmm4,-0x180(%rbp)
  movsd  0x8(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  -0x108(%rbp),%xmm0
  movsd  -0x100(%rbp),%xmm3
  mulsd  %xmm3,%xmm0
  movsd  -0xe8(%rbp),%xmm10
  movsd  -0x150(%rbp),%xmm9
  mulsd  %xmm9,%xmm10
  addsd  %xmm10,%xmm0
  movsd  -0x158(%rbp),%xmm12
  movsd  -0x120(%rbp),%xmm11
  mulsd  %xmm11,%xmm12
  addsd  %xmm12,%xmm0
  movsd  -0x128(%rbp),%xmm15
  movsd  -0xe0(%rbp),%xmm14
  mulsd  %xmm14,%xmm15
  addsd  %xmm15,%xmm0
  movsd  -0x138(%rbp),%xmm12
  movsd  -0x170(%rbp),%xmm10
  mulsd  %xmm10,%xmm12
  addsd  %xmm12,%xmm0
  movsd  -0x180(%rbp),%xmm4
  movapd %xmm4,%xmm1
  mulsd  -0x50(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0x80(%rbp),%xmm7
  movapd %xmm7,%xmm1
  subsd  %xmm7,%xmm1
  mulsd  %xmm1,%xmm0
  movsd  -0x110(%rbp),%xmm7
  mulsd  %xmm3,%xmm7
  movapd %xmm7,%xmm1
  movsd  -0xf0(%rbp),%xmm2
  mulsd  %xmm9,%xmm2
  addsd  %xmm2,%xmm1
  movsd  -0x160(%rbp),%xmm2
  mulsd  %xmm11,%xmm2
  addsd  %xmm2,%xmm1
  movsd  -0x130(%rbp),%xmm2
  mulsd  %xmm14,%xmm2
  addsd  %xmm2,%xmm1
  movsd  -0x140(%rbp),%xmm2
  mulsd  %xmm10,%xmm2
  addsd  %xmm2,%xmm1
  mulsd  -0x48(%rbp),%xmm4
  addsd  %xmm4,%xmm1
  movsd  -0x88(%rbp),%xmm6
  movapd %xmm6,%xmm2
  subsd  %xmm6,%xmm2
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0xf8(%rbp),%xmm1
  addsd  -0x148(%rbp),%xmm1
  addsd  -0x118(%rbp),%xmm1
  addsd  -0xd8(%rbp),%xmm1
  addsd  -0x168(%rbp),%xmm1
  addsd  -0x178(%rbp),%xmm1
  mulsd  -0x90(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  D191(%rip),%xmm6
  addsd  -0xd0(%rbp),%xmm6
  movsd  %xmm6,-0xf0(%rbp)
  pxor   %xmm6,%xmm6
  comisd %xmm6,%xmm0
  jb     L112
  mov    (%r12,%r14,8),%rax
  movsd  -0xa8(%rbp),%xmm7
  movsd  %xmm7,(%rax)
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x58(%rbp),%r12
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%r14,8),%rax
  movsd  -0x198(%rbp),%xmm6
  movsd  %xmm6,0x8(%rax)
  movsd  -0x78(%rbp),%xmm6
  addsd  D191(%rip),%xmm6
  movsd  %xmm6,-0x78(%rbp)
  jmp    L36
L382:
  mulsd  -0x1a8(%rbp),%xmm0
  call   <exp@plt>
  movapd %xmm0,%xmm1
  movsd  -0x70(%rbp),%xmm0
  divsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm0
  movq   %xmm0,%rbx
  mov    $0x0,%eax
  call   <rng@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movq   %rbx,%xmm4
  comisd %xmm0,%xmm4
  jb     L289
  mov    -0x98(%rbp),%rdx
  mov    (%rdx),%rax
  mov    -0x58(%rbp),%rcx
  mov    (%rax,%rcx,1),%rax
  mov    -0x60(%rbp),%rdi
  mov    (%rax,%rdi,1),%rax
  movsd  -0xa8(%rbp),%xmm4
  movsd  %xmm4,(%rax)
  mov    (%rdx),%rax
  mov    (%rax,%rcx,1),%rax
  mov    (%rax,%rdi,1),%rax
  movsd  -0xa0(%rbp),%xmm6
  movsd  %xmm6,0x8(%rax)
  movsd  -0x78(%rbp),%xmm7
  addsd  D191(%rip),%xmm7
  movsd  %xmm7,-0x78(%rbp)
  jmp    L289
L160:
  addq   $0x1,-0x1a0(%rbp)
  mov    -0x1a0(%rbp),%rax
  cmp    $0x4,%rax
  je     L387
L141:
  mov    -0x1a0(%rbp),%rcx
  lea    0x0(,%rcx,8),%rax
  mov    %rax,-0x58(%rbp)
  mov    %ecx,%eax
  add    $0x1,%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,-0xb0(%rbp)
  mov    %ecx,%eax
  add    $0x3,%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,-0xb8(%rbp)
  mov    $0x0,%r14d
  lea    -0x48(%rbp),%r13
  lea    -0x50(%rbp),%r15
  jmp    L310
L387:
  addq   $0x8,-0x68(%rbp)
  cmpl   $0x4,-0x1ac(%rbp)
  je     L280
L284:
  mov    -0x1ac(%rbp),%edx
  mov    %edx,%eax
  add    $0x1,%edx
  mov    %edx,-0x1ac(%rbp)
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  shr    $0x1e,%ecx
  add    %ecx,%edx
  and    $0x3,%edx
  sub    %ecx,%edx
  movslq %edx,%rdx
  mov    -0x1b8(%rbp),%rcx
  lea    (%rcx,%rdx,8),%rdx
  mov    %rdx,-0xc0(%rbp)
  add    $0x3,%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  lea    (%rcx,%rax,8),%rax
  mov    %rax,-0xc8(%rbp)
  movq   $0x0,-0x1a0(%rbp)
  jmp    L141
L280:
  subl   $0x1,-0x1b0(%rbp)
  je     L199
L101:
  mov    -0x1b8(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  movl   $0x0,-0x1ac(%rbp)
  jmp    L284
L199:
  subl   $0x1,-0x204(%rbp)
  je     L376
L95:
  movl   $0xfa,-0x1b0(%rbp)
  jmp    L101
L376:
  movq   $0x1,-0x58(%rbp)
  pxor   %xmm7,%xmm7
  movsd  %xmm7,-0x68(%rbp)
  movsd  %xmm7,-0x88(%rbp)
  movsd  %xmm7,-0x80(%rbp)
  movsd  %xmm7,-0x70(%rbp)
  lea    -0x48(%rbp),%r14
  mov    %r14,%r15
L53:
  mov    -0x1b8(%rbp),%rcx
  mov    -0x58(%rbp),%rsi
  mov    -0x8(%rcx,%rsi,8),%rax
  mov    %rax,-0x90(%rbp)
  mov    %esi,%edx
  sar    $0x1f,%edx
  shr    $0x1e,%edx
  mov    %esi,%eax
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  mov    (%rcx,%rax,8),%rax
  mov    %rax,-0x98(%rbp)
  mov    %esi,%eax
  add    $0x2,%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  mov    (%rcx,%rax,8),%rax
  mov    %rax,-0xa8(%rbp)
  mov    $0x0,%r13d
  mov    %r13,%r14
L293:
  mov    -0x90(%rbp),%rdi
  mov    (%rdi,%r14,8),%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x98(%rbp),%rax
  mov    (%rax,%r14,8),%rax
  mov    %rax,-0xa0(%rbp)
  mov    -0xa8(%rbp),%rax
  mov    (%rax,%r14,8),%rax
  mov    %rax,-0xb0(%rbp)
  lea    0x1(%r14),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  mov    (%rdi,%rax,8),%rax
  mov    %rax,-0xb8(%rbp)
  lea    0x3(%r14),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  mov    (%rdi,%rax,8),%rax
  mov    %rax,-0xc0(%rbp)
  mov    $0x1,%r13d
L5:
  mov    -0x60(%rbp),%rax
  mov    -0x8(%rax,%r13,8),%r12
  lea    -0x50(%rbp),%rbx
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm6
  movsd  %xmm6,-0x100(%rbp)
  movsd  -0x48(%rbp),%xmm7
  movsd  %xmm7,-0xc8(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0xc8(%rbp),%xmm6
  movapd %xmm6,%xmm7
  mulsd  -0x50(%rbp),%xmm7
  movsd  %xmm7,-0xc8(%rbp)
  movapd %xmm6,%xmm4
  mulsd  -0x48(%rbp),%xmm4
  movsd  %xmm4,-0xd8(%rbp)
  mov    -0xa0(%rbp),%rsi
  mov    -0x8(%rsi,%r13,8),%r12
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm1
  movsd  %xmm1,-0x108(%rbp)
  movsd  -0x48(%rbp),%xmm5
  movsd  %xmm5,-0x110(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,-0xe0(%rbp)
  movsd  -0x48(%rbp),%xmm3
  movsd  %xmm3,-0xe8(%rbp)
  mov    -0xb0(%rbp),%rsi
  mov    -0x8(%rsi,%r13,8),%r12
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm2
  movsd  %xmm2,-0xf0(%rbp)
  movsd  -0x48(%rbp),%xmm15
  movsd  %xmm15,-0xf8(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm2
  movsd  %xmm2,-0x118(%rbp)
  movsd  -0x48(%rbp),%xmm11
  movsd  %xmm11,-0x120(%rbp)
  mov    -0xb8(%rbp),%rsi
  mov    -0x8(%rsi,%r13,8),%r12
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm13
  movsd  %xmm13,-0x128(%rbp)
  movsd  -0x48(%rbp),%xmm9
  movsd  %xmm9,-0x130(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm10
  movsd  %xmm10,-0x138(%rbp)
  movsd  -0x48(%rbp),%xmm13
  movsd  %xmm13,-0x140(%rbp)
  mov    -0xc0(%rbp),%rsi
  mov    -0x8(%rsi,%r13,8),%r12
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm14
  movsd  %xmm14,-0x148(%rbp)
  movsd  -0x48(%rbp),%xmm8
  movsd  %xmm8,-0x150(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm12
  movsd  %xmm12,-0x158(%rbp)
  movsd  -0x48(%rbp),%xmm14
  movsd  %xmm14,-0x160(%rbp)
  mov    %r13d,%esi
  sar    $0x1f,%esi
  mov    %esi,%edx
  shr    $0x1e,%edx
  lea    (%rdx,%r13,1),%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  mov    -0x60(%rbp),%rdx
  mov    (%rdx,%rax,8),%r12
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm11
  movsd  %xmm11,-0x168(%rbp)
  movsd  -0x48(%rbp),%xmm8
  movsd  %xmm8,-0x170(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm11
  movsd  %xmm11,-0x178(%rbp)
  movsd  -0x48(%rbp),%xmm13
  movsd  %xmm13,-0x180(%rbp)
  lea    0x2(%r13),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cltq
  mov    -0x60(%rbp),%rdx
  mov    (%rdx,%rax,8),%r12
  mov    %rbx,%rsi
  mov    %r15,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  -0x50(%rbp),%xmm6
  movsd  %xmm6,-0x188(%rbp)
  movsd  -0x48(%rbp),%xmm6
  movsd  %xmm6,-0x190(%rbp)
  movsd  0x8(%r12),%xmm0
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0xe0(%rbp),%xmm0
  movsd  -0x110(%rbp),%xmm5
  mulsd  %xmm5,%xmm0
  movsd  -0x118(%rbp),%xmm2
  movsd  -0xf8(%rbp),%xmm15
  mulsd  %xmm15,%xmm2
  addsd  %xmm2,%xmm0
  movsd  -0x138(%rbp),%xmm10
  movsd  -0x130(%rbp),%xmm9
  mulsd  %xmm9,%xmm10
  addsd  %xmm10,%xmm0
  movsd  -0x158(%rbp),%xmm12
  movsd  -0x150(%rbp),%xmm10
  mulsd  %xmm10,%xmm12
  addsd  %xmm12,%xmm0
  movsd  -0x178(%rbp),%xmm12
  movsd  -0x170(%rbp),%xmm8
  mulsd  %xmm8,%xmm12
  addsd  %xmm12,%xmm0
  movsd  -0x190(%rbp),%xmm6
  movapd %xmm6,%xmm1
  mulsd  -0x50(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0xc8(%rbp),%xmm7
  mulsd  %xmm7,%xmm0
  movsd  -0xe8(%rbp),%xmm3
  mulsd  %xmm5,%xmm3
  movapd %xmm3,%xmm1
  movsd  -0x120(%rbp),%xmm2
  mulsd  %xmm15,%xmm2
  addsd  %xmm2,%xmm1
  movsd  -0x140(%rbp),%xmm2
  mulsd  %xmm9,%xmm2
  addsd  %xmm2,%xmm1
  movsd  -0x160(%rbp),%xmm2
  mulsd  %xmm10,%xmm2
  addsd  %xmm2,%xmm1
  movsd  -0x180(%rbp),%xmm2
  mulsd  %xmm8,%xmm2
  addsd  %xmm2,%xmm1
  mulsd  -0x48(%rbp),%xmm6
  addsd  %xmm6,%xmm1
  movsd  -0xd8(%rbp),%xmm4
  mulsd  %xmm4,%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0x108(%rbp),%xmm1
  addsd  -0xf0(%rbp),%xmm1
  addsd  -0x128(%rbp),%xmm1
  addsd  -0x148(%rbp),%xmm1
  addsd  -0x168(%rbp),%xmm1
  addsd  -0x188(%rbp),%xmm1
  movsd  -0x100(%rbp),%xmm6
  mulsd  %xmm6,%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0x68(%rbp),%xmm5
  subsd  %xmm0,%xmm5
  movsd  %xmm5,-0x68(%rbp)
  movsd  -0x70(%rbp),%xmm5
  addsd  %xmm7,%xmm5
  movsd  %xmm5,-0x70(%rbp)
  movsd  -0x80(%rbp),%xmm7
  addsd  %xmm4,%xmm7
  movsd  %xmm7,-0x80(%rbp)
  movsd  -0x88(%rbp),%xmm7
  addsd  %xmm6,%xmm7
  movsd  %xmm7,-0x88(%rbp)
  add    $0x1,%r13
  cmp    $0x5,%r13
  jne    L5
  add    $0x1,%r14
  cmp    $0x4,%r14
  jne    L293
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  cmp    $0x5,%rax
  jne    L53
  movsd  -0x68(%rbp),%xmm0
  mulsd  D88(%rip),%xmm0
  mov    -0x1f8(%rbp),%rdx
  mov    -0x1c0(%rbp),%rax
  movsd  %xmm0,(%rdx,%rax,1)
  mulsd  %xmm0,%xmm0
  mov    -0x200(%rbp),%rdx
  movsd  %xmm0,(%rdx,%rax,1)
  movsd  D110(%rip),%xmm1
  movsd  -0x70(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x1d0(%rbp),%rdx
  movsd  %xmm0,(%rdx,%rax,1)
  movsd  -0x80(%rbp),%xmm2
  mulsd  %xmm1,%xmm2
  mov    -0x1d8(%rbp),%rdx
  movsd  %xmm2,(%rdx,%rax,1)
  mulsd  -0x88(%rbp),%xmm1
  mov    -0x1e0(%rbp),%rdx
  movsd  %xmm1,(%rdx,%rax,1)
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L102
  sqrtsd %xmm0,%xmm0
L215:
  mov    -0x1e8(%rbp),%rdx
  mov    -0x1c0(%rbp),%rax
  movsd  %xmm0,(%rdx,%rax,1)
  mulsd  %xmm0,%xmm0
  mov    -0x1f0(%rbp),%rdx
  movsd  %xmm0,(%rdx,%rax,1)
  add    $0x8,%rax
  mov    %rax,-0x1c0(%rbp)
  cmp    $0x7d0,%rax
  je     L94
L64:
  movl   $0x1e,-0x204(%rbp)
  jmp    L95
L102:
  call   <sqrt@plt>
  jmp    L215
L94:
  mov    $0x0,%r12d
  mov    D96(%rip),%rbx
  mov    %rbx,-0x80(%rbp)
  mov    %rbx,-0x70(%rbp)
  mov    %rbx,-0x68(%rbp)
  mov    %rbx,-0x60(%rbp)
  mov    %rbx,%r15
  mov    %rbx,-0x58(%rbp)
  lea    D117(%rip),%r13
  lea    D19(%rip),%r14
L311:
  movsd  -0x58(%rbp),%xmm0
  mov    %r13,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0x1f8(%rbp),%rax
  movsd  -0x58(%rbp),%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movsd  %xmm7,-0x58(%rbp)
  movapd %xmm7,%xmm0
  mov    %r14,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0x200(%rbp),%rax
  movq   %r15,%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movq   %xmm7,%r15
  mov    -0x1e8(%rbp),%rax
  movsd  -0x60(%rbp),%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movsd  %xmm7,-0x60(%rbp)
  mov    -0x1f0(%rbp),%rax
  movsd  -0x68(%rbp),%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movsd  %xmm7,-0x68(%rbp)
  mov    -0x1d0(%rbp),%rax
  movsd  -0x70(%rbp),%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movsd  %xmm7,-0x70(%rbp)
  mov    -0x1d8(%rbp),%rax
  movsd  -0x80(%rbp),%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movsd  %xmm7,-0x80(%rbp)
  mov    -0x1e0(%rbp),%rax
  movq   %rbx,%xmm7
  addsd  (%rax,%r12,1),%xmm7
  movq   %xmm7,%rbx
  add    $0x8,%r12
  cmp    $0x7d0,%r12
  jne    L311
  movsd  -0x70(%rbp),%xmm7
  movapd %xmm7,%xmm4
  mulsd  %xmm7,%xmm4
  movsd  D97(%rip),%xmm3
  divsd  %xmm3,%xmm4
  movslq -0x208(%rbp),%rax
  lea    (%rax,%rax,2),%rdx
  lea    (%rax,%rdx,4),%rax
  mov    -0x210(%rbp),%rdx
  lea    (%rdx,%rax,8),%r12
  movsd  -0x1c8(%rbp),%xmm11
  movsd  %xmm11,(%r12)
  movsd  -0x58(%rbp),%xmm1
  divsd  %xmm3,%xmm1
  movsd  %xmm1,0x8(%r12)
  movq   %r15,%xmm0
  divsd  %xmm3,%xmm0
  movsd  %xmm0,0x10(%r12)
  movapd %xmm1,%xmm6
  mulsd  %xmm1,%xmm6
  movsd  %xmm6,0x18(%r12)
  movsd  -0x60(%rbp),%xmm2
  divsd  %xmm3,%xmm2
  movsd  %xmm2,0x20(%r12)
  movsd  -0x68(%rbp),%xmm5
  divsd  %xmm3,%xmm5
  movsd  %xmm5,0x28(%r12)
  movapd %xmm2,%xmm5
  mulsd  %xmm2,%xmm5
  movsd  %xmm5,0x30(%r12)
  mulsd  D110(%rip),%xmm1
  movsd  %xmm1,0x38(%r12)
  mulsd  D110(%rip),%xmm2
  movsd  %xmm2,0x40(%r12)
  subsd  %xmm6,%xmm0
  movapd %xmm11,%xmm1
  mulsd  %xmm11,%xmm1
  mulsd  D28(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x48(%r12)
  mulsd  D110(%rip),%xmm0
  movsd  %xmm0,0x50(%r12)
  movapd %xmm4,%xmm0
  addsd  %xmm4,%xmm0
  addsd  %xmm4,%xmm0
  divsd  %xmm3,%xmm7
  subsd  %xmm7,%xmm0
  movsd  -0x80(%rbp),%xmm1
  divsd  %xmm3,%xmm1
  subsd  %xmm1,%xmm0
  movq   %rbx,%xmm1
  divsd  %xmm3,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  -0x1a8(%rbp),%xmm0
  movsd  %xmm0,0x58(%r12)
  lea    D57(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  movsd  D110(%rip),%xmm0
  mulsd  0x58(%r12),%xmm0
  movsd  %xmm0,0x60(%r12)
  movsd  -0x78(%rbp),%xmm0
  divsd  -0xd0(%rbp),%xmm0
  lea    D65(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L200
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L200:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D191
type: f64
name: unpack_data
arguments: label: D96
type: f64[2]
name: unpack_data
arguments: label: D88
type: byte[8]
name: unpack_data
arguments: label: D110
type: byte[8]
name: unpack_data
arguments: label: D117
type: string
name: unpack_data
arguments: label: D19
type: string
name: unpack_data
arguments: label: D97
type: byte[8]
name: unpack_data
arguments: label: D28
type: byte[8]
name: unpack_data
arguments: label: D57
type: string
name: unpack_data
arguments: label: D65
type: string

tool: D191: 1

tool: {"D96": [0.0,1.0]}

tool: {"D88": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D110": [0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x3f]}

tool: D117: eSum 1: %f


tool: D19: eSum 2: %f


tool: {"D97": [0x00,0x00,0x00,0x00,0x00,0x40,0x6f,0x40]}

tool: {"D28": [0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x40]}

tool: D57: Chi: %f


tool: D65: 		Acceptance Ratio: %f


assistant: ```c
void measurement(double ****lattice, double data[][13], double temperature, double ***energy, double ***magnetization, int t) {
  int RUNS_ = (double)250;
  int N_ = (double)64;
  int eq, sk, sw, sw1, sw2, sw3;
  int ii;
  int i, j, k, ip, im, jp, jm, kp, km;
  double theta, thetaPrime, phi, phiPrime;
  double spin1theta, spin1phi, spin2theta, spin2phi, spin3theta, spin3phi, spin4theta, spin4phi, spin5theta, spin5phi, spin6theta, spin6phi;
  double newSpin[2], currentSpin[2];
  double spinDiff[3], spinSum[3];
  double dotProduct;
  double deltaE;
  double prob;
  double randNum;
  double beta = 1.0 / temperature;
  double accept, test;
  double Mxsum = 0.0, Mysum = 0.0, Mzsum = 0.0;
  double spinX, spinY, spinZ;
  double X, Y, Z;
  double Mx[RUNS_], My[RUNS_], Mz[RUNS_];
  double m[RUNS_], m2[RUNS_], e[RUNS_], e2[RUNS_];
  double e_storage = 0;
  double eSum = 0, e2Sum = 0, mSum = 0, m2Sum = 0;
  double SxSum = 0, SySum = 0, SzSum = 0;
  double SxAvg, SyAvg, SzAvg;
  double SxAvgSqr, SyAvgSqr, SzAvgSqr;
  for (eq = 0; eq < 250; eq++) {
    for (sk = 1; sk <= 30; sk++) {
      for (sw = 0; sw < 250; sw++) {
        for (sw1 = 0; sw1 < 4; sw1++) {
          for (sw2 = 0; sw2 < 4; sw2++) {
            for (sw3 = 0; sw3 < 4; sw3++) {
              i = sw1;
              j = sw2;
              k = sw3;
              ip = (i + 4 - 1) % 4;
              im = (i + 1) % 4;
              jp = (j + 4 - 1) % 4;
              jm = (j + 1) % 4;
              kp = (k + 4 - 1) % 4;
              km = (k + 1) % 4;
              currentSpin[0] = lattice[i][j][k][0];
              currentSpin[1] = lattice[i][j][k][1];
              newSpin[0] = rng_theta();
              newSpin[1] = rng_phi();
              theta = currentSpin[0];
              phi = currentSpin[1];
              thetaPrime = theta;
              phiPrime = currentSpin[1];
              spinDiff[0] = sin(thetaPrime) * cos(phiPrime) - sin(theta) * cos(phi);
              spinDiff[1] = sin(thetaPrime) * sin(phiPrime) - sin(theta) * sin(phi);
              spinDiff[2] = cos(thetaPrime) - cos(theta);
              spin1theta = lattice[im][j][k][0];
              spin1phi = lattice[im][j][k][1];
              spin2theta = lattice[ip][j][k][0];
              spin2phi = lattice[ip][j][k][1];
              spin3theta = lattice[i][jm][k][0];
              spin3phi = lattice[i][jm][k][1];
              spin4theta = lattice[i][jp][k][0];
              spin4phi = lattice[i][jp][k][1];
              spin5theta = lattice[i][j][km][0];
              spin5phi = lattice[i][j][km][1];
              spin6theta = lattice[i][j][kp][0];
              spin6phi = lattice[i][j][kp][1];
              spinSum[0] = sin(spin1theta) * cos(spin1phi) + sin(spin2theta) * cos(spin2phi) + sin(spin3theta) * cos(spin3phi) + sin(spin4theta) * cos(spin4phi) + sin(spin5theta) * cos(spin5phi) + sin(spin6theta) * cos(spin6phi);
              spinSum[1] = sin(spin1theta) * sin(spin1phi) + sin(spin2theta) * sin(spin2phi) + sin(spin3theta) * sin(spin3phi) + sin(spin4theta) * sin(spin4phi) + sin(spin5theta) * sin(spin5phi) + sin(spin6theta) * sin(spin6phi);
              spinSum[2] = cos(spin1theta) + cos(spin2theta) + cos(spin3theta) + cos(spin4theta) + cos(spin5theta) + cos(spin6theta);
              dotProduct = spinDiff[0] * spinSum[0] + spinDiff[1] * spinSum[1] + spinDiff[2] * spinSum[2];
              deltaE = -1.0 * dotProduct;
              test++;
              if (deltaE <= 0) {
                lattice[i][j][k][0] = thetaPrime;
                lattice[i][j][k][1] = phiPrime;
                accept++;
              } else {
                prob = (sin(thetaPrime) / sin(theta)) * exp(-beta * deltaE);
                randNum = rng();
                if (randNum <= prob) {
                  lattice[i][j][k][0] = thetaPrime;
                  lattice[i][j][k][1] = phiPrime;
                  accept++;
                }
              }
              thetaPrime = theta;
              phiPrime = newSpin[1];
              spinDiff[0] = sin(thetaPrime) * cos(phiPrime) - sin(theta) * cos(phi);
              spinDiff[1] = sin(thetaPrime) * sin(phiPrime) - sin(theta) * sin(phi);
              spinDiff[2] = cos(thetaPrime) - cos(theta);
              spin1theta = lattice[im][j][k][0];
              spin1phi = lattice[im][j][k][1];
              spin2theta = lattice[ip][j][k][0];
              spin2phi = lattice[ip][j][k][1];
              spin3theta = lattice[i][jm][k][0];
              spin3phi = lattice[i][jm][k][1];
              spin4theta = lattice[i][jp][k][0];
              spin4phi = lattice[i][jp][k][1];
              spin5theta = lattice[i][j][km][0];
              spin5phi = lattice[i][j][km][1];
              spin6theta = lattice[i][j][kp][0];
              spin6phi = lattice[i][j][kp][1];
              spinSum[0] = sin(spin1theta) * cos(spin1phi) + sin(spin2theta) * cos(spin2phi) + sin(spin3theta) * cos(spin4phi) + sin(spin4theta) * cos(spin4phi) + sin(spin5theta) * cos(spin5phi) + sin(spin6theta) * cos(spin6phi);
              spinSum[1] = sin(spin1theta) * sin(spin1phi) + sin(spin2theta) * sin(spin2phi) + sin(spin3theta) * sin(spin4phi) + sin(spin4theta) * sin(spin4phi) + sin(spin5theta) * sin(spin5phi) + sin(spin6theta) * sin(spin6phi);
              spinSum[2] = cos(spin1theta) + cos(spin2theta) + cos(spin3theta) + cos(spin4theta) + cos(spin5theta) + cos(spin6theta);
              dotProduct = spinDiff[0] * spinSum[0] + spinDiff[1] * spinSum[1] + spinDiff[2] * spinSum[2];
              deltaE = -1.0 * dotProduct;
              test++;
              if (deltaE <= 0) {
                lattice[i][j][k][0] = thetaPrime;
                lattice[i][j][k][1] = phiPrime;
                accept++;
              } else {
                prob = (sin(thetaPrime) / sin(theta)) * exp(-beta * deltaE);
                randNum = rng();
                if (randNum <= prob) {
                  lattice[i][j][k][0] = thetaPrime;
                  lattice[i][j][k][1] = phiPrime;
                  accept++;
                }
              }
            }
          }
        }
      }
    }
    e_storage = 0;
    Mxsum = 0.0;
    Mysum = 0.0;
    Mzsum = 0.0;
    for (sw1 = 0; sw1 < 4; sw1++) {
      for (sw2 = 0; sw2 < 4; sw2++) {
        for (sw3 = 0; sw3 < 4; sw3++) {
          i = sw1;
          j = sw2;
          k = sw3;
          ip = (i + 4 - 1) % 4;
          im = (i + 1) % 4;
          jp = (j + 4 - 1) % 4;
          jm = (j + 1) % 4;
          kp = (k + 4 - 1) % 4;
          km = (k + 1) % 4;
          theta = lattice[i][j][k][0];
          phi = lattice[i][j][k][1];
          spinX = sin(theta) * cos(phi);
          spinY = sin(theta) * sin(phi);
          spinZ = cos(theta);
          spin1theta = lattice[im][j][k][0];
          spin1phi = lattice[im][j][k][1];
          spin2theta = lattice[ip][j][k][0];
          spin2phi = lattice[ip][j][k][1];
          spin3theta = lattice[i][jm][k][0];
          spin3phi = lattice[i][jm][k][1];
          spin4theta = lattice[i][jp][k][0];
          spin4phi = lattice[i][jp][k][1];
          spin5theta = lattice[i][j][km][0];
          spin5phi = lattice[i][j][km][1];
          spin6theta = lattice[i][j][kp][0];
          spin6phi = lattice[i][j][kp][1];
          spinSum[0] = sin(spin1theta) * cos(spin1phi) + sin(spin2theta) * cos(spin2phi) + sin(spin3theta) * cos(spin3phi) + sin(spin4theta) * cos(spin4phi) + sin(spin5theta) * cos(spin5phi) + sin(spin6theta) * cos(spin6phi);
          spinSum[1] = sin(spin1theta) * sin(spin1phi) + sin(spin2theta) * sin(spin2phi) + sin(spin3theta) * sin(spin3phi) + sin(spin4theta) * sin(spin4phi) + sin(spin5theta) * sin(spin5phi) + sin(spin6theta) * sin(spin6phi);
          spinSum[2] = cos(spin1theta) + cos(spin2theta) + cos(spin3theta) + cos(spin4theta) + cos(spin5theta) + cos(spin6theta);
          dotProduct = spinX * spinSum[0] + spinY * spinSum[1] + spinZ * spinSum[2];
          e_storage = e_storage + -1.0 * dotProduct;
          X = spinX;
          Y = spinY;
          Z = spinZ;
          Mxsum += X;
          Mysum += Y;
          Mzsum += Z;
        }
      }
    }
    e[eq] = e_storage / 2.0;
    e2[eq] = e[eq] * e[eq];
    Mx[eq] = Mxsum / N_;
    My[eq] = Mysum / N_;
    Mz[eq] = Mzsum / N_;
    m[eq] = sqrt(Mx[eq] * Mx[eq] + My[eq] * My[eq] + Mz[eq] * Mz[eq]);
    m2[eq] = m[eq] * m[eq];
    if (0) {
      printf("\t\tMeasurement runs (0-%d): %d\n", 250, eq);
    }
  }
  eSum = 0;
  e2Sum = 0;
  mSum = 0;
  m2Sum = 0;
  SxSum = 0;
  SySum = 0;
  SzSum = 0;
  for (ii = 0; ii < RUNS_; ii++) {
    printf("eSum 1: %f\n", eSum);
    eSum += e[ii];
    printf("eSum 2: %f\n", eSum);
    e2Sum += e2[ii];
    mSum += m[ii];
    m2Sum += m2[ii];
    SxSum += Mx[ii];
    SySum += My[ii];
    SzSum += Mz[ii];
  }
  SxAvg = SxSum / RUNS_;
  SyAvg = SySum / RUNS_;
  SzAvg = SzSum / RUNS_;
  SxAvgSqr = (SxSum * SxSum) / RUNS_;
  SyAvgSqr = (SxSum * SxSum) / RUNS_;
  SzAvgSqr = (SxSum * SxSum) / RUNS_;
  data[t][0] = temperature;
  data[t][1] = eSum / RUNS_;
  data[t][2] = e2Sum / RUNS_;
  data[t][3] = data[t][1] * data[t][1];
  data[t][4] = mSum / RUNS_;
  data[t][5] = m2Sum / RUNS_;
  data[t][6] = data[t][4] * data[t][4];
  data[t][7] = data[t][1] / N_;
  data[t][8] = data[t][4] / N_;
  data[t][9] = (data[t][2] - data[t][3]) / (temperature * temperature * N_);
  data[t][10] = data[t][9] / N_;
  data[t][11] = (1.0 / temperature) * (SxAvgSqr + SyAvgSqr + SzAvgSqr - SxAvg - SyAvg - SzAvg);
  printf("Chi: %f\n", data[t][11]);
  data[t][12] = data[t][11] / N_;
  printf("\t\tAcceptance Ratio: %f\n", accept / test);
}
```