user: Translate the below assembly code into C programming language:

```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     L74
  mov    0x130(%rsp),%eax
  add    $0x1,%eax
  and    $0xfffffffe,%eax
  sub    0x130(%rsp),%eax
  cmp    $0x1,%eax
  je     L96
L74:
  mov    0x130(%rsp),%edx
  lea    D2(%rip),%rsi
  mov    $0x4308,%edi
  call   <error_kernel_size@plt>
L96:
  mov    0x130(%rsp),%eax
  mov    0x130(%rsp),%ecx
  lea    0xb0(%rsp),%r13
  mov    0x130(%rsp),%esi
  mov    0x58(%rsp),%rdi
  lea    -0x1(%rax),%r10d
  mov    0x110(%rsp),%eax
  shr    %r10d
  lea    -0x1(%rax,%rcx,1),%eax
  mov    0x18(%rsp),%rcx
  mov    %r10d,%r15d
  mov    %eax,(%rcx)
  mov    0x118(%rsp),%eax
  lea    -0x1(%rax,%rsi,1),%eax
  mov    0x28(%rsp),%rsi
  mov    %eax,(%rsi)
  mov    0x130(%rsp),%eax
  lea    -0x1(%rbx,%rax,1),%eax
  imul   0x118(%rsp),%ebx
  mov    %eax,(%rdi)
  mov    %r13,%rdi
  mov    (%rcx),%ebp
  imul   (%rsi),%ebp
  mov    %ebx,%r14d
  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    L7
  mov    0x28(%rsp),%rcx
  mov    %r15d,0x4c(%rsp)
  mov    (%rcx),%edx
  mov    %r15d,%ecx
  neg    %ecx
  mov    %ecx,0x40(%rsp)
L150:
  mov    %edx,%ecx
  sub    %r15d,%ecx
  cmp    %ecx,%r15d
  jae    L130
  mov    0x4c(%rsp),%ecx
  mov    0x18(%rsp),%rax
  mov    %r15d,0x44(%rsp)
  mov    %r12,%r14
  sub    %r15d,%ecx
  mov    (%rax),%eax
  mov    %ecx,0x54(%rsp)
L104:
  mov    0x44(%rsp),%esi
  mov    %eax,%ecx
  mov    %r15d,0x10(%rsp)
  sub    %r15d,%ecx
  sub    %r15d,%esi
  mov    %esi,0x50(%rsp)
  cmp    %ecx,%r15d
  jb     L119
  jmp    L110
L42:
  mov    0x18(%rsp),%rax
  addl   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%esi
  mov    (%rax),%eax
  mov    %eax,%edx
  sub    %r15d,%edx
  cmp    %esi,%edx
  jbe    L139
L119:
  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     L61
  je     L42
L61:
  mov    0x40(%rsp),%eax
  mov    %eax,0x48(%rsp)
  nopl   0x0(%rax)
L159:
  mov    0x48(%rsp),%eax
  mov    0x4c(%rsp),%ecx
  lea    (%r15,%rax,1),%esi
  add    %eax,%ecx
  mov    0x40(%rsp),%eax
  mov    %esi,0x14(%rsp)
  mov    %ecx,0x38(%rsp)
  mov    %eax,0x3c(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L123:
  mov    0x3c(%rsp),%eax
  mov    0x44(%rsp),%ebx
  mov    0x40(%rsp),%r13d
  add    %eax,%ebx
  lea    (%r15,%rax,1),%ebp
  mov    %ebx,%r12d
  mov    %r15d,%ebx
  nopl   0x0(%rax)
L128:
  mov    0x130(%rsp),%ecx
  mov    0x14(%rsp),%edi
  lea    (%rbx,%r13,1),%edx
  mov    %ebp,%esi
  call   <gidz_cube@plt>
  mov    0x30(%rsp),%rdi
  mov    %r12d,%esi
  mov    (%r14),%r15
  cltq
  movsd  0x20(%rsp),%xmm0
  mulsd  (%rdi,%rax,8),%xmm0
  mov    0x10(%rsp),%eax
  mov    0x38(%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,%ebx
  jge    L128
  addl   $0x1,0x3c(%rsp)
  mov    0x3c(%rsp),%eax
  mov    %ebx,%r15d
  cmp    %eax,%ebx
  jge    L123
  addl   $0x1,0x48(%rsp)
  mov    0x48(%rsp),%eax
  cmp    %eax,%ebx
  jge    L159
  jmp    L42
L139:
  mov    0x28(%rsp),%rcx
  mov    (%rcx),%edx
L110:
  addl   $0x1,0x44(%rsp)
  mov    %edx,%ecx
  mov    0x44(%rsp),%esi
  sub    %r15d,%ecx
  cmp    %esi,%ecx
  ja     L104
  mov    0x58(%rsp),%rax
  mov    %r14,%r12
  mov    (%rax),%eax
L130:
  addl   $0x1,0x4c(%rsp)
  mov    %eax,%ecx
  mov    0x4c(%rsp),%esi
  sub    %r15d,%ecx
  cmp    %esi,%ecx
  ja     L150
L7:
  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    L136
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L136:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D2
data_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;
}
```