user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<reflect2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %esi,%eax
  mov    %edx,-0x4c(%rbp)
  mov    %ecx,-0x50(%rbp)
  mov    %r8d,-0x54(%rbp)
  mov    %r9,%rdx
  mov    %eax,%ecx
  imul   -0x4c(%rbp),%ecx
  mov    %ecx,-0x3c(%rbp)
  cmpl   $0x0,-0x50(%rbp)
  jle    L116
  lea    -0x1(%rax),%ecx
  jmp    L92
L116:
  mov    $0x0,%ecx
L92:
  mov    %ecx,%r15d
  cmpl   $0x0,-0x54(%rbp)
  jle    L269
  mov    -0x4c(%rbp),%ecx
  sub    $0x1,%ecx
  jmp    L381
L269:
  mov    $0x0,%ecx
L381:
  imul   %eax,%ecx
  mov    %ecx,%r10d
  cmpl   $0x0,-0x50(%rbp)
  jle    L262
  mov    -0x50(%rbp),%ecx
  sub    $0x1,%ecx
  jmp    L271
L262:
  mov    -0x50(%rbp),%ecx
  mov    $0xffffffff,%esi
  test   %ecx,%ecx
  cmovns %esi,%ecx
  add    $0x1,%ecx
L271:
  mov    %ecx,-0x38(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jle    L22
  mov    -0x54(%rbp),%ecx
  sub    $0x1,%ecx
  jmp    L45
L22:
  mov    -0x54(%rbp),%ecx
  mov    $0xffffffff,%esi
  test   %ecx,%ecx
  cmovns %esi,%ecx
  add    $0x1,%ecx
L45:
  imul   %eax,%ecx
  mov    %ecx,-0x34(%rbp)
  cmpl   $0x0,-0x50(%rbp)
  jns    L112
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %eax,%ecx
  sar    %ecx
  jmp    L242
L112:
  lea    -0x1(%rax),%ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  add    %esi,%ecx
  sar    %ecx
L242:
  mov    %ecx,-0x30(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jns    L275
  mov    -0x4c(%rbp),%ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  add    %esi,%ecx
  sar    %ecx
  jmp    L389
L275:
  mov    -0x4c(%rbp),%ecx
  sub    $0x1,%ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  add    %esi,%ecx
  sar    %ecx
L389:
  imul   %eax,%ecx
  mov    %ecx,-0x2c(%rbp)
  movl   $0x0,-0x40(%rbp)
  jmp    L115
L159:
  mov    -0x40(%rbp),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rcx)
  addl   $0x1,-0x40(%rbp)
L115:
  mov    -0x40(%rbp),%ecx
  cmp    -0x3c(%rbp),%ecx
  jl     L159
  cmpl   $0x0,0x10(%rbp)
  jne    L321
  mov    $0x0,%r14d
  mov    -0x34(%rbp),%ecx
  sub    %r10d,%ecx
  cmpl   $0x0,-0x54(%rbp)
  jle    L287
  mov    %eax,%esi
  jmp    L101
L287:
  mov    $0x0,%esi
L101:
  sub    %esi,%ecx
  mov    %ecx,%r12d
  jmp    L51
L224:
  test   %r12d,%r12d
  jne    L392
  add    %eax,%r12d
L392:
  mov    %r14d,%r13d
  mov    -0x38(%rbp),%ecx
  sub    %r15d,%ecx
  cmpl   $0x0,-0x50(%rbp)
  setg   %sil
  movzbl %sil,%esi
  mov    %ecx,%ebx
  sub    %esi,%ebx
  jmp    L134
L74:
  test   %ebx,%ebx
  jne    L3
  add    $0x1,%ebx
L3:
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %r10d,%ecx
  sub    %esi,%ecx
  add    %eax,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  mov    %ecx,%r8d
  mov    %r15d,%ecx
  sub    %r8d,%ecx
  cmp    $0xffffffff,%ecx
  jl     L229
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  mov    %ecx,%r8d
  mov    %r15d,%ecx
  sub    %r8d,%ecx
  add    $0x1,%ecx
  jmp    L114
L229:
  mov    %r15d,%r8d
  not    %r8d
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %r8d,%ecx
L114:
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm1
  movslq %r13d,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %r10d,%ecx
  sub    %esi,%ecx
  add    %eax,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  mov    %ecx,%r8d
  mov    %r15d,%ecx
  sub    %r8d,%ecx
  cmp    $0xffffffff,%ecx
  jl     L416
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  mov    %ecx,%r8d
  mov    %r15d,%ecx
  sub    %r8d,%ecx
  add    $0x1,%ecx
  jmp    L182
L416:
  mov    %r15d,%r8d
  not    %r8d
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %r8d,%ecx
L182:
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  add    $0x1,%r13d
  add    $0x1,%ebx
L134:
  lea    (%r14,%rax,1),%ecx
  cmp    %ecx,%r13d
  jl     L74
  add    %eax,%r14d
  add    %eax,%r12d
L51:
  cmp    -0x3c(%rbp),%r14d
  jl     L224
  jmp    L266
L321:
  mov    -0x34(%rbp),%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  mov    %ecx,-0x34(%rbp)
  mov    -0x38(%rbp),%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  mov    %ecx,-0x38(%rbp)
  mov    %r10d,%r14d
  mov    %r14d,%r12d
  sub    -0x34(%rbp),%r14d
  jmp    L15
L419:
  mov    %r15d,%ebx
  mov    %r15d,%r13d
  sub    -0x38(%rbp),%r13d
  jmp    L126
L48:
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm1
  mov    %r14d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r14d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L126:
  mov    %r15d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L48
  cmpl   $0x0,-0x50(%rbp)
  je     L31
  mov    %r15d,%ebx
  mov    -0x30(%rbp),%ecx
  add    %ecx,%ecx
  mov    %r15d,%esi
  sub    %ecx,%esi
  mov    -0x38(%rbp),%ecx
  add    %esi,%ecx
  lea    -0x1(%rcx),%r13d
  jmp    L27
L107:
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm1
  mov    %r14d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r14d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L27:
  mov    %r15d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L107
L31:
  sub    %eax,%r14d
  sub    %eax,%r12d
L15:
  mov    %r10d,%ebx
  mov    %ebx,%ecx
  sub    -0x3c(%rbp),%ecx
  cmp    %ecx,%r14d
  jg     L419
  cmpl   $0x0,-0x54(%rbp)
  je     L266
  mov    %ebx,%r12d
  mov    -0x2c(%rbp),%ecx
  add    %ecx,%ecx
  sub    %ecx,%ebx
  mov    %ebx,%esi
  mov    -0x34(%rbp),%ecx
  add    %esi,%ecx
  sub    %eax,%ecx
  mov    %ecx,%r14d
  jmp    L36
L133:
  mov    %r15d,%ebx
  mov    %r15d,%r13d
  sub    -0x38(%rbp),%r13d
  jmp    L105
L17:
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm1
  mov    %r14d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r14d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L105:
  mov    %r15d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L17
  cmpl   $0x0,-0x50(%rbp)
  je     L176
  mov    %r15d,%ebx
  mov    -0x30(%rbp),%ecx
  add    %ecx,%ecx
  mov    %r15d,%esi
  sub    %ecx,%esi
  mov    -0x38(%rbp),%ecx
  add    %esi,%ecx
  lea    -0x1(%rcx),%r13d
  jmp    L75
L72:
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm1
  mov    %r14d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r14d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  mov    %r12d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r12d,%esi
  mov    %ebx,%ecx
  neg    %ecx
  cmovs  %ebx,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L75:
  mov    %r15d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L72
L176:
  sub    %eax,%r14d
  sub    %eax,%r12d
L36:
  mov    %r10d,%ecx
  sub    -0x3c(%rbp),%ecx
  cmp    %ecx,%r14d
  jg     L133
L266:
  mov    $0x0,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int reflect2(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;
  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 i;
  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));
  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_base) - ((y_pos > 0) ? x_dim : 0); y_filt < filt_sz; y_filt += x_dim, y_res += x_dim) {
      if (y_res == 0)
        y_res += x_dim;
      for (x_filt = y_filt, x_res = (x_overhang - x_base) - ((x_pos > 0) ? 1 : 0); x_filt < y_filt + x_dim; x_filt++, x_res++) {
        if (x_res == 0)
          x_res++;
        result[(((y_base - (((y_res) >= 0) ? (y_res) : (-(y_res))) + x_dim) >= 0) ? (y_base - (((y_res) >= 0) ? (y_res) : (-(y_res))) + x_dim) : (-(y_base - (((y_res) >= 0) ? (y_res) : (-(y_res))) + x_dim))) + (((x_base - (((x_res) >= 0) ? (x_res) : (-(x_res))) + 1) >= 0) ? (x_base - (((x_res) >= 0) ? (x_res) : (-(x_res))) + 1) : (-(x_base - (((x_res) >= 0) ? (x_res) : (-(x_res))) + 1)))] += 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)
        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--)
          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 (y_pos != 0)
      for (y_res = y_base, y_filt = y_base - 2 * my_pos + y_overhang - x_dim; 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)
          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--)
            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)))];
      }
  }
  return (0);
}
```