user: 请从给定的汇编指令推导出C源代码:

```asm
<box_partition>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edi,0xc(%rsp)
  mov    %rcx,%rbx
  mov    %r8,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    %esi,%eax
  sub    %edi,%eax
  cmp    $0x1,%eax
  je     L64
  mov    %esi,%r14d
  mov    %edx,%r12d
  movslq %edx,%rcx
  mov    0x4(%rbx,%rcx,8),%edx
  sub    (%rbx,%rcx,8),%edx
  mov    %eax,%r13d
  shr    $0x1f,%r13d
  add    %eax,%r13d
  sar    %r13d
  mov    %eax,%r15d
  sub    %r13d,%r15d
  pxor   %xmm0,%xmm0
  cvtsi2sd %r15d,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,0x1c(%rsp)
  sub    %eax,%edx
  mov    %edx,0x18(%rsp)
  lea    0x2(%r12),%eax
  movslq %eax,%rbp
  imul   $0x55555556,%rbp,%rbp
  shr    $0x20,%rbp
  cltd
  sub    %edx,%ebp
  lea    0x0(%rbp,%rbp,2),%edx
  sub    %edx,%eax
  mov    %eax,%ebp
  test   %r13d,%r13d
  jne    L25
L56:
  test   %r15d,%r15d
  jne    L20
L12:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L22
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L64:
  movslq %edi,%rax
  lea    (%rax,%rax,2),%rax
  lea    (%r8,%rax,8),%rax
  mov    (%rcx),%edx
  mov    %edx,(%rax)
  mov    0x4(%rcx),%edx
  mov    %edx,0x4(%rax)
  mov    0x8(%rcx),%edx
  mov    %edx,0x8(%rax)
  mov    0xc(%rcx),%edx
  mov    %edx,0xc(%rax)
  mov    0x10(%rcx),%edx
  mov    %edx,0x10(%rax)
  mov    0x14(%rcx),%edx
  mov    %edx,0x14(%rax)
  jmp    L12
L25:
  mov    (%rbx),%eax
  mov    %eax,0x20(%rsp)
  mov    0x4(%rbx),%eax
  mov    %eax,0x24(%rsp)
  mov    0x8(%rbx),%eax
  mov    %eax,0x28(%rsp)
  mov    0xc(%rbx),%eax
  mov    %eax,0x2c(%rsp)
  mov    0x10(%rbx),%eax
  mov    %eax,0x30(%rsp)
  mov    0x14(%rbx),%eax
  mov    %eax,0x34(%rsp)
  mov    0x18(%rsp),%edx
  add    0x20(%rsp,%rcx,8),%edx
  mov    %edx,0x24(%rsp,%rcx,8)
  lea    0x20(%rsp),%rcx
  mov    0xc(%rsp),%edi
  lea    (%rdi,%r13,1),%esi
  mov    0x10(%rsp),%r8
  mov    %ebp,%edx
  call   <box_partition>
  jmp    L56
L20:
  mov    (%rbx),%eax
  mov    %eax,0x20(%rsp)
  mov    0x4(%rbx),%eax
  mov    %eax,0x24(%rsp)
  mov    0x8(%rbx),%eax
  mov    %eax,0x28(%rsp)
  mov    0xc(%rbx),%eax
  mov    %eax,0x2c(%rsp)
  mov    0x10(%rbx),%eax
  mov    %eax,0x30(%rsp)
  mov    0x14(%rbx),%eax
  mov    %eax,0x34(%rsp)
  movslq %r12d,%r12
  mov    0x18(%rsp),%eax
  add    0x20(%rsp,%r12,8),%eax
  mov    %eax,0x20(%rsp,%r12,8)
  add    0x1c(%rsp),%eax
  mov    %eax,0x24(%rsp,%r12,8)
  lea    0x20(%rsp),%rcx
  mov    0xc(%rsp),%edi
  add    %r13d,%edi
  mov    0x10(%rsp),%r8
  mov    %ebp,%edx
  mov    %r14d,%esi
  call   <box_partition>
  jmp    L12
L22:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void box_partition(int ip, int up, int axis, const int box[3][2], int p_box[][3][2]) {
  const int np = up - ip;
  if (1 == np) {
    p_box[ip][0][0] = box[0][0];
    p_box[ip][0][1] = box[0][1];
    p_box[ip][1][0] = box[1][0];
    p_box[ip][1][1] = box[1][1];
    p_box[ip][2][0] = box[2][0];
    p_box[ip][2][1] = box[2][1];
  } else {
    const int n = box[axis][1] - box[axis][0];
    const int np_low = np / 2;
    const int np_upp = np - np_low;
    const int n_upp = (int)(((double)n) * (((double)np_upp) / ((double)np)));
    const int n_low = n - n_upp;
    const int next_axis = (axis + 2) % 3;
    if (np_low) {
      int dbox[3][2];
      dbox[0][0] = box[0][0];
      dbox[0][1] = box[0][1];
      dbox[1][0] = box[1][0];
      dbox[1][1] = box[1][1];
      dbox[2][0] = box[2][0];
      dbox[2][1] = box[2][1];
      dbox[axis][1] = dbox[axis][0] + n_low;
      box_partition(ip, ip + np_low, next_axis, (const int(*)[2])dbox, p_box);
    }
    if (np_upp) {
      int dbox[3][2];
      dbox[0][0] = box[0][0];
      dbox[0][1] = box[0][1];
      dbox[1][0] = box[1][0];
      dbox[1][1] = box[1][1];
      dbox[2][0] = box[2][0];
      dbox[2][1] = box[2][1];
      ip += np_low;
      dbox[axis][0] += n_low;
      dbox[axis][1] = dbox[axis][0] + n_upp;
      box_partition(ip, ip + np_upp, next_axis, (const int(*)[2])dbox, p_box);
    }
  }
}
```