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

```asm
<reflect2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebp
  mov    %edx,%eax
  test   %ecx,%ecx
  jle    L61
  lea    -0x1(%rsi),%r11d
  test   %r8d,%r8d
  jle    L109
  lea    -0x1(%rdx),%edx
  imul   %esi,%edx
  mov    %edx,-0xc(%rsp)
  lea    (%rsi,%rdx,1),%r15d
L23:
  sub    %ebp,%ecx
  lea    -0x1(%rcx),%ebx
  mov    %ebx,-0x10(%rsp)
L44:
  mov    %r8d,%edx
  sub    %eax,%edx
  lea    -0x1(%rdx),%eax
  lea    0x1(%r8),%ebx
  test   %r8d,%r8d
  cmovg  %eax,%ebx
  imul   %ebp,%ebx
  test   %r15d,%r15d
  jle    L88
  mov    %r9,%rax
  lea    -0x1(%r15),%edx
  lea    0x4(%r9,%rdx,4),%rdx
L126:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L126
  movslq %ebp,%rax
  shl    $0x2,%rax
  mov    %rax,-0x20(%rsp)
  lea    -0x1(%rbp),%eax
  lea    0x4(%rdi,%rax,4),%r8
  mov    $0x0,%r14d
  not    %rax
  shl    $0x2,%rax
  mov    %rax,-0x8(%rsp)
  mov    $0x1,%r13d
  mov    %r11d,%r12d
  not    %r12d
  mov    %r15d,-0x14(%rsp)
  jmp    L53
L66:
  test   %edx,%edx
  cmove  %r13d,%edx
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  mov    %r11d,%esi
  sub    %eax,%esi
  lea    0x1(%rsi),%edi
  add    %r12d,%eax
  cmp    $0xffffffff,%esi
  cmovge %edi,%eax
  add    %r10d,%eax
  cltq
  lea    (%r9,%rax,4),%rax
  movss  (%rax),%xmm0
  addss  (%rcx),%xmm0
  movss  %xmm0,(%rax)
  add    $0x1,%edx
  add    $0x4,%rcx
  cmp    %r8,%rcx
  jne    L66
L107:
  add    %ebp,%ebx
  add    -0x20(%rsp),%r8
  cmp    %r15d,-0x14(%rsp)
  jle    L88
L53:
  mov    %r14d,%eax
  test   %ebx,%ebx
  cmove  %ebp,%ebx
  add    %ebp,%r14d
  mov    %r14d,%r15d
  cmp    %r14d,%eax
  jge    L107
  mov    -0x8(%rsp),%rax
  lea    (%rax,%r8,1),%rcx
  mov    -0x10(%rsp),%edx
  mov    %ebx,%esi
  neg    %esi
  cmovs  %ebx,%esi
  mov    -0xc(%rsp),%eax
  sub    %esi,%eax
  add    %ebp,%eax
  mov    %eax,%r10d
  neg    %r10d
  cmovs  %eax,%r10d
  jmp    L66
L109:
  mov    %esi,%r15d
  imul   %edx,%r15d
  movl   $0x0,-0xc(%rsp)
  jmp    L23
L63:
  mov    %ebp,%r15d
  imul   %eax,%r15d
  movl   $0x0,-0xc(%rsp)
  jmp    L95
L61:
  test   %r8d,%r8d
  jle    L63
  lea    -0x1(%rdx),%edx
  imul   %esi,%edx
  mov    %edx,-0xc(%rsp)
  lea    (%rdx,%rsi,1),%r15d
L95:
  lea    0x1(%rcx),%ebx
  mov    %ebx,-0x10(%rsp)
  mov    $0x0,%r11d
  jmp    L44
L88:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void reflect2(filt, x_dim, y_dim, x_pos, y_pos, result, f_or_e) register float *filt, *result;
register int x_dim;
int y_dim, x_pos, y_pos, f_or_e;
{
  register int y_filt, x_filt, y_edge, x_edge;
  register int x_base = (x_pos > 0) ? (x_dim - 1) : 0;
  register int y_base = (y_pos > 0) ? (x_dim * (y_dim - 1)) : 0;
  int filt_sz = x_dim * y_dim;
  int x_edge_dist = (x_pos > 0) ? (x_pos - x_dim - 1) : (x_pos + 1);
  int y_edge_dist = x_dim * ((y_pos > 0) ? (y_pos - y_dim - 1) : (y_pos + 1));
  int i;
  for (i = 0; i < filt_sz; i++)
    result[i] = 0.0;
  for (y_filt = 0, y_edge = y_edge_dist; y_filt < filt_sz; y_filt += x_dim, y_edge += x_dim) {
    if (y_edge == 0)
      y_edge += x_dim;
    for (x_filt = y_filt, x_edge = x_edge_dist; x_filt < y_filt + x_dim; x_filt++, x_edge++) {
      if (x_edge == 0)
        x_edge++;
      result[(y_base - (y_edge >= 0 ? y_edge : -(y_edge)) + x_dim >= 0 ? y_base - (y_edge >= 0 ? y_edge : -(y_edge)) + x_dim : -(y_base - (y_edge >= 0 ? y_edge : -(y_edge)) + x_dim)) + (x_base - (x_edge >= 0 ? x_edge : -(x_edge)) + 1 >= 0 ? x_base - (x_edge >= 0 ? x_edge : -(x_edge)) + 1 : -(x_base - (x_edge >= 0 ? x_edge : -(x_edge)) + 1))] += filt[x_filt];
    }
  }
}
```