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

```asm
<convolve_kernel_outside>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    0x100(%rsp),%rax
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x28(%rsp)
  mov    0x120(%rsp),%ebx
  mov    %rax,0x70(%rsp)
  mov    0x128(%rsp),%rax
  mov    %rcx,0x58(%rsp)
  mov    %rax,0x30(%rsp)
  mov    0x108(%rsp),%rax
  mov    %r8,0x60(%rsp)
  mov    %r9,0x68(%rsp)
  mov    %rax,0xa8(%rsp)
  movsd  %xmm0,0x78(%rsp)
  movsd  %xmm1,0x80(%rsp)
  movsd  %xmm2,0x88(%rsp)
  movsd  %xmm3,0x90(%rsp)
  movsd  %xmm4,0x98(%rsp)
  movsd  %xmm5,0xa0(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  mov    0x130(%rsp),%eax
  test   %eax,%eax
  je     L119
  mov    0x130(%rsp),%eax
  add    $0x1,%eax
  and    $0xfffffffe,%eax
  sub    0x130(%rsp),%eax
  cmp    $0x1,%eax
  je     L147
L119:
  mov    0x130(%rsp),%edx
  lea    D2(%rip),%rsi
  mov    $0x4308,%edi
  call   <error_kernel_size@plt>
L147:
  mov    0x130(%rsp),%eax
  mov    0x130(%rsp),%esi
  lea    0xb0(%rsp),%r13
  mov    0x130(%rsp),%ecx
  mov    0x58(%rsp),%rdi
  lea    -0x1(%rax),%r10d
  mov    0x110(%rsp),%eax
  shr    %r10d
  lea    -0x1(%rax,%rsi,1),%eax
  mov    0x18(%rsp),%rsi
  mov    %r10d,%r15d
  mov    %eax,(%rsi)
  mov    0x118(%rsp),%eax
  lea    -0x1(%rax,%rcx,1),%eax
  mov    0x28(%rsp),%rcx
  mov    %eax,(%rcx)
  mov    0x130(%rsp),%eax
  lea    -0x1(%rbx,%rax,1),%eax
  imul   0x118(%rsp),%ebx
  mov    %eax,(%rdi)
  mov    %r13,%rdi
  mov    (%rsi),%ebp
  imul   (%rcx),%ebp
  mov    %ebx,%r14d
  mov    %rcx,%rbx
  imul   0x110(%rsp),%r14d
  imul   %eax,%ebp
  mov    %r14,%rsi
  call   <do_vect@plt>
  mov    %r14,%rdx
  lea    0xa8(%rsp),%rsi
  mov    %r13,%rdi
  call   <cp_vect@plt>
  mov    (%r12),%rdi
  mov    %rbp,%rsi
  call   <zero_vect@plt>
  mov    0x58(%rsp),%rdi
  mov    (%rdi),%eax
  mov    %eax,%edx
  sub    %r15d,%edx
  cmp    %edx,%r15d
  jae    L108
  mov    (%rbx),%edx
  mov    %r15d,%ebx
  mov    %r15d,0x4c(%rsp)
  neg    %ebx
  mov    %ebx,0x40(%rsp)
L117:
  mov    %edx,%ecx
  sub    %r15d,%ecx
  cmp    %ecx,%r15d
  jae    L132
  mov    0x4c(%rsp),%ebx
  mov    0x18(%rsp),%rax
  mov    %r15d,0x44(%rsp)
  mov    %r12,%r14
  sub    %r15d,%ebx
  mov    (%rax),%eax
  mov    %ebx,0x54(%rsp)
L152:
  sub    %r15d,%eax
  cmp    %eax,%r15d
  jae    L136
  mov    0x44(%rsp),%eax
  mov    %r15d,0x10(%rsp)
  sub    %r15d,%eax
  mov    %eax,0x50(%rsp)
  jmp    L70
L4:
  mov    0x18(%rsp),%rax
  addl   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%ebx
  mov    (%rax),%eax
  mov    %eax,%edx
  sub    %r15d,%edx
  cmp    %ebx,%edx
  jbe    L26
L70:
  mov    0x10(%rsp),%edx
  mov    0x110(%rsp),%r8d
  mov    0x118(%rsp),%ecx
  mov    0x50(%rsp),%esi
  mov    0x54(%rsp),%edi
  sub    %r15d,%edx
  mov    0xb0(%rsp),%rbx
  call   <gidz_general@plt>
  pxor   %xmm7,%xmm7
  cltq
  movsd  (%rbx,%rax,8),%xmm6
  ucomisd %xmm7,%xmm6
  movsd  %xmm6,0x20(%rsp)
  jp     L47
  je     L4
L47:
  mov    0x40(%rsp),%eax
  mov    %eax,0x48(%rsp)
  xchg   %ax,%ax
L139:
  mov    0x48(%rsp),%eax
  lea    (%r15,%rax,1),%ebx
  mov    %ebx,0x38(%rsp)
  mov    0x4c(%rsp),%ebx
  add    %eax,%ebx
  mov    0x40(%rsp),%eax
  mov    %ebx,0x14(%rsp)
  mov    %eax,0x3c(%rsp)
  xchg   %ax,%ax
L128:
  mov    0x3c(%rsp),%eax
  mov    0x44(%rsp),%ebx
  mov    0x40(%rsp),%r13d
  lea    (%r15,%rax,1),%ebp
  add    %eax,%ebx
  mov    %ebp,%r12d
  mov    %r15d,%ebp
  nopl   0x0(%rax)
L148:
  mov    0x130(%rsp),%ecx
  mov    0x38(%rsp),%edi
  lea    0x0(%rbp,%r13,1),%edx
  mov    %r12d,%esi
  call   <gidz_cube@plt>
  mov    0x30(%rsp),%rdi
  mov    %ebx,%esi
  mov    (%r14),%r15
  cltq
  movsd  0x20(%rsp),%xmm0
  mulsd  (%rdi,%rax,8),%xmm0
  mov    0x10(%rsp),%eax
  mov    0x14(%rsp),%edi
  lea    (%rax,%r13,1),%edx
  mov    0x18(%rsp),%rax
  add    $0x1,%r13d
  mov    (%rax),%r8d
  mov    0x28(%rsp),%rax
  movsd  %xmm0,0x8(%rsp)
  mov    (%rax),%ecx
  call   <gidz_general@plt>
  movsd  0x8(%rsp),%xmm0
  mov    (%r14),%rdx
  cltq
  addsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  cmp    %r13d,%ebp
  jge    L148
  addl   $0x1,0x3c(%rsp)
  mov    0x3c(%rsp),%eax
  mov    %ebp,%r15d
  cmp    %eax,%ebp
  jge    L128
  addl   $0x1,0x48(%rsp)
  mov    0x48(%rsp),%eax
  cmp    %eax,%ebp
  jge    L139
  jmp    L4
L26:
  mov    0x28(%rsp),%rbx
  addl   $0x1,0x44(%rsp)
  mov    (%rbx),%edx
  mov    0x44(%rsp),%ebx
  mov    %edx,%ecx
  sub    %r15d,%ecx
  cmp    %ebx,%ecx
  ja     L152
L136:
  mov    0x58(%rsp),%rax
  mov    %r14,%r12
  mov    (%rax),%eax
L132:
  addl   $0x1,0x4c(%rsp)
  mov    %eax,%ecx
  mov    0x4c(%rsp),%ebx
  sub    %r15d,%ecx
  cmp    %ebx,%ecx
  ja     L117
L108:
  mov    0xb0(%rsp),%rdi
  call   <free@plt>
  pxor   %xmm0,%xmm0
  movsd  0x78(%rsp),%xmm1
  movsd  0x90(%rsp),%xmm2
  cvtsi2sd %r15d,%xmm0
  mov    0x60(%rsp),%rax
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  0x98(%rsp),%xmm2
  mulsd  %xmm0,%xmm2
  mulsd  0xa0(%rsp),%xmm0
  movsd  %xmm1,(%rax)
  movsd  0x80(%rsp),%xmm1
  mov    0x68(%rsp),%rax
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rax)
  mov    0x70(%rsp),%rax
  movsd  0x88(%rsp),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L49
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L49:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D2
type: string

tool: D2: lib_vwk

assistant: ```c
void convolve_kernel_outside(double **outmap, unsigned *out_extx, unsigned *out_exty, unsigned *out_extz, double *out_origx, double *out_origy, double *out_origz, double *inmap, unsigned in_extx, unsigned in_exty, unsigned in_extz, double in_origx, double in_origy, double in_origz, double widthx, double widthy, double widthz, double *kernel, unsigned kernel_size) {
  double dval;
  unsigned long out_nvox;
  unsigned long in_nvox;
  unsigned indx, indy, indz, tmp_extx, tmp_exty;
  int indx2, indy2, indz2, margin;
  double *tmpmap;
  char *program = "lib_vwk";
  if (kernel_size < 1 || 2 * ((kernel_size + 1) / 2) - kernel_size - 1 != 0) {
    error_kernel_size(17160, program, kernel_size);
  }
  margin = (kernel_size - 1) / 2;
  tmp_extx = in_extx;
  tmp_exty = in_exty;
  *out_extx = kernel_size - 1 + in_extx;
  *out_exty = kernel_size - 1 + in_exty;
  *out_extz = kernel_size - 1 + in_extz;
  in_nvox = in_extx * in_exty * in_extz;
  out_nvox = (*out_extx) * (*out_exty) * (*out_extz);
  do_vect(&tmpmap, in_nvox);
  cp_vect(&tmpmap, &inmap, in_nvox);
  zero_vect(*outmap, out_nvox);
  for (indz = margin; indz < (*out_extz) - margin; indz++)
    for (indy = margin; indy < (*out_exty) - margin; indy++)
      for (indx = margin; indx < (*out_extx) - margin; indx++) {
        dval = *(tmpmap + gidz_general(indz - margin, indy - margin, indx - margin, tmp_exty, tmp_extx));
        if (dval != 0.0)
          for (indz2 = -margin; indz2 <= margin; indz2++)
            for (indy2 = -margin; indy2 <= margin; indy2++)
              for (indx2 = -margin; indx2 <= margin; indx2++) {
                *(*outmap + gidz_general(indz + indz2, indy + indy2, indx + indx2, (*out_exty), (*out_extx))) += *(kernel + gidz_cube(indz2 + margin, indy2 + margin, indx2 + margin, kernel_size)) * dval;
              }
      }
  free(tmpmap);
  *out_origx = in_origx - widthx * margin;
  *out_origy = in_origy - widthy * margin;
  *out_origz = in_origz - widthz * margin;
}
```