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

```asm
<partition_double>:
  endbr64
  test   %edx,%edx
  push   %r15
  mov    %edx,%r11d
  mov    %r9,%rdx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rcx,%rbx
  jle    L177
  pxor   %xmm1,%xmm1
  xor    %eax,%eax
  xor    %ecx,%ecx
  nopw   0x0(%rax,%rax,1)
L221:
  movsd  0x8(%rdx),%xmm0
  subsd  (%rdx),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  cmova  %eax,%ecx
  add    $0x1,%eax
  movapd %xmm0,%xmm1
  add    $0x10,%rdx
  cmp    %eax,%r11d
  jne    L221
  lea    (%rcx,%rcx,1),%eax
  cltq
  lea    (%r9,%rax,8),%rdx
  lea    0x8(,%rax,8),%rax
L139:
  movsd  (%r9,%rax,1),%xmm1
  movsd  (%rdx),%xmm0
  mov    $0x1,%eax
  comisd %xmm1,%xmm0
  jae    L101
  lea    (%rbx,%r8,1),%rax
  addsd  %xmm1,%xmm0
  movslq %r11d,%r15
  movslq %ecx,%r8
  lea    -0x1(%rax),%r14
  mulsd  D6(%rip),%xmm0
  mov    %rax,-0x8(%rsp)
  cmp    %r14,%rbx
  ja     L5
  mov    %r14,%rdx
  mov    %rbx,%rax
  cmp    $0x1,%r11d
  je     L282
  jmp    L40
  nopw   0x0(%rax,%rax,1)
L248:
  add    $0x1,%rax
  cmp    %rax,%rdx
  jb     L0
L282:
  lea    (%rsi,%rax,8),%r10
  mov    (%r10),%r9
  lea    (%r9,%r8,1),%rbp
  comisd (%rdi,%rbp,8),%xmm0
  ja     L248
  lea    (%rsi,%rdx,8),%rbp
  mov    0x0(%rbp),%r12
  lea    (%r12,%r8,1),%r13
  movsd  (%rdi,%r13,8),%xmm1
  comisd %xmm0,%xmm1
  jb     L55
  test   %rdx,%rdx
  je     L0
L68:
  sub    $0x1,%rdx
  cmp    %rax,%rdx
  jae    L282
L0:
  cmp    %rax,%rbx
  je     L5
  cmp    %rax,-0x8(%rsp)
  je     L50
L125:
  sub    %rbx,%rax
L244:
  mov    0x38(%rsp),%rdx
  mov    %ecx,(%rdx)
  mov    0x40(%rsp),%rdx
  movsd  %xmm0,(%rdx)
  mov    0x48(%rsp),%rdx
  mov    %rax,(%rdx)
  xor    %eax,%eax
L101:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L41:
  add    $0x1,%rax
L25:
  cmp    %rax,%rdx
  jb     L0
L40:
  lea    (%rsi,%rax,8),%rbp
  mov    0x0(%rbp),%r10
  mov    %r10,%r9
  imul   %r15,%r9
  add    %r8,%r9
  comisd (%rdi,%r9,8),%xmm0
  ja     L41
  lea    (%rsi,%rdx,8),%r12
  mov    (%r12),%r13
  mov    %r13,%r9
  imul   %r15,%r9
  add    %r8,%r9
  movsd  (%rdi,%r9,8),%xmm1
  comisd %xmm0,%xmm1
  jae    L29
  mov    %r13,0x0(%rbp)
  add    $0x1,%rax
  mov    %r10,(%r12)
L65:
  sub    $0x1,%rdx
  jmp    L25
  nopl   0x0(%rax,%rax,1)
L55:
  mov    %r12,(%r10)
  add    $0x1,%rax
  mov    %r9,0x0(%rbp)
  jmp    L68
L29:
  test   %rdx,%rdx
  jne    L65
  jmp    L0
  nopw   0x0(%rax,%rax,1)
L5:
  lea    (%rsi,%rbx,8),%r9
  mov    (%r9),%r10
  mov    %r10,%rax
  imul   %r15,%rax
  add    %r8,%rax
  movsd  (%rdi,%rax,8),%xmm0
  lea    0x1(%rbx),%rax
  cmp    %rax,%r14
  jb     L173
  cmp    $0x1,%r11d
  jne    L325
  nopl   0x0(%rax)
L200:
  mov    (%rsi,%rax,8),%rdx
  add    %r8,%rdx
  movsd  (%rdi,%rdx,8),%xmm1
  comisd %xmm1,%xmm0
  minsd  %xmm0,%xmm1
  cmova  %rax,%rbx
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %rax,%r14
  jae    L200
L337:
  lea    (%rsi,%rbx,8),%rax
  mov    (%rax),%rdx
L281:
  mov    %r10,(%rax)
  mov    $0x1,%eax
  mov    %rdx,(%r9)
  jmp    L244
  nopl   0x0(%rax)
L325:
  mov    (%rsi,%rax,8),%rdx
  imul   %r15,%rdx
  add    %r8,%rdx
  movsd  (%rdi,%rdx,8),%xmm1
  comisd %xmm1,%xmm0
  minsd  %xmm0,%xmm1
  cmova  %rax,%rbx
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %rax,%r14
  jae    L325
  jmp    L337
  nopl   0x0(%rax,%rax,1)
L50:
  lea    (%rsi,%r14,8),%r10
  mov    (%r10),%rbp
  mov    %rbp,%rax
  imul   %r15,%rax
  add    %r8,%rax
  movsd  (%rdi,%rax,8),%xmm0
  cmp    %r14,%rbx
  jae    L58
  mov    %r14,%rdx
  mov    %rbx,%rax
  cmp    $0x1,%r11d
  jne    L274
  nopl   0x0(%rax,%rax,1)
L329:
  mov    (%rsi,%rax,8),%r9
  add    %r8,%r9
  movsd  (%rdi,%r9,8),%xmm1
  comisd %xmm0,%xmm1
  maxsd  %xmm0,%xmm1
  cmova  %rax,%rdx
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %rax,%r14
  jne    L329
L199:
  lea    (%rsi,%rdx,8),%rax
  mov    (%rax),%rdx
L319:
  mov    %rbp,(%rax)
  mov    %r14,%rax
  mov    %rdx,(%r10)
  jmp    L125
  nopl   0x0(%rax,%rax,1)
L274:
  mov    (%rsi,%rax,8),%r9
  imul   %r15,%r9
  add    %r8,%r9
  movsd  (%rdi,%r9,8),%xmm1
  comisd %xmm0,%xmm1
  maxsd  %xmm0,%xmm1
  cmova  %rax,%rdx
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %r14,%rax
  jne    L274
  jmp    L199
  nopl   0x0(%rax)
L177:
  mov    $0x8,%eax
  xor    %ecx,%ecx
  jmp    L139
L173:
  mov    %r10,%rdx
  mov    %r9,%rax
  jmp    L281
L58:
  mov    %rbp,%rdx
  mov    %r10,%rax
  jmp    L319
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D6
data_type: f32[2]

tool: {"D6": [0.0,1.75]}

assistant: ```c
int partition_double(double *pa, uint32_t *pidx, int8_t no_dims, uint32_t start_idx, uint32_t n, double *bbox, int8_t *cut_dim, double *cut_val, uint32_t *n_lo) {
  int8_t dim = 0, i;
  uint32_t p, q, i2;
  double size = 0, min_val, max_val, split, side_len, cur_val;
  uint32_t end_idx = start_idx + n - 1;
  for (i = 0; i < no_dims; i++) {
    side_len = bbox[2 * i + 1] - bbox[2 * i];
    if (side_len > size) {
      dim = i;
      size = side_len;
    }
  }
  min_val = bbox[2 * dim];
  max_val = bbox[2 * dim + 1];
  if (min_val >= max_val)
    return 1;
  split = (min_val + max_val) / 2;
  p = start_idx;
  q = end_idx;
  while (p <= q) {
    if ((pa[no_dims * pidx[p] + dim]) < split) {
      p++;
    } else if ((pa[no_dims * pidx[q] + dim]) >= split) {
      if (q > 0) {
        q--;
      } else {
        break;
      }
    } else {
      {
        uint32_t tmp = pidx[p];
        pidx[p] = pidx[q];
        pidx[q] = tmp;
      };
      p++;
      q--;
    }
  }
  if (p == start_idx) {
    uint32_t j = start_idx;
    split = (pa[no_dims * pidx[j] + dim]);
    for (i2 = start_idx + 1; i2 <= end_idx; i2++) {
      cur_val = (pa[no_dims * pidx[i2] + dim]);
      if (cur_val < split) {
        j = i2;
        split = cur_val;
      }
    }
    {
      uint32_t tmp = pidx[j];
      pidx[j] = pidx[start_idx];
      pidx[start_idx] = tmp;
    };
    p = start_idx + 1;
  } else if (p == end_idx + 1) {
    uint32_t j = end_idx;
    split = (pa[no_dims * pidx[j] + dim]);
    for (i2 = start_idx; i2 < end_idx; i2++) {
      cur_val = (pa[no_dims * pidx[i2] + dim]);
      if (cur_val > split) {
        j = i2;
        split = cur_val;
      }
    }
    {
      uint32_t tmp = pidx[j];
      pidx[j] = pidx[end_idx];
      pidx[end_idx] = tmp;
    };
    p = end_idx;
  }
  *cut_dim = dim;
  *cut_val = split;
  *n_lo = p - start_idx;
  return 0;
}
```