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

```asm
<variance>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x38,%rsp
  mov    %r8d,0xc(%rsp)
  imul   %r9d,%r8d
  mov    0x70(%rsp),%r15d
  mov    %r9d,0x20(%rsp)
  movsd  %xmm1,0x28(%rsp)
  mov    %r8d,%r9d
  test   %r8d,%r8d
  jle    L48
  lea    0x4(%rdi),%rdx
  mov    %r12,%rax
  sub    %rdx,%rax
  cmp    $0x8,%rax
  jbe    L136
  lea    -0x1(%r8),%eax
  cmp    $0x2,%eax
  jbe    L136
  mov    %r8d,%edx
  xor    %eax,%eax
  shr    $0x2,%edx
  shl    $0x4,%rdx
L51:
  movdqu (%rbx,%rax,1),%xmm2
  movups %xmm2,(%r12,%rax,1)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L51
  mov    %r9d,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%r9b
  je     L48
  mov    %eax,%ecx
  mov    (%rbx,%rcx,4),%esi
  lea    0x0(,%rcx,4),%rdx
  mov    %esi,(%r12,%rcx,4)
  lea    0x1(%rax),%ecx
  cmp    %r9d,%ecx
  jge    L48
  mov    0x4(%rbx,%rdx,1),%ecx
  add    $0x2,%eax
  mov    %ecx,0x4(%r12,%rdx,1)
  cmp    %eax,%r9d
  jle    L48
  mov    0x8(%rbx,%rdx,1),%eax
  mov    %eax,0x8(%r12,%rdx,1)
L48:
  mov    $0xff,%edi
  movsd  %xmm0,0x10(%rsp)
  mov    %r9d,0x18(%rsp)
  call   <sumgaus1d@plt>
  mov    0x20(%rsp),%r8d
  mov    %r14,%rdx
  mov    %r13,%rsi
  movsd  0x10(%rsp),%xmm0
  mov    0xc(%rsp),%ecx
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <gaussian_blur@plt>
  test   %eax,%eax
  jne    L80
  mov    0x20(%rsp),%eax
  mov    0xc(%rsp),%esi
  movslq 0x18(%rsp),%r9
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  mov    %esi,%eax
  sar    %edx
  shr    $0x1f,%eax
  imul   %esi,%edx
  add    %esi,%eax
  sar    %eax
  add    %eax,%edx
  movslq %edx,%rdi
  mov    0x0(%r13,%rdi,4),%eax
  cltd
  idivl  (%rbx,%rdi,4)
  mov    %eax,%r8d
  test   %r9d,%r9d
  jle    L66
  imul   %ebp,%ebp
  mov    %r15d,%ecx
  lea    D6(%rip),%rdi
  sar    $0xa,%ebp
  add    $0x1,%ebp
  shl    %cl,%ebp
  mov    %ebp,%r15d
  shr    $0x1f,%r15d
  add    %ebp,%r15d
  xor    %ebp,%ebp
  sar    %r15d
  nopw   0x0(%rax,%rax,1)
L30:
  mov    (%rbx,%rbp,4),%eax
  imul   %r8d,%eax
  sub    0x0(%r13,%rbp,4),%eax
  cltd
  idiv   %r15d
  mov    %eax,%ecx
  test   %eax,%eax
  js     L77
  imul   %eax,%ecx
  mov    %ecx,(%r14,%rbp,4)
  add    $0x1,%rbp
  cmp    %r9,%rbp
  jne    L30
L66:
  movsd  0x28(%rsp),%xmm0
  mov    0xc(%rsp),%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    0x20(%rsp),%r8d
  add    $0x38,%rsp
  mov    %r14,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <gaussian_blur@plt>
  nopl   0x0(%rax)
L77:
  mov    %eax,%esi
  mov    %r8d,0x24(%rsp)
  mov    %r9,0x18(%rsp)
  mov    %eax,0x10(%rsp)
  call   <printf@plt>
  mov    0x10(%rsp),%ecx
  mov    0x18(%rsp),%r9
  lea    D6(%rip),%rdi
  mov    0x24(%rsp),%r8d
  imul   %ecx,%ecx
  mov    %ecx,(%r14,%rbp,4)
  add    $0x1,%rbp
  cmp    %r9,%rbp
  jne    L30
  jmp    L66
  nopl   0x0(%rax,%rax,1)
L80:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L136:
  mov    %r9d,%ecx
  xor    %eax,%eax
  nopl   (%rax)
L75:
  mov    (%rbx,%rax,4),%edx
  mov    %edx,(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L75
  jmp    L48
```

tool_calls: name: retrieve_data
arguments: data_label: D6
type_guessed: string

tool: D6: dif:%d


assistant: ```c
int variance(int16_t *in, int *out, int *tmp1, int *tmp2, int w, int h, double sd1, double sd2, int shift) {
  int i;
  int dif;
  int ndiv;
  int nmul;
  int err;
  int idx;
  for (i = 0; i < w * h; i++)
    tmp1[i] = in[i];
  ndiv = sumgaus1d(sd1, 255);
  ndiv *= ndiv;
  ndiv >>= 10;
  ndiv++;
  ndiv <<= shift;
  if ((err = gaussian_blur(tmp1, out, tmp2, w, h, sd1)))
    return err;
  idx = (h / 2) * w + (w / 2);
  nmul = out[idx] / in[idx];
  for (i = 0; i < w * h; i++) {
    dif = in[i];
    dif = (dif * nmul - out[i]) / (ndiv / 2);
    if (dif < 0)
      printf("dif:%d\n", dif);
    tmp2[i] = (dif * dif);
  }
  if ((err = gaussian_blur(tmp2, out, tmp1, w, h, sd2)))
    return err;
  return 0;
}
```