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

```asm
<wedge>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    0x50(%rsp),%rax
  mov    %rcx,0x8(%rsp)
  movl   $0x0,(%rax)
  test   %esi,%esi
  je     L82
  mov    %rdi,%r12
  mov    %esi,%ebp
  mov    %rdx,%rbx
  mov    %r8,%r13
  mov    %r9,%r15
  xor    %eax,%eax
  jmp    L278
  nopl   0x0(%rax)
L284:
  mov    (%rbx,%rdx,4),%eax
  cmp    %eax,%ebp
  je     L82
L278:
  movslq %eax,%rdx
  mov    D33(%rip),%rax
  mov    %r15,%rsi
  lea    (%r12,%rdx,8),%rdi
  mov    %rdx,(%rsp)
  movq   %rax,%xmm0
  call   <s_unit2@plt>
  mov    (%rsp),%rdx
  test   %eax,%eax
  mov    %eax,%r14d
  jne    L284
  movss  0x4(%r15),%xmm0
  movsd  D2(%rip),%xmm3
  xor    %r10d,%r10d
  movss  %xmm0,0x0(%r13)
  xorps  D125(%rip),%xmm0
  movss  (%r15),%xmm1
  xorps  D125(%rip),%xmm1
  movss  %xmm1,0x4(%r13)
  movss  %xmm0,(%r15)
  movss  0x4(%r13),%xmm1
  xorps  D125(%rip),%xmm1
  movss  %xmm1,0x4(%r15)
  jmp    L185
  nop
L55:
  comisd %xmm1,%xmm3
  jae    L103
L136:
  movslq (%rbx,%rax,4),%r10
  mov    0x50(%rsp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L159
L1:
  cmp    %r10d,%ebp
  je     L132
  movss  (%r15),%xmm0
  movss  0x4(%r15),%xmm1
L185:
  movslq %r10d,%rax
  movss  0x0(%r13),%xmm5
  movss  0x4(%r13),%xmm6
  lea    (%r12,%rax,8),%rdx
  movss  (%rdx),%xmm4
  movss  0x4(%rdx),%xmm2
  movaps %xmm6,%xmm7
  mulss  %xmm2,%xmm1
  mulss  %xmm4,%xmm0
  mulss  %xmm2,%xmm7
  addss  %xmm1,%xmm0
  movaps %xmm5,%xmm1
  mulss  %xmm4,%xmm1
  cvtss2sd %xmm0,%xmm0
  comisd D103(%rip),%xmm0
  addss  %xmm7,%xmm1
  cvtss2sd %xmm1,%xmm1
  jae    L55
  comisd D103(%rip),%xmm1
  jb     L226
  comisd %xmm0,%xmm3
  jb     L136
  xorps  D125(%rip),%xmm2
  mov    D33(%rip),%rax
  mov    %r15,%rsi
  mov    %r15,%rdi
  mov    %r10d,(%rsp)
  movss  %xmm2,(%r15)
  movss  (%rdx),%xmm0
  movss  %xmm0,0x4(%r15)
  movq   %rax,%xmm0
  call   <s_unit2@plt>
  mov    (%rsp),%r10d
  nopw   0x0(%rax,%rax,1)
L109:
  mov    0x8(%rsp),%rdx
  mov    %r10d,%edi
  mov    %rbx,%rsi
  call   <move_to_front@plt>
  mov    D2(%rip),%rcx
  cltq
  movslq (%rbx,%rax,4),%r10
  mov    0x50(%rsp),%rax
  movq   %rcx,%xmm3
  mov    (%rax),%eax
  test   %eax,%eax
  je     L1
L159:
  cmp    %r10d,%ebp
  jne    L183
  jmp    L132
  nopl   0x0(%rax,%rax,1)
L70:
  comisd %xmm1,%xmm3
  ja     L3
  movss  %xmm4,0x0(%r13)
  movss  0x4(%r15),%xmm0
  movss  %xmm0,0x4(%r13)
L133:
  movslq (%rbx,%r10,4),%r10
  cmp    %r10d,%ebp
  je     L132
L183:
  lea    (%r12,%r10,8),%rax
  movss  0x0(%r13),%xmm5
  movss  0x4(%r15),%xmm1
  movss  (%rax),%xmm2
  movss  0x4(%rax),%xmm0
  movss  (%r15),%xmm4
  mulss  %xmm0,%xmm1
  movaps %xmm2,%xmm6
  mulss  0x4(%r13),%xmm0
  mulss  %xmm5,%xmm2
  mulss  %xmm4,%xmm6
  addss  %xmm2,%xmm0
  addss  %xmm6,%xmm1
  cvtss2sd %xmm0,%xmm0
  comisd %xmm0,%xmm3
  cvtss2sd %xmm1,%xmm1
  ja     L70
  comisd %xmm1,%xmm3
  jbe    L133
  movss  %xmm5,(%r15)
  movslq (%rbx,%r10,4),%r10
  movss  0x4(%r13),%xmm0
  movss  %xmm0,0x4(%r15)
  cmp    %r10d,%ebp
  jne    L183
  xchg   %ax,%ax
L132:
  mov    $0x1,%r14d
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L82:
  mov    $0x2,%r14d
L3:
  add    $0x18,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L226:
  comisd %xmm0,%xmm3
  jb     L141
  comisd %xmm1,%xmm3
  jae    L3
L10:
  mov    D33(%rip),%rax
  mov    %r15,%rsi
  mov    %r13,%rdi
  mov    %r10d,(%rsp)
  movq   %rax,%xmm0
  call   <s_unit2@plt>
  mov    (%rsp),%r10d
L224:
  mov    0x50(%rsp),%rax
  movl   $0x1,(%rax)
  jmp    L109
  nopl   0x0(%rax,%rax,1)
L103:
  mov    D33(%rip),%rax
  movss  %xmm2,0x0(%r13)
  movss  (%rdx),%xmm0
  mov    %r13,%rsi
  xorps  D125(%rip),%xmm0
  mov    %r13,%rdi
  mov    %r10d,(%rsp)
  movss  %xmm0,0x4(%r13)
  movq   %rax,%xmm0
  call   <s_unit2@plt>
  mov    (%rsp),%r10d
  jmp    L109
  nopl   0x0(%rax,%rax,1)
L141:
  comisd %xmm1,%xmm3
  jae    L221
  comisd %xmm0,%xmm3
  jae    L10
  mulss  %xmm6,%xmm4
  pxor   %xmm6,%xmm6
  mulss  %xmm2,%xmm5
  subss  %xmm4,%xmm5
  comiss %xmm5,%xmm6
  jbe    L136
  jmp    L224
  nopw   0x0(%rax,%rax,1)
L221:
  mov    D33(%rip),%rax
  mov    %r13,%rsi
  mov    %r15,%rdi
  mov    %r10d,(%rsp)
  movq   %rax,%xmm0
  call   <s_unit2@plt>
  mov    (%rsp),%r10d
  jmp    L224
```

tool_calls: name: parse_data
arguments: tag: D33
datatype: byte[8]
name: parse_data
arguments: tag: D2
datatype: byte[8]
name: parse_data
arguments: tag: D125
datatype: byte[16]
name: parse_data
arguments: tag: D103
datatype: byte[16]

tool: {"D33": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x7a,0x3e]}

tool: {"D2": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x8a,0xbe]}

tool: {"D125": [0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D103": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x8a,0x3e,0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x8a,0xbe]}

assistant: ```c
int wedge(float halves[][2], int m, int next[], int prev[], float cw_vec[], float ccw_vec[], int *degen) {
  int i;
  float d_cw, d_ccw;
  int offensive;
  *degen = 0;
  for (i = 0; i != m; i = next[i]) {
    if (!s_unit2(halves[i], ccw_vec, 1.0e-7)) {
      cw_vec[0] = ccw_vec[1];
      cw_vec[1] = -ccw_vec[0];
      ccw_vec[0] = -cw_vec[0];
      ccw_vec[1] = -cw_vec[1];
      break;
    }
  }
  if (i == m)
    return (2);
  i = 0;
  while (i != m) {
    offensive = 0;
    d_cw = ((cw_vec)[0] * (halves[i])[0] + (cw_vec)[1] * (halves[i])[1]);
    d_ccw = ((ccw_vec)[0] * (halves[i])[0] + (ccw_vec)[1] * (halves[i])[1]);
    if (d_ccw >= 2 * 1.0e-7) {
      if (d_cw <= -2 * 1.0e-7) {
        cw_vec[0] = halves[i][1];
        cw_vec[1] = -halves[i][0];
        (void)s_unit2(cw_vec, cw_vec, 1.0e-7);
        offensive = 1;
      }
    } else if (d_cw >= 2 * 1.0e-7) {
      if (d_ccw <= -2 * 1.0e-7) {
        ccw_vec[0] = -halves[i][1];
        ccw_vec[1] = halves[i][0];
        (void)s_unit2(ccw_vec, ccw_vec, 1.0e-7);
        offensive = 1;
      }
    } else if (d_ccw <= -2 * 1.0e-7 && d_cw <= -2 * 1.0e-7) {
      return (0);
    } else if ((d_cw <= -2 * 1.0e-7) || (d_ccw <= -2 * 1.0e-7) || (((cw_vec)[0] * (halves[i])[1] - (cw_vec)[1] * (halves[i])[0]) < 0.0)) {
      if (d_cw <= -2 * 1.0e-7) {
        (void)s_unit2(ccw_vec, cw_vec, 1.0e-7);
      } else if (d_ccw <= -2 * 1.0e-7) {
        (void)s_unit2(cw_vec, ccw_vec, 1.0e-7);
      }
      *degen = 1;
      offensive = 1;
    }
    if (offensive)
      i = move_to_front(i, next, prev);
    i = next[i];
    if (*degen)
      break;
  }
  if (*degen) {
    while (i != m) {
      d_cw = ((cw_vec)[0] * (halves[i])[0] + (cw_vec)[1] * (halves[i])[1]);
      d_ccw = ((ccw_vec)[0] * (halves[i])[0] + (ccw_vec)[1] * (halves[i])[1]);
      if (d_cw < -2 * 1.0e-7) {
        if (d_ccw < -2 * 1.0e-7) {
          return (0);
        } else {
          cw_vec[0] = ccw_vec[0];
          cw_vec[1] = ccw_vec[1];
        }
      } else if (d_ccw < -2 * 1.0e-7) {
        ccw_vec[0] = cw_vec[0];
        ccw_vec[1] = cw_vec[1];
      }
      i = next[i];
    }
  }
  return (1);
}
```