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

```asm
<partition_double>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r10
  mov    %rsi,%rdi
  mov    %edx,%ebp
  mov    %rcx,%r13
  test   %edx,%edx
  jle    L177
  mov    %r9,%rdx
  pxor   %xmm1,%xmm1
  mov    $0x0,%eax
  mov    $0x0,%r11d
L139:
  movsd  0x8(%rdx),%xmm0
  subsd  (%rdx),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  cmova  %eax,%r11d
  add    $0x1,%eax
  add    $0x10,%rdx
  cmp    %eax,%ebp
  jne    L139
L188:
  lea    (%r11,%r11,1),%eax
  cltq
  movsd  (%r9,%rax,8),%xmm0
  movsd  0x8(%r9,%rax,8),%xmm1
  mov    $0x1,%eax
  comisd %xmm1,%xmm0
  jae    L55
  lea    0x0(%r13,%r8,1),%rax
  mov    %rax,-0x8(%rsp)
  lea    -0x1(%rax),%r15
  addsd  %xmm1,%xmm0
  mulsd  D0(%rip),%xmm0
  cmp    %r15,%r13
  ja     L23
  mov    %r15,%rdx
  mov    %r13,%rax
  movslq %ebp,%r9
  movslq %r11d,%rbx
  jmp    L49
L177:
  mov    $0x0,%r11d
  jmp    L188
L132:
  lea    (%rdi,%rdx,8),%r12
  mov    (%r12),%r14
  mov    %r9,%rcx
  imul   %r14,%rcx
  add    %rbx,%rcx
  movsd  (%r10,%rcx,8),%xmm1
  comisd %xmm0,%xmm1
  jb     L94
  test   %rdx,%rdx
  je     L102
  sub    $0x1,%rdx
  jmp    L156
L94:
  mov    %r14,(%r8)
  mov    %rsi,(%r12)
  add    $0x1,%rax
  sub    $0x1,%rdx
L156:
  cmp    %rdx,%rax
  ja     L102
L49:
  lea    (%rdi,%rax,8),%r8
  mov    (%r8),%rsi
  mov    %r9,%rcx
  imul   %rsi,%rcx
  add    %rbx,%rcx
  comisd (%r10,%rcx,8),%xmm0
  jbe    L132
  add    $0x1,%rax
  jmp    L156
L102:
  cmp    %rax,%r13
  je     L23
  cmp    %rax,-0x8(%rsp)
  je     L155
L119:
  mov    0x38(%rsp),%rdx
  mov    %r11d,(%rdx)
  mov    0x40(%rsp),%rdx
  movsd  %xmm0,(%rdx)
  sub    %r13,%rax
  mov    0x48(%rsp),%rdx
  mov    %rax,(%rdx)
  mov    $0x0,%eax
L55:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L23:
  movslq %ebp,%rbp
  lea    (%rdi,%r13,8),%r9
  mov    (%r9),%rbx
  movslq %r11d,%r8
  mov    %rbp,%rax
  imul   %rbx,%rax
  add    %r8,%rax
  movsd  (%r10,%rax,8),%xmm0
  lea    0x1(%r13),%rax
  cmp    %rax,%r15
  jb     L147
  mov    %r13,%rsi
  mov    %rax,%rdx
L179:
  mov    %rbp,%rcx
  imul   (%rdi,%rdx,8),%rcx
  add    %r8,%rcx
  movsd  (%r10,%rcx,8),%xmm1
  comisd %xmm1,%xmm0
  cmova  %rdx,%rsi
  minsd  %xmm0,%xmm1
  movapd %xmm1,%xmm0
  add    $0x1,%rdx
  cmp    %rdx,%r15
  jae    L179
L193:
  lea    (%rdi,%rsi,8),%rdx
  mov    (%rdx),%rcx
  mov    %rbx,(%rdx)
  mov    %rcx,(%r9)
  jmp    L119
L147:
  mov    %r13,%rsi
  jmp    L193
L155:
  lea    (%rdi,%r15,8),%r8
  mov    (%r8),%rbp
  mov    %r9,%rdx
  imul   %rbp,%rdx
  add    %rbx,%rdx
  movsd  (%r10,%rdx,8),%xmm0
  cmp    %r15,%r13
  jae    L194
  sub    $0x1,%rax
  mov    %r15,%rsi
  mov    %r13,%rdx
L216:
  mov    %r9,%rcx
  imul   (%rdi,%rdx,8),%rcx
  add    %rbx,%rcx
  movsd  (%r10,%rcx,8),%xmm1
  comisd %xmm0,%xmm1
  cmova  %rdx,%rsi
  maxsd  %xmm0,%xmm1
  movapd %xmm1,%xmm0
  add    $0x1,%rdx
  cmp    %rdx,%rax
  jne    L216
L27:
  lea    (%rdi,%rsi,8),%rax
  mov    (%rax),%rdx
  mov    %rbp,(%rax)
  mov    %rdx,(%r8)
  mov    %r15,%rax
  jmp    L119
L194:
  mov    %r15,%rsi
  jmp    L27
```

tool_calls: name: parse_data
arguments: tag: D0
type: f32[2]

tool: {"D0": [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;
}
```