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

```asm
<extendsurface>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x128,%rsp
  movss  D5(%rip),%xmm5
  mov    %edx,0x7c(%rsp)
  mov    0x160(%rsp),%r14
  movabs $0x3f3504f33f800000,%rdx
  mov    %edi,0x3c(%rsp)
  mov    %esi,0x8(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  movabs $0x3f3504f33f13cd3a,%rax
  mov    %rdx,0xb0(%rsp)
  mov    %rdx,0xc8(%rsp)
  movq   $0x3f800000,0xd0(%rsp)
  mov    %rdx,0xd8(%rsp)
  mov    %rdx,0xe0(%rsp)
  mov    %rdx,0xf8(%rsp)
  mov    %rax,0xa0(%rsp)
  mov    %rax,0xa8(%rsp)
  mov    %rax,0xb8(%rsp)
  mov    %rax,0xc0(%rsp)
  mov    %rax,0xe8(%rsp)
  mov    %rax,0xf0(%rsp)
  mov    %rax,0x100(%rsp)
  movss  %xmm5,0x108(%rsp)
  test   %ebx,%ebx
  jle    L118
  mov    %edi,%eax
  imul   %esi,%edi
  pxor   %xmm4,%xmm4
  mov    %rcx,%r15
  mov    %ebx,%ecx
  movl   $0x0,0x4(%rsp)
  movslq %edi,%r13
  mov    %eax,%edi
  not    %eax
  imul   %esi,%eax
  lea    0x0(,%r13,4),%rbx
  mov    %r13d,0x78(%rsp)
  mov    %rbx,0x98(%rsp)
  mov    %eax,0x50(%rsp)
  mov    %eax,0x74(%rsp)
  lea    -0x1(%rcx),%eax
  mov    %eax,0xc(%rsp)
  lea    -0x1(%rdi),%eax
  mov    %eax,0x38(%rsp)
  movslq %esi,%rax
  mov    %rax,0x48(%rsp)
  mov    %r14,%rax
  mov    %r9,%r14
  mov    %rax,%r12
  cs nopw 0x0(%rax,%rax,1)
L93:
  mov    0x74(%rsp),%eax
  movl   $0x0,(%rsp)
  mov    %eax,0x14(%rsp)
  mov    0x3c(%rsp),%eax
  test   %eax,%eax
  jle    L189
  mov    %r14,%rax
  mov    %r15,%r14
  mov    %r13,%r15
  mov    %rax,%r13
  nopw   0x0(%rax,%rax,1)
L128:
  mov    0x8(%rsp),%edx
  test   %edx,%edx
  jle    L185
  mov    0x14(%rsp),%edi
  mov    0x4(%rsp),%ecx
  mov    (%rsp),%esi
  mov    0x18(%rsp),%r10
  mov    %edi,%r9d
  sub    0x50(%rsp),%r9d
  test   %ecx,%ecx
  sete   %dl
  test   %esi,%esi
  sete   %al
  xor    %ebp,%ebp
  or     %eax,%edx
  movslq %edi,%rax
  mov    %rax,0x40(%rsp)
  add    %rax,%r10
  mov    0x8(%rsp),%eax
  lea    -0x1(%rax),%ebx
  mov    %rbx,%rax
  mov    %ebx,0x10(%rsp)
  mov    %edx,%ebx
  mov    %rax,%r11
  jmp    L242
  nopl   (%rax)
L296:
  test   %bl,%bl
  jne    L249
  mov    0x4(%rsp),%ecx
  cmp    %ecx,0xc(%rsp)
  je     L249
  mov    (%rsp),%edi
  cmp    %edi,0x38(%rsp)
  je     L249
  cmp    %ebp,0x10(%rsp)
  je     L249
  mov    0x18(%rsp),%rcx
  movslq %r9d,%rax
  lea    0x0(%r13,%rax,4),%rsi
  lea    (%r12,%rax,1),%rdx
  mov    %rax,0x30(%rsp)
  cmpb   $0x0,(%rcx,%rax,1)
  mov    %rsi,0x20(%rsp)
  mov    %rdx,0x28(%rsp)
  je     L220
  mov    0x30(%rsp),%rax
  movss  (%r14,%rax,4),%xmm0
  mov    0x20(%rsp),%rax
  movss  %xmm0,(%rax)
  mov    0x28(%rsp),%rax
  movb   $0x1,(%rax)
  nopl   0x0(%rax,%rax,1)
L144:
  lea    0x1(%rbp),%rax
  add    $0x1,%r9d
  add    $0x1,%r10
  cmp    %r11,%rbp
  je     L185
  mov    %rax,%rbp
L242:
  test   %ebp,%ebp
  jne    L296
L249:
  movslq %r9d,%rax
  movss  (%r14,%rax,4),%xmm0
  movss  %xmm0,0x0(%r13,%rax,4)
  movb   $0x0,(%r12,%rax,1)
  jmp    L144
  nop
L185:
  addl   $0x1,(%rsp)
  mov    0x8(%rsp),%ebx
  mov    (%rsp),%eax
  add    %ebx,0x14(%rsp)
  cmp    %eax,0x3c(%rsp)
  jne    L128
  mov    %r13,%rax
  mov    %r15,%r13
  mov    %r14,%r15
  mov    %rax,%r14
L189:
  addl   $0x1,0x4(%rsp)
  mov    0x78(%rsp),%ebx
  mov    0x4(%rsp),%eax
  add    %ebx,0x74(%rsp)
  cmp    %eax,0x7c(%rsp)
  jne    L93
L118:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L180
  add    $0x128,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L220:
  mov    %r9d,0x70(%rsp)
  mov    $0xffffffff,%edi
  movaps %xmm5,%xmm1
  movaps %xmm4,%xmm2
  lea    0xc4(%rsp),%rax
  mov    %bl,0x57(%rsp)
  mov    %r10,%rbx
  mov    %rax,0x68(%rsp)
  mov    %rbp,0x58(%rsp)
  mov    %edi,%ebp
  mov    %r10,0x60(%rsp)
  mov    %rax,%r10
L12:
  add    $0x1,%ebp
  mov    %r10,%r8
  lea    -0x1(%rbx),%r9
  xor    %edi,%edi
L80:
  lea    (%r9,%rdi,1),%rdx
  mov    %r8,%rcx
  mov    $0x3,%eax
L307:
  movsbl (%rdx),%esi
  pxor   %xmm0,%xmm0
  add    %r15,%rdx
  cvtsi2ss %esi,%xmm0
  mulss  %xmm1,%xmm0
  addss  %xmm0,%xmm2
  sub    $0x1,%eax
  je     L160
  movss  (%rcx),%xmm1
  add    $0x24,%rcx
  jmp    L307
L160:
  add    $0x1,%rdi
  add    $0xc,%r8
  cmp    $0x3,%rdi
  je     L214
  movss  -0x24(%r8),%xmm1
  jmp    L80
  cs nopw 0x0(%rax,%rax,1)
L214:
  add    $0x4,%r10
  add    0x48(%rsp),%rbx
  cmp    $0x2,%ebp
  je     L178
  movss  -0x24(%r10),%xmm1
  jmp    L12
  cs nopw 0x0(%rax,%rax,1)
L178:
  ucomiss %xmm4,%xmm2
  movzbl 0x57(%rsp),%ebx
  mov    0x58(%rsp),%rbp
  mov    0x70(%rsp),%r9d
  mov    0x60(%rsp),%r10
  jp     L77
  jne    L77
  mov    0x30(%rsp),%rax
  movss  (%r14,%rax,4),%xmm0
  mov    0x20(%rsp),%rax
  movss  %xmm0,(%rax)
  mov    0x28(%rsp),%rax
  movb   $0x0,(%rax)
  jmp    L144
L77:
  lea    -0x4(%r14,%rbp,4),%rdi
  mov    %bl,0x57(%rsp)
  movaps %xmm5,%xmm0
  movaps %xmm4,%xmm1
  mov    0x40(%rsp),%rax
  mov    %rdi,0x30(%rsp)
  mov    $0xffffffff,%edx
  mov    %r9d,0x70(%rsp)
  mov    %r10,0x60(%rsp)
  mov    %rbp,0x58(%rsp)
  mov    0x68(%rsp),%rbp
  mov    %r11,0x68(%rsp)
  mov    0x98(%rsp),%r11
  mov    %r14,0x80(%rsp)
  mov    %edx,%r14d
  mov    %r13,0x88(%rsp)
  mov    %rax,%r13
  mov    %r12,0x90(%rsp)
  mov    %r10,%r12
L23:
  mov    0x30(%rsp),%rax
  add    $0x1,%r14d
  mov    %rbp,%r9
  xor    %r8d,%r8d
  lea    -0x1(%r12),%rbx
  lea    (%rax,%r13,4),%r10
L82:
  lea    (%rbx,%r8,1),%rcx
  mov    %r9,%rsi
  mov    %r10,%rdx
  mov    $0x3,%eax
L253:
  movsbl (%rcx),%edi
  mulss  (%rdx),%xmm0
  pxor   %xmm3,%xmm3
  add    %r11,%rdx
  add    %r15,%rcx
  cvtsi2ss %edi,%xmm3
  mulss  %xmm3,%xmm0
  addss  %xmm0,%xmm1
  sub    $0x1,%eax
  je     L147
  movss  (%rsi),%xmm0
  add    $0x24,%rsi
  jmp    L253
  nop
L147:
  add    $0x1,%r8
  add    $0x4,%r10
  add    $0xc,%r9
  cmp    $0x3,%r8
  je     L42
  movss  -0x24(%r9),%xmm0
  jmp    L82
  nopw   0x0(%rax,%rax,1)
L42:
  mov    0x48(%rsp),%rax
  add    $0x4,%rbp
  add    %rax,%r13
  add    %rax,%r12
  cmp    $0x2,%r14d
  je     L308
  movss  -0x24(%rbp),%xmm0
  jmp    L23
L308:
  divss  %xmm2,%xmm1
  mov    0x20(%rsp),%rax
  movzbl 0x57(%rsp),%ebx
  mov    0x58(%rsp),%rbp
  mov    0x70(%rsp),%r9d
  mov    0x60(%rsp),%r10
  mov    0x68(%rsp),%r11
  mov    0x80(%rsp),%r14
  mov    0x88(%rsp),%r13
  mov    0x90(%rsp),%r12
  movss  %xmm1,(%rax)
  mov    0x28(%rsp),%rax
  movb   $0x1,(%rax)
  jmp    L144
L180:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D5
type_infered: byte[4]

tool: {"D5": [0x3a,0xcd,0x13,0x3f]}

assistant: ```c
void extendsurface(int nx, int ny, int nz, float *E, char *c, float *Ex, char *cx) {
  int ix, iy, iz, i, j, k;
  float R[27], s, t;
  for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
      for (k = 0; k < 3; k++) {
        R[i + 3 * (j + 3 * k)] = (i != 1 ? (j != 1 ? (k != 1 ? 1.0 / sqrt(3.0) : 1.0 / sqrt(2.0)) : (k != 1 ? 1.0 / sqrt(2.0) : 1)) : (j != 1 ? (k != 1 ? 1.0 / sqrt(2.0) : 1) : (k != 1 ? 1 : 0)));
      }
  for (iz = 0; iz < nz; iz++) {
    for (ix = 0; ix < nx; ix++) {
      for (iy = 0; iy < ny; iy++) {
        if (iz == 0 || ix == 0 || iy == 0 || iz == nz - 1 || ix == nx - 1 || iy == ny - 1) {
          Ex[iy + ny * (ix + iz * nx)] = E[iy + ny * (ix + iz * nx)];
          cx[iy + ny * (ix + iz * nx)] = 0;
        } else {
          if (!c[iy + ny * (ix + iz * nx)]) {
            s = 0;
            for (i = -1; i < 2; i++) {
              for (j = -1; j < 2; j++) {
                for (k = -1; k < 2; k++) {
                  s += R[(i + 1) + 3 * ((j + 1) + 3 * (k + 1))] * c[iy + j + ny * (ix + i + nx * (iz + k))];
                }
              }
            }
            if (s) {
              t = 0;
              for (i = -1; i <= 1; i++) {
                for (j = -1; j <= 1; j++) {
                  for (k = -1; k <= 1; k++) {
                    t += (R[(i + 1) + 3 * ((j + 1) + 3 * (k + 1))] * E[iy + j + ny * (ix + i + nx * (iz + k))] * c[iy + j + ny * (ix + i + nx * (iz + k))]);
                  }
                }
              }
              Ex[iy + ny * (ix + iz * nx)] = t / s;
              cx[iy + ny * (ix + iz * nx)] = 1;
            } else {
              Ex[iy + ny * (ix + iz * nx)] = E[iy + ny * (ix + iz * nx)];
              cx[iy + ny * (ix + iz * nx)] = 0;
            }
          } else {
            Ex[iy + ny * (ix + iz * nx)] = E[iy + ny * (ix + iz * nx)];
            cx[iy + ny * (ix + iz * nx)] = 1;
          }
        }
      }
    }
  }
}
```