user: What would the C source look like for the assembly code provided here?

```asm
<Extend>:
  endbr64
  push   %r15
  mov    %edx,%eax
  mov    %rdi,%r15
  push   %r14
  mov    %esi,%r14d
  push   %r13
  imul   %edx,%r14d
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x48,%rsp
  mov    %ecx,0x10(%rsp)
  mov    0x80(%rsp),%r12d
  mov    %r8d,0x28(%rsp)
  test   %ecx,%ecx
  jle    L343
  mov    %ecx,%esi
  lea    -0x1(%rbx),%ecx
  xor    %edx,%edx
  mov    %ecx,0x30(%rsp)
  mov    %r14d,%ecx
  lea    -0x1(%rsi),%r13d
  sub    %ebx,%ecx
  test   %r8d,%r8d
  cmovg  %ecx,%edx
  mov    %edx,0xc(%rsp)
L315:
  mov    0x28(%rsp),%esi
  mov    $0xffffffff,%ebp
  mov    0x10(%rsp),%ecx
  test   %esi,%esi
  lea    -0x1(%rsi),%edx
  cmovs  %esi,%ebp
  add    $0x1,%ebp
  test   %esi,%esi
  cmovg  %edx,%ebp
  imul   %ebx,%ebp
  test   %ecx,%ecx
  js     L296
  lea    -0x1(%rbx),%ecx
  mov    %ecx,%edx
  shr    $0x1f,%edx
  add    %ecx,%edx
  sar    %edx
  mov    %edx,0x2c(%rsp)
L462:
  mov    0x28(%rsp),%edx
  test   %edx,%edx
  js     L469
  lea    -0x1(%rax),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  mov    %eax,0x38(%rsp)
  test   %r14d,%r14d
  jle    L283
L61:
  movslq %r14d,%rdx
  mov    %r9,%rdi
  xor    %esi,%esi
  shl    $0x3,%rdx
  call   <memset@plt>
  mov    %rax,%r9
  test   %r12d,%r12d
  jne    L404
  mov    0xc(%rsp),%esi
  mov    0x30(%rsp),%r10d
  mov    %r15,0x10(%rsp)
  xor    %r8d,%r8d
  mov    %r14d,0x18(%rsp)
  mov    %esi,%eax
  add    %r10d,%eax
  cltq
  lea    (%r9,%rax,8),%rdi
  movslq %ebx,%rax
  shl    $0x3,%rax
  mov    %rax,0x20(%rsp)
  mov    %ebp,%eax
  sub    %esi,%eax
  mov    %eax,0x1c(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L211:
  add    %ebx,%r12d
  test   %ebp,%ebp
  js     L436
  cmp    %ebp,0x18(%rsp)
  jle    L436
  cmp    %r12d,%r8d
  jge    L425
  lea    (%r10,%rbp,1),%eax
  mov    %r12d,%r14d
  mov    %r13d,%esi
  mov    0x10(%rsp),%rcx
  cltq
  sub    %r8d,%r14d
  sub    %r10d,%esi
  lea    (%r9,%rax,8),%r15
  add    %r13d,%r14d
  mov    %r13d,%eax
  jmp    L555
  nopl   0x0(%rax)
L55:
  lea    (%rax,%rbp,1),%edx
  add    $0x1,%eax
  add    $0x8,%rcx
  add    $0x1,%esi
  movslq %edx,%rdx
  lea    (%r9,%rdx,8),%rdx
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%rdx)
  cmp    %r14d,%eax
  je     L425
L555:
  movsd  (%rcx),%xmm0
  test   %eax,%eax
  js     L434
  cmp    %eax,%ebx
  jg     L55
L434:
  mov    %esi,%edx
  mov    %r10d,%r11d
  neg    %edx
  cmovs  %esi,%edx
  sub    %edx,%r11d
  mov    %r11d,%edx
  neg    %edx
  cmovs  %r11d,%edx
  add    $0x1,%eax
  add    $0x8,%rcx
  add    $0x1,%esi
  add    %ebp,%edx
  movslq %edx,%rdx
  lea    (%r9,%rdx,8),%rdx
  movsd  (%rdx),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdx)
  movsd  -0x8(%rcx),%xmm0
  addsd  %xmm0,%xmm0
  addsd  (%r15),%xmm0
  movsd  %xmm0,(%r15)
  cmp    %r14d,%eax
  jne    L555
L425:
  mov    0x20(%rsp),%rsi
  add    %ebx,0x1c(%rsp)
  add    %ebx,%ebp
  add    %ebx,%r8d
  add    %rsi,0x10(%rsp)
  cmp    %r12d,0x18(%rsp)
  jg     L211
L262:
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L404:
  mov    %ebp,%eax
  mov    0xc(%rsp),%esi
  mov    %r13d,%ecx
  neg    %eax
  cmovns %eax,%ebp
  neg    %ecx
  mov    %esi,%r10d
  cmovs  %r13d,%ecx
  sub    %r14d,%esi
  mov    %ebp,0x1c(%rsp)
  sub    %ebp,%r10d
  mov    %esi,0x18(%rsp)
  cmp    %ebp,%r14d
  jle    L502
  mov    0x30(%rsp),%edi
  lea    (%rcx,%rcx,1),%edx
  lea    (%rdi,%rcx,1),%eax
  mov    %eax,%esi
  mov    %eax,%r11d
  sub    %edx,%esi
  sub    %eax,%edx
  sub    $0x1,%esi
  lea    0x1(%rdi,%rdx,1),%r14d
  mov    %esi,0x3c(%rsp)
  mov    0x2c(%rsp),%esi
  lea    (%rsi,%rsi,1),%ebp
  mov    %edi,%esi
  sub    %ecx,%esi
  sub    %ebp,%r11d
  sub    %eax,%ebp
  mov    %esi,0x20(%rsp)
  mov    %edi,%esi
  sub    %ebx,%esi
  mov    %r11d,0x34(%rsp)
  sub    %edi,%r11d
  lea    (%rsi,%rdi,1),%eax
  mov    %r11d,%r12d
  add    %eax,%ebp
  cs nopw 0x0(%rax,%rax,1)
L350:
  mov    0x1c(%rsp),%eax
  mov    %r10d,%r8d
  mov    0x20(%rsp),%edx
  lea    (%r10,%rax,1),%r13d
  mov    %r13d,%r11d
  neg    %r11d
  cmovs  %r13d,%r11d
  neg    %r8d
  cmovs  %r10d,%r8d
  cmp    %ecx,%ebx
  jle    L346
  nopl   0x0(%rax)
L85:
  lea    (%rdx,%rcx,1),%edi
  mov    %edi,%eax
  neg    %eax
  cmovs  %edi,%eax
  add    %r11d,%eax
  cltq
  lea    (%r9,%rax,8),%rdi
  mov    %edx,%eax
  neg    %eax
  movsd  (%rdi),%xmm0
  cmovs  %edx,%eax
  sub    $0x1,%edx
  add    %r8d,%eax
  cltq
  addsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%rdi)
  cmp    %esi,%edx
  jg     L85
L346:
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  je     L52
  cmp    %ecx,0x2c(%rsp)
  je     L302
  cmp    %esi,0x34(%rsp)
  jle    L52
  mov    %r13d,%eax
  mov    %r10d,%r11d
  mov    0x30(%rsp),%edx
  neg    %eax
  cmovns %eax,%r13d
  neg    %r11d
  cmovs  %r10d,%r11d
  nopl   0x0(%rax,%rax,1)
L530:
  mov    %edx,%eax
  lea    (%r12,%rdx,1),%r8d
  neg    %eax
  cmovs  %edx,%eax
  add    %r13d,%eax
  cltq
  lea    (%r9,%rax,8),%rdi
  mov    %r8d,%eax
  neg    %eax
  movsd  (%rdi),%xmm0
  cmovs  %r8d,%eax
  sub    $0x1,%edx
  add    %r11d,%eax
  cltq
  subsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%rdi)
  cmp    %ebp,%edx
  jne    L530
L52:
  sub    %ebx,%r10d
  cmp    0x18(%rsp),%r10d
  jg     L350
L502:
  mov    0x28(%rsp),%eax
  test   %eax,%eax
  je     L262
  mov    0x38(%rsp),%eax
  mov    0xc(%rsp),%ebp
  mov    0x1c(%rsp),%esi
  imul   %ebx,%eax
  mov    %ebp,%edi
  lea    (%rax,%rax,1),%edx
  sub    %edx,%edi
  add    %esi,%edi
  cmp    %esi,%eax
  je     L255
  cmp    %edi,0x18(%rsp)
  jge    L262
  mov    0x30(%rsp),%r10d
  mov    0x2c(%rsp),%esi
  mov    0x10(%rsp),%r11d
  lea    (%rcx,%r10,1),%edx
  lea    (%rsi,%rsi,1),%eax
  mov    %edx,%r12d
  sub    %eax,%r12d
  cmp    %ecx,%esi
  setne  %r8b
  test   %r11d,%r11d
  mov    %r12d,0x1c(%rsp)
  setne  %sil
  mov    %r8d,%r14d
  sub    %edi,%ebp
  sub    %edx,%eax
  and    %esi,%r14d
  mov    %r10d,%esi
  sub    %ecx,%r10d
  mov    %ebp,0x10(%rsp)
  mov    %r10d,0xc(%rsp)
  mov    %esi,%r10d
  sub    %esi,%r12d
  sub    %ebx,%r10d
  mov    %r10d,%r11d
  mov    %edi,%r10d
  lea    (%r11,%rsi,1),%edx
  lea    (%rax,%rdx,1),%r13d
  nopl   0x0(%rax,%rax,1)
L445:
  mov    0x10(%rsp),%eax
  mov    %r10d,%edi
  mov    0xc(%rsp),%edx
  lea    (%rax,%r10,1),%ebp
  mov    %ebp,%r8d
  neg    %r8d
  cmovs  %ebp,%r8d
  neg    %edi
  cmovs  %r10d,%edi
  cmp    %ecx,%ebx
  jle    L588
  nopl   0x0(%rax,%rax,1)
L371:
  lea    (%rdx,%rcx,1),%esi
  mov    %esi,%eax
  neg    %eax
  cmovs  %esi,%eax
  add    %r8d,%eax
  cltq
  lea    (%r9,%rax,8),%rsi
  mov    %edx,%eax
  neg    %eax
  movsd  (%rsi),%xmm0
  cmovs  %edx,%eax
  sub    $0x1,%edx
  add    %edi,%eax
  cltq
  subsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%rsi)
  cmp    %r11d,%edx
  jg     L371
L588:
  test   %r14b,%r14b
  jne    L433
L497:
  sub    %ebx,%r10d
  cmp    0x18(%rsp),%r10d
  jg     L445
  jmp    L262
  nopl   0x0(%rax)
L436:
  cmp    %r12d,%r8d
  jge    L425
  mov    0x1c(%rsp),%ecx
  mov    %r12d,%r15d
  mov    %r13d,%esi
  mov    0x10(%rsp),%rdx
  sub    %r8d,%r15d
  sub    %r10d,%esi
  mov    %r13d,%eax
  mov    %ecx,%r11d
  add    %r13d,%r15d
  neg    %r11d
  cmovs  %ecx,%r11d
  mov    0xc(%rsp),%ecx
  sub    %r11d,%ecx
  mov    %ecx,%r14d
  neg    %r14d
  cmovs  %ecx,%r14d
  jmp    L515
  nopl   0x0(%rax)
L129:
  lea    (%rax,%r14,1),%ecx
  movslq %ecx,%rcx
  lea    (%r9,%rcx,8),%rcx
  movsd  (%rcx),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  mov    0xc(%rsp),%ecx
  movsd  (%rdx),%xmm0
  add    %eax,%ecx
  addsd  %xmm0,%xmm0
  movslq %ecx,%rcx
  lea    (%r9,%rcx,8),%rcx
  addsd  (%rcx),%xmm0
  movsd  %xmm0,(%rcx)
L314:
  add    $0x1,%eax
  add    $0x8,%rdx
  add    $0x1,%esi
  cmp    %r15d,%eax
  je     L425
L515:
  movsd  (%rdx),%xmm1
  test   %eax,%eax
  js     L48
  cmp    %eax,%ebx
  jg     L129
L48:
  mov    %esi,%ecx
  mov    %r10d,%r11d
  neg    %ecx
  cmovs  %esi,%ecx
  sub    %ecx,%r11d
  mov    %r11d,%ecx
  neg    %ecx
  cmovs  %r11d,%ecx
  add    %r14d,%ecx
  movslq %ecx,%rcx
  lea    (%r9,%rcx,8),%rcx
  movsd  (%rcx),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  movsd  (%rdx),%xmm0
  addsd  %xmm0,%xmm0
  addsd  (%rdi),%xmm0
  movsd  %xmm0,(%rdi)
  jmp    L314
L302:
  mov    0x3c(%rsp),%r11d
  cmp    %esi,%r11d
  jle    L52
  mov    %r13d,%eax
  mov    %r10d,%r8d
  neg    %eax
  cmovns %eax,%r13d
  neg    %r8d
  cmovs  %r10d,%r8d
  nopw   0x0(%rax,%rax,1)
L516:
  lea    (%r14,%r11,1),%edx
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  mov    %r11d,%edx
  add    %r13d,%eax
  cltq
  lea    (%r9,%rax,8),%rdi
  movsd  (%rdi),%xmm1
  nopl   0x0(%rax,%rax,1)
L111:
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  sub    $0x1,%edx
  add    %r8d,%eax
  cltq
  movsd  (%r15,%rax,8),%xmm0
  addsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  cmp    %esi,%edx
  jg     L111
  sub    $0x1,%r11d
  cmp    %esi,%r11d
  jg     L516
  sub    %ebx,%r10d
  cmp    0x18(%rsp),%r10d
  jg     L350
  jmp    L502
L469:
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,0x38(%rsp)
  test   %r14d,%r14d
  jg     L61
L283:
  test   %r12d,%r12d
  je     L262
  mov    %ebp,%eax
  mov    %r13d,%ecx
  neg    %eax
  cmovns %eax,%ebp
  mov    0xc(%rsp),%eax
  neg    %ecx
  cmovs  %r13d,%ecx
  sub    %r14d,%eax
  mov    %ebp,0x1c(%rsp)
  mov    %eax,0x18(%rsp)
  jmp    L502
L296:
  mov    %ebx,%edx
  shr    $0x1f,%edx
  add    %ebx,%edx
  sar    %edx
  mov    %edx,0x2c(%rsp)
  jmp    L462
L343:
  mov    %r14d,%ecx
  xor    %edx,%edx
  mov    $0xffffffff,%r13d
  movl   $0x0,0x30(%rsp)
  sub    %esi,%ecx
  mov    0x28(%rsp),%esi
  test   %esi,%esi
  mov    0x10(%rsp),%esi
  cmovg  %ecx,%edx
  test   %esi,%esi
  cmovs  %esi,%r13d
  mov    %edx,0xc(%rsp)
  add    $0x1,%r13d
  jmp    L315
L255:
  mov    0x18(%rsp),%r10d
  sub    %ebx,%edi
  cmp    %r10d,%edi
  jle    L262
  mov    0x30(%rsp),%r14d
  mov    0x2c(%rsp),%r11d
  mov    0x10(%rsp),%r8d
  mov    %edi,0x10(%rsp)
  lea    (%r14,%rcx,1),%edx
  lea    (%r11,%r11,1),%eax
  mov    %edx,%esi
  sub    %eax,%esi
  sub    $0x1,%esi
  test   %r8d,%r8d
  setne  %bpl
  cmp    %ecx,%r11d
  mov    0xc(%rsp),%r11d
  mov    %esi,0x18(%rsp)
  sete   %sil
  sub    %edx,%eax
  sub    %edi,%r11d
  and    %esi,%ebp
  mov    %r14d,%esi
  sub    %ecx,%r14d
  mov    %r11d,0x1c(%rsp)
  mov    %r14d,%r12d
  mov    %esi,%r14d
  sub    %ebx,%esi
  mov    %r12d,0xc(%rsp)
  lea    0x1(%r14,%rax,1),%r14d
  mov    %r10d,%r12d
L116:
  mov    0x1c(%rsp),%eax
  mov    0x10(%rsp),%r13d
  add    %r13d,%eax
  mov    %eax,%r11d
  neg    %r11d
  cmovs  %eax,%r11d
  nopl   0x0(%rax)
L394:
  mov    %r13d,%r8d
  mov    0xc(%rsp),%edx
  neg    %r8d
  cmovs  %r13d,%r8d
  cmp    %ecx,%ebx
  jle    L464
  nopw   0x0(%rax,%rax,1)
L289:
  lea    (%rdx,%rcx,1),%edi
  mov    %edi,%eax
  neg    %eax
  cmovs  %edi,%eax
  add    %r11d,%eax
  cltq
  lea    (%r9,%rax,8),%rdi
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  sub    $0x1,%edx
  add    %r8d,%eax
  cltq
  movsd  (%r15,%rax,8),%xmm0
  addsd  %xmm0,%xmm0
  addsd  (%rdi),%xmm0
  movsd  %xmm0,(%rdi)
  cmp    %esi,%edx
  jg     L289
L464:
  test   %bpl,%bpl
  jne    L122
L152:
  sub    %ebx,%r13d
  cmp    %r12d,%r13d
  jg     L394
  sub    %ebx,0x10(%rsp)
  mov    0x10(%rsp),%eax
  cmp    %r12d,%eax
  jg     L116
  jmp    L262
  nopl   0x0(%rax,%rax,1)
L122:
  mov    0x18(%rsp),%r10d
  cmp    %esi,%r10d
  jle    L152
  mov    %r13d,%r8d
  neg    %r8d
  cmovs  %r13d,%r8d
  nopl   0x0(%rax)
L199:
  lea    (%r14,%r10,1),%edx
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  mov    %r10d,%edx
  add    %r11d,%eax
  cltq
  lea    (%r9,%rax,8),%rdi
  movsd  (%rdi),%xmm1
  nopl   0x0(%rax,%rax,1)
L575:
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  sub    $0x1,%edx
  add    %r8d,%eax
  cltq
  movsd  (%r15,%rax,8),%xmm0
  addsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdi)
  cmp    %esi,%edx
  jg     L575
  sub    $0x1,%r10d
  cmp    %esi,%r10d
  jg     L199
  jmp    L152
L433:
  cmp    %r11d,0x1c(%rsp)
  jle    L497
  mov    %ebp,%eax
  mov    %r10d,%r8d
  mov    0x30(%rsp),%edx
  neg    %eax
  cmovns %eax,%ebp
  neg    %r8d
  cmovs  %r10d,%r8d
  nopl   0x0(%rax,%rax,1)
L31:
  mov    %edx,%eax
  lea    (%r12,%rdx,1),%edi
  neg    %eax
  cmovs  %edx,%eax
  add    %ebp,%eax
  cltq
  lea    (%r9,%rax,8),%rsi
  mov    %edi,%eax
  neg    %eax
  movsd  (%rsi),%xmm0
  cmovs  %edi,%eax
  sub    $0x1,%edx
  add    %r8d,%eax
  cltq
  subsd  (%r15,%rax,8),%xmm0
  movsd  %xmm0,(%rsi)
  cmp    %r13d,%edx
  jne    L31
  jmp    L497
```

assistant: ```c
int Extend(filt, x_dim, y_dim, x_pos, y_pos, result, r_or_e)
register double *filt, *result;
register int x_dim;
int y_dim, x_pos, y_pos, r_or_e;
{
  int filt_sz = x_dim * y_dim;
  register int y_filt, x_filt, y_res, x_res, y_tmp, x_tmp;
  register int x_base = (x_pos > 0) ? (x_dim - 1) : 0;
  register int y_base = x_dim * ((y_pos > 0) ? (y_dim - 1) : 0);
  int x_overhang = (x_pos > 0) ? (x_pos - 1) : ((x_pos < 0) ? (x_pos + 1) : 0);
  int y_overhang = x_dim * ((y_pos > 0) ? (y_pos - 1) : ((y_pos < 0) ? (y_pos + 1) : 0));
  int mx_pos = (x_pos < 0) ? (x_dim / 2) : ((x_dim - 1) / 2);
  int my_pos = x_dim * ((y_pos < 0) ? (y_dim / 2) : ((y_dim - 1) / 2));
  int i;
  for (i = 0; i < filt_sz; i++)
    result[i] = 0.0;
  if (r_or_e == 0)
    for (y_filt = 0, y_res = y_overhang; y_filt < filt_sz; y_filt += x_dim, y_res += x_dim)
      if ((y_res >= 0) && (y_res < filt_sz))
        for (x_filt = y_filt, x_res = x_overhang; x_filt < y_filt + x_dim; x_filt++, x_res++)
          if ((x_res >= 0) && (x_res < x_dim))
            result[y_res + x_res] += filt[x_filt];
          else {
            result[y_res + (((x_base - (((x_res - x_base) >= 0) ? (x_res - x_base) : (-(x_res - x_base)))) >= 0) ? (x_base - (((x_res - x_base) >= 0) ? (x_res - x_base) : (-(x_res - x_base)))) : (-(x_base - (((x_res - x_base) >= 0) ? (x_res - x_base) : (-(x_res - x_base))))))] -= filt[x_filt];
            result[y_res + x_base] += 2 * filt[x_filt];
          }
      else
        for (x_filt = y_filt, x_res = x_overhang; x_filt < y_filt + x_dim; x_filt++, x_res++)
          if ((x_res >= 0) && (x_res < x_dim)) {
            result[(((y_base - (((y_res - y_base) >= 0) ? (y_res - y_base) : (-(y_res - y_base)))) >= 0) ? (y_base - (((y_res - y_base) >= 0) ? (y_res - y_base) : (-(y_res - y_base)))) : (-(y_base - (((y_res - y_base) >= 0) ? (y_res - y_base) : (-(y_res - y_base)))))) + x_res] -= filt[x_filt];
            result[y_base + x_res] += 2 * filt[x_filt];
          } else {
            result[(((y_base - (((y_res - y_base) >= 0) ? (y_res - y_base) : (-(y_res - y_base)))) >= 0) ? (y_base - (((y_res - y_base) >= 0) ? (y_res - y_base) : (-(y_res - y_base)))) : (-(y_base - (((y_res - y_base) >= 0) ? (y_res - y_base) : (-(y_res - y_base)))))) + (((x_base - (((x_res - x_base) >= 0) ? (x_res - x_base) : (-(x_res - x_base)))) >= 0) ? (x_base - (((x_res - x_base) >= 0) ? (x_res - x_base) : (-(x_res - x_base)))) : (-(x_base - (((x_res - x_base) >= 0) ? (x_res - x_base) : (-(x_res - x_base))))))] -= filt[x_filt];
            result[y_base + x_base] += 2 * filt[x_filt];
          }
  else {
    y_overhang = (((y_overhang) >= 0) ? (y_overhang) : (-(y_overhang)));
    x_overhang = (((x_overhang) >= 0) ? (x_overhang) : (-(x_overhang)));
    for (y_res = y_base, y_filt = y_base - y_overhang; y_filt > y_base - filt_sz; y_filt -= x_dim, y_res -= x_dim) {
      for (x_res = x_base, x_filt = x_base - x_overhang; x_filt > x_base - x_dim; x_res--, x_filt--)
        result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] += filt[(((y_filt) >= 0) ? (y_filt) : (-(y_filt))) + (((x_filt) >= 0) ? (x_filt) : (-(x_filt)))];
      if (x_pos != 0)
        if (x_overhang != mx_pos)
          for (x_res = x_base, x_filt = x_base - 2 * mx_pos + x_overhang; x_filt > x_base - x_dim; x_res--, x_filt--)
            result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] -= filt[(((y_filt) >= 0) ? (y_filt) : (-(y_filt))) + (((x_filt) >= 0) ? (x_filt) : (-(x_filt)))];
        else
          for (x_res = x_base, x_filt = x_base - 2 * mx_pos + x_overhang - 1; x_filt > x_base - x_dim; x_res--, x_filt--)
            for (x_tmp = x_filt; x_tmp > x_base - x_dim; x_tmp--)
              result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] += 2 * filt[(((y_filt) >= 0) ? (y_filt) : (-(y_filt))) + (((x_tmp) >= 0) ? (x_tmp) : (-(x_tmp)))];
    }
    if (y_pos != 0)
      if (y_overhang != my_pos)
        for (y_res = y_base, y_filt = y_base - 2 * my_pos + y_overhang; y_filt > y_base - filt_sz; y_filt -= x_dim, y_res -= x_dim) {
          for (x_res = x_base, x_filt = x_base - x_overhang; x_filt > x_base - x_dim; x_res--, x_filt--)
            result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] -= filt[(((y_filt) >= 0) ? (y_filt) : (-(y_filt))) + (((x_filt) >= 0) ? (x_filt) : (-(x_filt)))];
          if ((x_pos != 0) && (x_overhang != mx_pos))
            for (x_res = x_base, x_filt = x_base - 2 * mx_pos + x_overhang; x_filt > x_base - x_dim; x_res--, x_filt--)
              result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] -= filt[(((y_filt) >= 0) ? (y_filt) : (-(y_filt))) + (((x_filt) >= 0) ? (x_filt) : (-(x_filt)))];
        }
      else
        for (y_res = y_base, y_filt = y_base - 2 * my_pos + y_overhang - x_dim; y_filt > y_base - filt_sz; y_res -= x_dim, y_filt -= x_dim)
          for (y_tmp = y_filt; y_tmp > y_base - filt_sz; y_tmp -= x_dim) {
            for (x_res = x_base, x_filt = x_base - x_overhang; x_filt > x_base - x_dim; x_res--, x_filt--)
              result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] += 2 * filt[(((y_tmp) >= 0) ? (y_tmp) : (-(y_tmp))) + (((x_filt) >= 0) ? (x_filt) : (-(x_filt)))];
            if ((x_pos != 0) && (x_overhang == mx_pos))
              for (x_res = x_base, x_filt = x_base - 2 * mx_pos + x_overhang - 1; x_filt > x_base - x_dim; x_res--, x_filt--)
                for (x_tmp = x_filt; x_tmp > x_base - x_dim; x_tmp--)
                  result[(((y_res) >= 0) ? (y_res) : (-(y_res))) + (((x_res) >= 0) ? (x_res) : (-(x_res)))] += 2 * filt[(((y_tmp) >= 0) ? (y_tmp) : (-(y_tmp))) + (((x_tmp) >= 0) ? (x_tmp) : (-(x_tmp)))];
          }
  }
  return (0);
}
```