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

```asm
<distance_to_vslice>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x88,%rsp
  mov    %ecx,0x10(%rsp)
  lea    0x58(%rsp),%rdx
  lea    0x5c(%rsp),%rcx
  mov    %r8d,0x14(%rsp)
  lea    0x54(%rsp),%rsi
  sub    $0x8,%rsp
  mov    %r9,0x40(%rsp)
  movss  %xmm0,0x28(%rsp)
  movss  %xmm1,0x34(%rsp)
  movss  %xmm2,0x38(%rsp)
  movss  %xmm3,0x3c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x80(%rsp)
  xor    %eax,%eax
  lea    0x70(%rsp),%rax
  push   %rax
  lea    0x74(%rsp),%r9
  lea    0x70(%rsp),%r8
  call   <vis5d_get_sizePRIME@plt>
  pxor   %xmm7,%xmm7
  mov    $0x1,%r10d
  movss  D10(%rip),%xmm4
  cvtsi2ss %r12d,%xmm7
  movss  %xmm7,0x18(%rsp)
  pxor   %xmm7,%xmm7
  cvtsi2ss %ebp,%xmm7
  movss  %xmm7,0x1c(%rsp)
  pop    %rdx
  pop    %rcx
  lea    0x6c(%rsp),%rbp
  lea    0x74(%rsp),%r15
  mov    0x60(%rsp),%eax
  movss  %xmm4,0x4(%rsp)
  lea    0x70(%rsp),%r14
  lea    0x4c(%rsp),%r13
  mov    %r15,%r9
  lea    0x48(%rsp),%r12
  mov    %r13,%r15
  mov    %r14,%r13
  mov    %r12,%r14
  mov    %rbp,%r12
  mov    %ebx,%ebp
  mov    %r10d,%ebx
  lea    -0x1(%rbx),%r10d
  cmp    $0x3,%ebx
  je     L1
L65:
  cmp    $0x3,%r10d
  je     L89
  cmp    $0x1,%r10d
  je     L0
  mov    0x5c(%rsp),%edx
  pxor   %xmm2,%xmm2
  movss  0x2c(%rsp),%xmm1
  mov    %ebp,%edi
  movss  0x20(%rsp),%xmm0
  mov    0x10(%rsp),%esi
  mov    %r13,%r8
  mov    %r12,%rcx
  lea    -0x1(%rax,%rdx,1),%eax
  mov    0x14(%rsp),%edx
  mov    %r10d,0x28(%rsp)
  cvtsi2ss %eax,%xmm2
  mov    %r9,0x18(%rsp)
  call   <vis5d_gridPRIME_to_xyzPRIME@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <vis5d_project@plt>
  movss  0x48(%rsp),%xmm0
  movss  0x4c(%rsp),%xmm1
  subss  0x8(%rsp),%xmm0
  subss  0xc(%rsp),%xmm1
  movss  0x4(%rsp),%xmm7
  mov    0x18(%rsp),%r9
  mov    0x28(%rsp),%r10d
  mulss  %xmm0,%xmm0
  mulss  %xmm1,%xmm1
  addss  %xmm1,%xmm0
  comiss %xmm0,%xmm7
  jbe    L15
L171:
  movss  %xmm0,0x4(%rsp)
L113:
  mov    0x38(%rsp),%rax
  mov    %r10d,(%rax)
L15:
  cmp    $0x4,%ebx
  je     L51
L132:
  add    $0x1,%ebx
  mov    0x60(%rsp),%eax
  lea    -0x1(%rbx),%r10d
  cmp    $0x3,%ebx
  jne    L65
L1:
  pxor   %xmm2,%xmm2
  movss  0x2c(%rsp),%xmm1
  movss  0x20(%rsp),%xmm0
  cvtsi2ss %eax,%xmm2
  jmp    L56
  nopw   0x0(%rax,%rax,1)
L89:
  pxor   %xmm2,%xmm2
  movss  0x34(%rsp),%xmm1
  mov    0x14(%rsp),%edx
  mov    %ebp,%edi
  cvtsi2ss %eax,%xmm2
  movss  0x30(%rsp),%xmm0
  mov    %r13,%r8
  mov    %r12,%rcx
  mov    0x10(%rsp),%esi
  mov    %r9,0x18(%rsp)
  mov    %r10d,0x28(%rsp)
  call   <vis5d_gridPRIME_to_xyzPRIME@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <vis5d_project@plt>
  movss  0x48(%rsp),%xmm0
  movss  0x4c(%rsp),%xmm1
  subss  0x8(%rsp),%xmm0
  subss  0xc(%rsp),%xmm1
  movss  0x4(%rsp),%xmm6
  mov    0x18(%rsp),%r9
  mulss  %xmm0,%xmm0
  mulss  %xmm1,%xmm1
  addss  %xmm1,%xmm0
  comiss %xmm0,%xmm6
  ja     L179
L51:
  mov    %ebp,%ebx
  lea    0x50(%rsp),%rsi
  mov    %r12,%rbp
  mov    %r14,%r12
  mov    %ebx,%edi
  mov    %r13,%r14
  mov    %r15,%r13
  mov    %r9,%r15
  call   <vis5d_get_curved@plt>
  mov    0x50(%rsp),%eax
  test   %eax,%eax
  jne    L119
  movss  0x2c(%rsp),%xmm1
  movss  0x20(%rsp),%xmm3
  mov    %r15,%r9
  mov    $0x4,%r10d
  addss  0x34(%rsp),%xmm1
  addss  0x30(%rsp),%xmm3
  mov    %r13,%r15
  mov    %r14,%r13
  movss  D6(%rip),%xmm0
  mov    %r12,%r14
  mov    %rbp,%r12
  mov    %ebx,%ebp
  mulss  %xmm0,%xmm1
  mulss  %xmm0,%xmm3
L29:
  mov    %r10d,%ebx
  lea    0x1(%r10),%r10d
  mov    0x60(%rsp),%eax
  mov    %r10d,0x2c(%rsp)
  cmp    $0x4,%ebx
  je     L178
  pxor   %xmm2,%xmm2
  mov    0x14(%rsp),%edx
  mov    0x10(%rsp),%esi
  movaps %xmm3,%xmm0
  cvtsi2ss %eax,%xmm2
  mov    %r13,%r8
  mov    %r12,%rcx
  mov    %ebp,%edi
  mov    %r9,0x20(%rsp)
  movss  %xmm1,0x28(%rsp)
  movss  %xmm3,0x18(%rsp)
  call   <vis5d_gridPRIME_to_xyzPRIME@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <vis5d_project@plt>
  movss  0x48(%rsp),%xmm0
  mov    0x20(%rsp),%r9
  subss  0x8(%rsp),%xmm0
  movss  0x4c(%rsp),%xmm2
  subss  0xc(%rsp),%xmm2
  movss  0x4(%rsp),%xmm4
  movss  0x18(%rsp),%xmm3
  movss  0x28(%rsp),%xmm1
  mulss  %xmm0,%xmm0
  mov    0x2c(%rsp),%r10d
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  comiss %xmm0,%xmm4
  ja     L131
L108:
  cmp    $0x6,%r10d
  jne    L29
L119:
  mov    0x78(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  movss  0x4(%rsp),%xmm0
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L178:
  mov    0x5c(%rsp),%edx
  pxor   %xmm2,%xmm2
  mov    0x10(%rsp),%esi
  movaps %xmm3,%xmm0
  mov    %r13,%r8
  mov    %r12,%rcx
  mov    %ebp,%edi
  mov    %r9,0x20(%rsp)
  lea    -0x1(%rax,%rdx,1),%eax
  mov    0x14(%rsp),%edx
  movss  %xmm1,0x28(%rsp)
  cvtsi2ss %eax,%xmm2
  movss  %xmm3,0x18(%rsp)
  call   <vis5d_gridPRIME_to_xyzPRIME@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <vis5d_project@plt>
  movss  0x48(%rsp),%xmm0
  mov    0x20(%rsp),%r9
  subss  0x8(%rsp),%xmm0
  movss  0x4c(%rsp),%xmm2
  subss  0xc(%rsp),%xmm2
  movss  0x4(%rsp),%xmm7
  movss  0x18(%rsp),%xmm3
  movss  0x28(%rsp),%xmm1
  mulss  %xmm0,%xmm0
  mov    0x2c(%rsp),%r10d
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  comiss %xmm0,%xmm7
  jbe    L29
L131:
  mov    0x38(%rsp),%rax
  movss  %xmm0,0x4(%rsp)
  mov    %ebx,(%rax)
  jmp    L108
  nopl   0x0(%rax)
L0:
  mov    0x5c(%rsp),%edx
  pxor   %xmm2,%xmm2
  movss  0x34(%rsp),%xmm1
  movss  0x30(%rsp),%xmm0
  lea    -0x1(%rax,%rdx,1),%eax
  cvtsi2ss %eax,%xmm2
L56:
  mov    0x14(%rsp),%edx
  mov    0x10(%rsp),%esi
  mov    %r13,%r8
  mov    %r12,%rcx
  mov    %ebp,%edi
  mov    %r10d,0x28(%rsp)
  mov    %r9,0x18(%rsp)
  call   <vis5d_gridPRIME_to_xyzPRIME@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <vis5d_project@plt>
  movss  0x48(%rsp),%xmm0
  movss  0x4c(%rsp),%xmm1
  subss  0x8(%rsp),%xmm0
  subss  0xc(%rsp),%xmm1
  movss  0x4(%rsp),%xmm6
  mov    0x18(%rsp),%r9
  mov    0x28(%rsp),%r10d
  mulss  %xmm0,%xmm0
  mulss  %xmm1,%xmm1
  addss  %xmm1,%xmm0
  comiss %xmm0,%xmm6
  ja     L171
  jmp    L132
  nopl   (%rax)
L179:
  mov    0x28(%rsp),%r10d
  movss  %xmm0,0x4(%rsp)
  jmp    L113
L61:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D10
data_type: f32
name: unpack_data
arguments: data_tag: D6
data_type: byte[4]

tool: D10: 1000000

tool: {"D6": [0x00,0x00,0x00,0x3f]}

assistant: ```c
float distance_to_vslice(int index, int curx, int cury, int time, int var, float r1, float c1, float r2, float c2, int *corner) {
  float cx, cy;
  float px, py;
  float r, c, l;
  float dist, neardist, p[3];
  int i;
  int curved;
  int Nr, Nc, Nl, LowLev, MaxNlVar, WindNl, WindLow;
  vis5d_get_sizePRIME(index, &Nr, &Nc, &Nl, &LowLev, &WindNl, &WindLow);
  neardist = 1000000.0;
  cx = (float)curx;
  cy = (float)cury;
  for (i = 0; i < 4; i++) {
    switch (i) {
    case 0:
      r = r1;
      c = c1;
      l = (float)(Nl - 1 + LowLev);
      break;
    case 1:
      r = r2;
      c = c2;
      l = (float)(Nl - 1 + LowLev);
      break;
    case 2:
      r = r1;
      c = c1;
      l = (float)LowLev;
      break;
    case 3:
      r = r2;
      c = c2;
      l = (float)LowLev;
      break;
    }
    vis5d_gridPRIME_to_xyzPRIME(index, time, var, r, c, l, &p[0], &p[1], &p[2]);
    vis5d_project(index, p, &px, &py);
    dist = (px - cx) * (px - cx) + (py - cy) * (py - cy);
    if (dist < neardist) {
      neardist = dist;
      *corner = i;
    }
  }
  vis5d_get_curved(index, &curved);
  if (curved == 0) {
    for (i = 4; i < 6; i++) {
      c = (c1 + c2) / 2.0;
      r = (r1 + r2) / 2.0;
      if (i == 4) {
        l = (float)(Nl - 1 + LowLev);
      } else {
        l = (float)LowLev;
      }
      vis5d_gridPRIME_to_xyzPRIME(index, time, var, r, c, l, &p[0], &p[1], &p[2]);
      vis5d_project(index, p, &px, &py);
      dist = (px - cx) * (px - cx) + (py - cy) * (py - cy);
      if (dist < neardist) {
        neardist = dist;
        *corner = i;
      }
    }
  }
  return neardist;
}
```