user: Please show me the C implementation that matches the assembly code listed below:

```asm
<set_uvwp_surface>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xb0,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8,-0x68(%rbp)
  movsd  %xmm0,-0x70(%rbp)
  movsd  %xmm1,-0x78(%rbp)
  movsd  %xmm2,-0x80(%rbp)
  mov    %r9d,-0x84(%rbp)
  movsd  %xmm3,-0x90(%rbp)
  movsd  %xmm4,-0x98(%rbp)
  movsd  %xmm5,-0xa0(%rbp)
  movsd  %xmm6,-0xa8(%rbp)
  movsd  %xmm7,-0xb0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x84(%rbp),%r9d
  mov    -0x60(%rbp),%r8
  mov    -0x58(%rbp),%rcx
  mov    -0x50(%rbp),%rdx
  mov    -0x48(%rbp),%rsi
  mov    -0x68(%rbp),%rax
  mov    0x18(%rbp),%edi
  push   %rdi
  mov    0x10(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <clean_empty_space@plt>
  add    $0x10,%rsp
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L75
L115:
  movl   $0x0,-0x10(%rbp)
  jmp    L32
L218:
  movl   $0x0,-0x14(%rbp)
  jmp    L122
L198:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <issurface@plt>
  test   %rax,%rax
  je     L73
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    -0x24(%rbp),%r9
  lea    -0x28(%rbp),%r8
  lea    -0x2c(%rbp),%rcx
  lea    -0x30(%rbp),%rdx
  lea    -0x34(%rbp),%rsi
  lea    -0x1c(%rbp),%rdi
  push   %rdi
  lea    -0x20(%rbp),%rdi
  push   %rdi
  mov    %eax,%edi
  call   <getsurfacetype@plt>
  add    $0x10,%rsp
  mov    %eax,-0x18(%rbp)
  cmpl   $0x20,-0x18(%rbp)
  ja     L91
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D4(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D4(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L73
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L73
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  sub    $0x8,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L73
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L73
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  sub    $0x8,%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L73
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  jmp    L73
L91:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  nop
L73:
  addl   $0x1,-0x14(%rbp)
L122:
  mov    0x18(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jle    L198
  addl   $0x1,-0x10(%rbp)
L32:
  mov    -0x84(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x10(%rbp)
  jle    L218
  addl   $0x1,-0xc(%rbp)
L75:
  mov    0x10(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0xc(%rbp)
  jle    L115
  movl   $0x2,-0xc(%rbp)
  jmp    L94
L216:
  movl   $0x2,-0x10(%rbp)
  jmp    L59
L63:
  movl   $0x2,-0x14(%rbp)
  jmp    L12
L189:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <issurface@plt>
  test   %rax,%rax
  je     L4
  movsd  -0xa0(%rbp),%xmm2
  movsd  -0x98(%rbp),%xmm1
  movsd  -0x90(%rbp),%xmm0
  mov    -0xa8(%rbp),%rdi
  mov    -0x10(%rbp),%r9d
  mov    -0x68(%rbp),%r10
  mov    -0x60(%rbp),%rcx
  mov    -0x58(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x48(%rbp),%rax
  sub    $0x8,%rsp
  mov    0x18(%rbp),%r8d
  push   %r8
  mov    0x10(%rbp),%r8d
  push   %r8
  mov    -0x84(%rbp),%r8d
  push   %r8
  mov    -0x14(%rbp),%r8d
  push   %r8
  mov    -0xc(%rbp),%r8d
  push   %r8
  movapd %xmm2,%xmm3
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rdi,%xmm0
  mov    %r10,%r8
  mov    %rax,%rdi
  call   <compute_surface_values@plt>
  add    $0x30,%rsp
L4:
  addl   $0x1,-0x14(%rbp)
L12:
  mov    -0x14(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jl     L189
  addl   $0x1,-0x10(%rbp)
L59:
  mov    -0x10(%rbp),%eax
  cmp    -0x84(%rbp),%eax
  jl     L63
  addl   $0x1,-0xc(%rbp)
L94:
  mov    -0xc(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L216
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L196
  call   <__stack_chk_fail@plt>
L196:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D20
type: string

tool: D20: %d

assistant: ```c
void set_uvwp_surface(double ***U, double ***V, double ***W, double ***P, int ***Flag, double dx, double dy, double dz, int imax, int jmax, int kmax, double GX, double GY, double GZ, double dt, double Re) {
  clean_empty_space(Flag, U, V, W, P, imax, jmax, kmax);
  int i, j, k;
  int type = 0;
  int nx, ny, nz;
  int mx, my, mz;
  int num;
  for (j = 0; j <= jmax + 1; j++) {
    for (i = 0; i <= imax + 1; i++) {
      for (k = 0; k <= kmax + 1; k++) {
        if (issurface(Flag[i][j][k])) {
          type = getsurfacetype(Flag[i][j][k], &nx, &ny, &nz, &mx, &my, &mz, &num);
          switch (type) {
          case 32:
            P[i][j][k] = P[i - 1][j][k];
            break;
          case 16:
            P[i][j][k] = P[i][j + 1][k];
            break;
          case 8:
            P[i][j][k] = P[i][j - 1][k];
            break;
          case 4:
            P[i][j][k] = P[i][j + 1][k];
            break;
          case 1:
            P[i][j][k] = P[i][j][k - 1];
            break;
          case 2:
            P[i][j][k] = P[i][j][k + 1];
            break;
          default:
            P[i][j][k] = 0;
            break;
            P[i][j][k] = 0;
            break;
            P[i][j][k] = 0;
            break;
            P[i][j][k] = 0;
            break;
            P[i][j][k] = 0;
            break;
            P[i][j][k] = 0;
            break;
            P[i][j][k] = 0;
            break;
            break;
          }
        }
      }
    }
  }
  for (j = 2; j < jmax; j++) {
    for (i = 2; i < imax; i++) {
      for (k = 2; k < kmax; k++) {
        if (issurface(Flag[i][j][k])) {
          compute_surface_values(U, V, W, P, Flag, i, j, k, dt, GX, GY, GZ, imax, jmax, kmax);
        }
      }
    }
  }
  printf("%d", type);
}
```