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

```asm
<partition_double>:
  endbr64
  test   %edx,%edx
  push   %r15
  mov    %rsi,%r10
  mov    %rcx,%r11
  push   %r14
  mov    %edx,%esi
  mov    %r9,%rdx
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  jle    L185
  pxor   %xmm1,%xmm1
  xor    %eax,%eax
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L45:
  movsd  0x8(%rdx),%xmm0
  subsd  (%rdx),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  cmova  %eax,%ebx
  add    $0x1,%eax
  movapd %xmm0,%xmm1
  add    $0x10,%rdx
  cmp    %eax,%esi
  jne    L45
  lea    (%rbx,%rbx,1),%eax
  cltq
  lea    (%r9,%rax,8),%rdx
  lea    0x8(,%rax,8),%rax
L5:
  movsd  (%r9,%rax,1),%xmm1
  movsd  (%rdx),%xmm0
  mov    $0x1,%eax
  comisd %xmm1,%xmm0
  jae    L144
  add    %r11,%r8
  addsd  %xmm1,%xmm0
  movslq %esi,%rcx
  movslq %ebx,%r13
  lea    -0x1(%r8),%r12
  mulsd  D7(%rip),%xmm0
  mov    %r11,%rdx
  mov    %r12,%rsi
  cmp    %r12,%r11
  jbe    L105
  jmp    L26
  cs nopw 0x0(%rax,%rax,1)
L162:
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  jb     L135
L105:
  lea    (%r10,%rdx,8),%rbp
  mov    0x0(%rbp),%r9
  mov    %r9,%rax
  imul   %rcx,%rax
  add    %r13,%rax
  comisd (%rdi,%rax,8),%xmm0
  ja     L162
  lea    (%r10,%rsi,8),%r14
  mov    (%r14),%r15
  mov    %r15,%rax
  imul   %rcx,%rax
  add    %r13,%rax
  movsd  (%rdi,%rax,8),%xmm1
  comisd %xmm0,%xmm1
  jb     L25
  test   %rsi,%rsi
  je     L135
L195:
  sub    $0x1,%rsi
  cmp    %rdx,%rsi
  jae    L105
L135:
  cmp    %rdx,%r11
  je     L26
  cmp    %rdx,%r8
  je     L207
L82:
  sub    %r11,%rdx
L65:
  mov    0x38(%rsp),%rax
  mov    %ebx,(%rax)
  mov    0x40(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    0x48(%rsp),%rax
  mov    %rdx,(%rax)
  xor    %eax,%eax
L144:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L25:
  mov    %r15,0x0(%rbp)
  add    $0x1,%rdx
  mov    %r9,(%r14)
  jmp    L195
  nopl   (%rax)
L26:
  lea    (%r10,%r11,8),%rsi
  mov    (%rsi),%r8
  mov    %r8,%rax
  imul   %rcx,%rax
  add    %r13,%rax
  movsd  (%rdi,%rax,8),%xmm0
  lea    0x1(%r11),%rax
  cmp    %rax,%r12
  jb     L54
  nopl   0x0(%rax,%rax,1)
L3:
  mov    (%r10,%rax,8),%rdx
  imul   %rcx,%rdx
  add    %r13,%rdx
  movsd  (%rdi,%rdx,8),%xmm1
  comisd %xmm1,%xmm0
  minsd  %xmm0,%xmm1
  cmova  %rax,%r11
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %rax,%r12
  jae    L3
  lea    (%r10,%r11,8),%rax
  mov    (%rax),%rdx
L148:
  mov    %r8,(%rax)
  mov    %rdx,(%rsi)
  mov    $0x1,%edx
  jmp    L65
L207:
  lea    (%r10,%r12,8),%r8
  mov    (%r8),%r9
  mov    %r9,%rax
  imul   %rcx,%rax
  add    %r13,%rax
  movsd  (%rdi,%rax,8),%xmm0
  cmp    %r12,%r11
  jae    L215
  mov    %r12,%rsi
  mov    %r11,%rax
  nopl   0x0(%rax)
L59:
  mov    (%r10,%rax,8),%rdx
  imul   %rcx,%rdx
  add    %r13,%rdx
  movsd  (%rdi,%rdx,8),%xmm1
  comisd %xmm0,%xmm1
  maxsd  %xmm0,%xmm1
  cmova  %rax,%rsi
  add    $0x1,%rax
  movapd %xmm1,%xmm0
  cmp    %rax,%r12
  jne    L59
  lea    (%r10,%rsi,8),%rax
  mov    (%rax),%rdx
L216:
  mov    %r9,(%rax)
  mov    %rdx,(%r8)
  mov    %r12,%rdx
  jmp    L82
  cs nopw 0x0(%rax,%rax,1)
L185:
  mov    $0x8,%eax
  xor    %ebx,%ebx
  jmp    L5
L54:
  mov    %r8,%rdx
  mov    %rsi,%rax
  jmp    L148
L215:
  mov    %r9,%rdx
  mov    %r8,%rax
  jmp    L216
```

tool_calls: name: unpack_data
arguments: data_label: D7
type_infered: f32[2]

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