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

```asm
<Extend>:
  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    L137
  lea    -0x1(%rax),%ecx
  jmp    L76
L137:
  mov    $0x0,%ecx
L76:
  mov    %ecx,%r14d
  cmpl   $0x0,-0x54(%rbp)
  jle    L230
  mov    -0x4c(%rbp),%ecx
  sub    $0x1,%ecx
  jmp    L187
L230:
  mov    $0x0,%ecx
L187:
  imul   %eax,%ecx
  mov    %ecx,%r10d
  cmpl   $0x0,-0x50(%rbp)
  jle    L519
  mov    -0x50(%rbp),%ecx
  sub    $0x1,%ecx
  jmp    L119
L519:
  mov    -0x50(%rbp),%ecx
  mov    $0xffffffff,%esi
  test   %ecx,%ecx
  cmovns %esi,%ecx
  add    $0x1,%ecx
L119:
  mov    %ecx,-0x38(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jle    L508
  mov    -0x54(%rbp),%ecx
  sub    $0x1,%ecx
  jmp    L102
L508:
  mov    -0x54(%rbp),%ecx
  mov    $0xffffffff,%esi
  test   %ecx,%ecx
  cmovns %esi,%ecx
  add    $0x1,%ecx
L102:
  imul   %eax,%ecx
  mov    %ecx,-0x34(%rbp)
  cmpl   $0x0,-0x50(%rbp)
  jns    L655
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %eax,%ecx
  sar    %ecx
  jmp    L372
L655:
  lea    -0x1(%rax),%ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  add    %esi,%ecx
  sar    %ecx
L372:
  mov    %ecx,-0x30(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jns    L386
  mov    -0x4c(%rbp),%ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  add    %esi,%ecx
  sar    %ecx
  jmp    L359
L386:
  mov    -0x4c(%rbp),%ecx
  sub    $0x1,%ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  add    %esi,%ecx
  sar    %ecx
L359:
  imul   %eax,%ecx
  mov    %ecx,-0x2c(%rbp)
  movl   $0x0,-0x40(%rbp)
  jmp    L47
L179:
  mov    -0x40(%rbp),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rcx)
  addl   $0x1,-0x40(%rbp)
L47:
  mov    -0x40(%rbp),%ecx
  cmp    -0x3c(%rbp),%ecx
  jl     L179
  cmpl   $0x0,0x10(%rbp)
  jne    L529
  mov    $0x0,%r15d
  mov    -0x34(%rbp),%r12d
  jmp    L594
L269:
  test   %r12d,%r12d
  js     L618
  cmp    -0x3c(%rbp),%r12d
  jge    L618
  mov    %r15d,%r13d
  mov    -0x38(%rbp),%ebx
  jmp    L540
L150:
  test   %ebx,%ebx
  js     L52
  cmp    %eax,%ebx
  jge    L52
  lea    (%r12,%rbx,1),%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
  lea    (%r12,%rbx,1),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  jmp    L194
L52:
  mov    %ebx,%ecx
  sub    %r14d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r14d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  add    %r12d,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm0
  movslq %r13d,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm1
  mov    %ebx,%ecx
  sub    %r14d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r14d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  add    %r12d,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  lea    (%r12,%r14,1),%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
  addsd  %xmm0,%xmm0
  lea    (%r12,%r14,1),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
L194:
  add    $0x1,%r13d
  add    $0x1,%ebx
L540:
  lea    (%r15,%rax,1),%ecx
  cmp    %ecx,%r13d
  jl     L150
  jmp    L326
L618:
  mov    %r15d,%r13d
  mov    -0x38(%rbp),%ebx
  jmp    L16
L71:
  test   %ebx,%ebx
  js     L265
  cmp    %eax,%ebx
  jge    L265
  mov    %r12d,%ecx
  sub    %r10d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r10d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  add    %ebx,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm0
  movslq %r13d,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm1
  mov    %r12d,%ecx
  sub    %r10d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r10d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  add    %ebx,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  lea    (%r10,%rbx,1),%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
  addsd  %xmm0,%xmm0
  lea    (%r10,%rbx,1),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  jmp    L10
L265:
  mov    %r12d,%ecx
  mov    %r10d,%r11d
  sub    %r11d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r11d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  mov    %ecx,%r8d
  mov    %ebx,%ecx
  sub    %r14d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r14d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  add    %r8d,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  movsd  (%rcx),%xmm0
  movslq %r13d,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm1
  mov    %r12d,%ecx
  sub    %r11d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r11d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  mov    %ecx,%r8d
  mov    %ebx,%ecx
  sub    %r14d,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovs  %ecx,%esi
  mov    %r14d,%ecx
  sub    %esi,%ecx
  mov    %ecx,%esi
  neg    %esi
  cmovns %esi,%ecx
  add    %r8d,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  lea    (%r11,%r14,1),%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
  addsd  %xmm0,%xmm0
  lea    (%r11,%r14,1),%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdx,%rcx
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
L10:
  add    $0x1,%r13d
  add    $0x1,%ebx
L16:
  lea    (%r15,%rax,1),%ecx
  cmp    %ecx,%r13d
  jl     L71
L326:
  add    %eax,%r15d
  add    %eax,%r12d
L594:
  cmp    -0x3c(%rbp),%r15d
  jl     L269
  jmp    L273
L529:
  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,%r15d
  mov    %r15d,%r12d
  sub    -0x34(%rbp),%r15d
  jmp    L272
L414:
  mov    %r14d,%ebx
  mov    %r14d,%r13d
  sub    -0x38(%rbp),%r13d
  jmp    L602
L402:
  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    %r15d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r15d,%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
L602:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L402
  cmpl   $0x0,-0x50(%rbp)
  je     L541
  mov    -0x38(%rbp),%ecx
  cmp    -0x30(%rbp),%ecx
  je     L209
  mov    %r14d,%ebx
  mov    -0x30(%rbp),%ecx
  add    %ecx,%ecx
  mov    %r14d,%esi
  sub    %ecx,%esi
  mov    -0x38(%rbp),%ecx
  lea    (%rsi,%rcx,1),%r13d
  jmp    L590
L276:
  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),%xmm0
  mov    %r15d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r15d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm1
  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
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L590:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L276
  jmp    L541
L209:
  mov    %r14d,%ebx
  mov    -0x30(%rbp),%ecx
  add    %ecx,%ecx
  mov    %r14d,%esi
  sub    %ecx,%esi
  mov    -0x38(%rbp),%ecx
  add    %esi,%ecx
  lea    -0x1(%rcx),%r13d
  jmp    L627
L624:
  mov    %r13d,%r9d
  jmp    L609
L516:
  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    %r15d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r15d,%esi
  mov    %r9d,%ecx
  neg    %ecx
  cmovs  %r9d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  addsd  %xmm0,%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,%r9d
L609:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  mov    %r9d,%esi
  cmp    %ecx,%esi
  jg     L516
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L627:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L624
L541:
  sub    %eax,%r15d
  sub    %eax,%r12d
L272:
  mov    %r10d,%ebx
  mov    %ebx,%ecx
  sub    -0x3c(%rbp),%ecx
  cmp    %ecx,%r15d
  jg     L414
  cmpl   $0x0,-0x54(%rbp)
  je     L273
  mov    -0x34(%rbp),%ecx
  cmp    -0x2c(%rbp),%ecx
  je     L388
  mov    %ebx,%r12d
  mov    -0x2c(%rbp),%ecx
  add    %ecx,%ecx
  sub    %ecx,%ebx
  mov    %ebx,%esi
  mov    -0x34(%rbp),%ecx
  lea    (%rsi,%rcx,1),%r15d
  jmp    L177
L55:
  mov    %r14d,%ebx
  mov    %r14d,%r13d
  sub    -0x38(%rbp),%r13d
  jmp    L469
L425:
  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),%xmm0
  mov    %r15d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r15d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm1
  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
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L469:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L425
  cmpl   $0x0,-0x50(%rbp)
  je     L178
  mov    -0x38(%rbp),%ecx
  cmp    -0x30(%rbp),%ecx
  je     L178
  mov    %r14d,%ebx
  mov    -0x30(%rbp),%ecx
  add    %ecx,%ecx
  mov    %r14d,%esi
  sub    %ecx,%esi
  mov    -0x38(%rbp),%ecx
  lea    (%rsi,%rcx,1),%r13d
  jmp    L221
L362:
  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),%xmm0
  mov    %r15d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r15d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm1
  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
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx)
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L221:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L362
L178:
  sub    %eax,%r15d
  sub    %eax,%r12d
L177:
  mov    %r10d,%ecx
  sub    -0x3c(%rbp),%ecx
  cmp    %ecx,%r15d
  jg     L55
  jmp    L273
L388:
  mov    %r10d,%ebx
  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,%r15d
  jmp    L292
L60:
  mov    %r15d,%r11d
  jmp    L665
L391:
  mov    %r14d,%ebx
  mov    %r14d,%r13d
  sub    -0x38(%rbp),%r13d
  jmp    L552
L64:
  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    %r11d,%r9d
  mov    %r9d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r9d,%esi
  mov    %r13d,%ecx
  neg    %ecx
  cmovs  %r13d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  addsd  %xmm0,%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
L552:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L64
  cmpl   $0x0,-0x50(%rbp)
  je     L96
  mov    -0x38(%rbp),%ecx
  cmp    -0x30(%rbp),%ecx
  jne    L96
  mov    %r14d,%ebx
  mov    -0x30(%rbp),%ecx
  add    %ecx,%ecx
  mov    %r14d,%esi
  sub    %ecx,%esi
  mov    -0x38(%rbp),%ecx
  add    %esi,%ecx
  lea    -0x1(%rcx),%r13d
  jmp    L193
L84:
  mov    %r13d,%r9d
  jmp    L36
L306:
  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    %r11d,%r8d
  mov    %r8d,%ecx
  neg    %ecx
  mov    %ecx,%esi
  cmovs  %r8d,%esi
  mov    %r9d,%r8d
  mov    %r8d,%ecx
  neg    %ecx
  cmovs  %r8d,%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  add    %rdi,%rcx
  movsd  (%rcx),%xmm0
  addsd  %xmm0,%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,%r8d
  mov    %r8d,%r9d
L36:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  mov    %r9d,%esi
  cmp    %ecx,%esi
  jg     L306
  sub    $0x1,%ebx
  sub    $0x1,%r13d
L193:
  mov    %r14d,%ecx
  sub    %eax,%ecx
  cmp    %ecx,%r13d
  jg     L84
L96:
  mov    %r11d,%ebx
  sub    %eax,%ebx
  mov    %ebx,%r11d
L665:
  mov    %r10d,%ecx
  sub    -0x3c(%rbp),%ecx
  mov    %r11d,%ebx
  cmp    %ecx,%ebx
  jg     L391
  sub    %eax,%r12d
  sub    %eax,%r15d
L292:
  mov    %r10d,%ecx
  sub    -0x3c(%rbp),%ecx
  cmp    %ecx,%r15d
  jg     L60
L273:
  mov    $0x0,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

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);
}
```